4.5 部署项目管理工具-禅道
Docker版本禅道:https://www.zentao.net/book/zentaopmshelp/303.html
禅道开源版下载地址:http://dl.cnezsoft.com/zentao/docker/docker_zentao.zip
4.5.1 构建镜像
wget http://dl.cnezsoft.com/zentao/docker/docker_zentao.zip
unzip docker_zentao.zip
cd docker_zentao
# 修改Dockerfile
cat Dockerfile
FROM ubuntu:16.04
MAINTAINER yidong <yidong@cnezsoft.com>
# 修改为国内源
RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list && \
sed -i s@/security.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list && \
apt-get update
RUN apt-get install -y apache2 mariadb-server php php-curl php-gd php-ldap php-mbstring php-mcrypt php-mysql php-xml php-zip php-cli php-json curl unzip libapache2-mod-php locales
ENV LANG="en_US.UTF8"
ENV MYSQL_ROOT_PASSWORD="123456"
# 指定版本进行下载
ENV VERSION 12.0
RUN echo -e "LANG=\"en_US.UTF-8\"\nLANGUAGE=\"en_US:en\"" > /etc/default/locale && locale-gen en_US.UTF-8
RUN mkdir -p /app/zentaopms
COPY docker-entrypoint.sh /app
RUN chmod 777 /app/docker-entrypoint.sh
RUN curl http://dl.cnezsoft.com/zentao/${VERSION}/ZenTaoPMS.${VERSION}.stable.zip -o /var/www/zentao.zip
RUN cd /var/www/ && unzip -q zentao.zip && rm zentao.zip
RUN a2enmod rewrite
RUN rm -rf /etc/apache2/sites-enabled/000-default.conf /var/lib/mysql/*
RUN sed -i '1i ServerName 127.0.0.1' /etc/apache2/apache2.conf
COPY config/apache.conf /etc/apache2/sites-enabled/000-default.conf
COPY config/ioncube_loader_lin_7.0.so /usr/lib/php/20151012/ioncube_loader_lin_7.0.so
COPY config/00-ioncube.ini /etc/php/7.0/apache2/conf.d/
COPY config/00-ioncube.ini /etc/php/7.0/cli/conf.d/
VOLUME /app/zentaopms /var/lib/mysql
# 暴露80端口
EXPOSE 80
ENTRYPOINT ["/app/docker-entrypoint.sh"]
# 构建镜像
docker build -t hzde0128/zentao:v12.0 .
4.5.2 创建chart
# 初始化chart
helm create zentao
Creating zentao
cd zentao
# 添加MySQL依赖
cat > requirements.yaml <<EOF
dependencies:
- name: mysql
version: 1.6.2
repository: https://kubernetes-charts.storage.googleapis.com/
condition: mysql.enabled
tags:
- zentao-database
EOF
# 下载依赖
helm dependency update
load.go:112: Warning: Dependencies are handled in Chart.yaml since apiVersion "v2". We recommend migrating dependencies to Chart.yaml.
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "stable" chart repository
Update Complete. ⎈Happy Helming!⎈
Saving 1 charts
Downloading mysql from repo https://kubernetes-charts.storage.googleapis.com/
Deleting outdated charts
# 查看charts目录,依赖的mysql已经下载过来
tree
.
├── Chart.lock
├── charts
│ └── mysql-1.6.2.tgz
├── Chart.yaml
├── requirements.yaml
├── templates
│ ├── deployment.yaml
│ ├── _helpers.tpl
│ ├── ingress.yaml
│ ├── NOTES.txt
│ ├── serviceaccount.yaml
│ ├── service.yaml
│ └── tests
│ └── test-connection.yaml
└── values.yaml
3 directories, 12 files
# 检查语法
helm lint
==> Linting .
[INFO] Chart.yaml: icon is recommended
1 chart(s) linted, 0 chart(s) failed
4.5.3 部署chart
helm install zentao .
NAME: zentao
LAST DEPLOYED: Tue Feb 11 09:41:50 2020
NAMESPACE: default
STATUS: deployed
REVISION: 1
NOTES:
1. Get the application URL by running these commands:
export NODE_PORT=$(kubectl get --namespace default -o jsonpath="{.spec.ports[0].nodePort}" services zentao)
export NODE_IP=$(kubectl get nodes --namespace default -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
kubectl get po -l release=zentao
NAME READY STATUS RESTARTS AGE
zentao-bf44d76d5-tp6vh 1/1 Running 0 20m
zentao-mysql-86997ddcb8-pxv6n 1/1 Running 0 20m
kubectl get svc -l release=zentao
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
zentao NodePort 10.233.16.24 <none> 80:32607/TCP 21m
zentao-mysql ClusterIP 10.233.29.218 <none> 3306/TCP 21m
# 验证完成没问题打包
cd ..
helm package zentao
Successfully packaged chart and saved it to: /root/zentao-0.1.0.tgz
4.5.4 配置禅道
打开浏览器,输入:http://192.168.100.10:32607
进行访问
第一次登陆进入系统配置页面,数据库服务器选:zentao-mysql
,默认密码:123456
,禅道的具体操作略
4.5.5 附件
制作好的chart下载:zentao-0.10.tgz