参见文章,这里是对之前的内容进行了改动,主要讲怎么将zentao容器融入到已有的docker-compose.yml中
一、zentao镜像
从官网上拉取:https://hub.docker.com/r/easysoft/zentao/tags
可以选择自己想要的版本,这里我选择的是开源版本:18.12
docker pull easysoft/zentao:18.12
参考文章:
docker-compose jira、bugzilla_docker bugzilla-CSDN博客
二、修改部分
不再赘述,只强调修改的部分:
1. docker-compose.yml
端口为:9002
version: '3.9'
services:
mysql:
image: mysql:5.7
container_name: mysql_container
ports:
- "3306:3306"
# restart: always
environment:
MYSQL_ROOT_PASSWORD: 123456
MYSQL_DATABASE_jira: jira
MYSQL_DATABASE_bugzilla: bugzilla
MYSQL_DATABASE_zentao: zentao
MYSQL_USER_jira: jira
MYSQL_PASSWORD_jira: 123456
MYSQL_USER_bugzilla: bugzilla
MYSQL_PASSWORD_bugzilla: 123456
MYSQL_USER_zentao: root
MYSQL_PASSWORD_zentao: 123456
networks:
- my-net
volumes:
- /home/cobot/IntegrationIssue/mysql:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
- ./mysqld.cnf:/etc/mysql/conf.d/mysql.cnf
- ./mysql_custom.cnf:/etc/mysql/mysql.conf.d/mysql_custom.cnf
jira:
image: jira:8.4.0
container_name: jira_container
ports:
- "9000:8080"
depends_on:
- mysql
environment:
- MYSQL_HOST=mysql_container
- MYSQL_PORT=3306
- MYSQL_DATABASE=jira
- MYSQL_USER=jira
- MYSQL_PASSWORD=123456
networks:
- my-net
volumes:
- ./dbconfig.xml:/var/atlassian/application-data/jira/dbconfig.xml
- ./lib/:/var/atlassian/application-data/jira/lib
bugzilla:
image: nasqueron/bugzilla
container_name: bugzilla_container
ports:
- "9001:80"
depends_on:
- mysql
# restart: always
environment:
- DB_HOST=mysql_container
- MYSQL_PORT=3306
- DB_DATABASE=bugzilla
- DB_USER=bugzilla
- DB_PASSWORD=123456
- BUGZILLA_URL=https://bugzilla.example.com
networks:
- my-net
volumes:
- ../bugzilla/localconfig:/usr/share/webapps/bugzilla/localconfig
zentao:
image: easysoft/zentao:18.12
restart: always
container_name: zentao_container
ports:
- 9002:80
depends_on:
- mysql
environment:
- MYSQL_HOST=mysql_container
- MYSQL_PORT=3306
- MYSQL_USER=root
- MYSQL_PASS=123456
- MYSQL_DBNAME=zentao
- MYSQL_PASSWORD=123456
networks:
- my-net
volumes:
- ./app:/app/zentaopms
- ./data:/opt/zbox/data/mysql
networks:
my-net:
driver: bridge
增加了zentao部分,zentao部分中mysql的配置,MYSQL_USER尽量用root,避免出现问题。
2. init.sql
MYSQL 容器中的核心初始化sql——init.sql也需要新建一个zentao的数据库。
CREATE DATABASE jira CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX ON jira.* TO 'jira'@'%' IDENTIFIED BY 'jira';
GRANT ALL PRIVILEGES ON jira.* TO 'jira'@'%' IDENTIFIED BY 'jira';
SET PASSWORD FOR 'jira'@'%' = PASSWORD('123456');
CREATE DATABASE bugzilla CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX ON bugzilla.* TO 'bugzilla'@'%' IDENTIFIED BY 'bugzilla';
GRANT ALL PRIVILEGES ON bugzilla.* TO 'bugzilla'@'%' IDENTIFIED BY 'bugzilla';
SET PASSWORD FOR 'bugzilla'@'%' = PASSWORD('123456');
CREATE DATABASE zentao CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,REFERENCES,ALTER,INDEX ON root.* TO 'root'@'%' IDENTIFIED BY 'root';
GRANT ALL PRIVILEGES ON root.* TO 'root'@'%' IDENTIFIED BY 'root';
SET PASSWORD FOR 'root'@'%' = PASSWORD('123456');
FLUSH PRIVILEGES;
注意:这里也是用root,数据库名是zentao
3. mysqld.cnf
[mysqld]
# 基本设置
user = root
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
skip-host-cache
skip-name-resolve
# 安全设置
bind-address = 0.0.0.0
# 字符集设置
character-set-server = utf8mb4
collation-server = utf8mb4_unicode_ci
# Jira
[client_jira]
user = jira
password = 123456
[jira]
default-storage-engine=INNODB
character_set_server=utf8mb4
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_log_file_size=2G
# ZENTAO
[client_zentao]
user = root
password = 123456
[zentao]
default-storage-engine=INNODB
character_set_server=utf8mb4
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_log_file_size=2G
# Bugzilla 设置
[client_bugzilla]
user = bugzilla
password = 123456
[bugzilla]
default-storage-engine=INNODB
character_set_server=utf8mb4
innodb_default_row_format=DYNAMIC
innodb_large_prefix=ON
innodb_file_format=Barracuda
innodb_log_file_size=2G
# 日志设置
log_error = /var/log/mysql/error.log
log_queries_not_using_indexes = 1
# InnoDB 存储引擎设置
innodb_file_per_table = 1
innodb_buffer_pool_size = 128M
innodb_log_file_size = 256M
innodb_flush_log_at_trx_commit = 1
也是,新增zentao_client部分即可。
然后,docker-compose up -d即可。
三、zentao访问
通过ip+端口,就可以访问,首先是需要先进行安装的,然后配置数据库,直接默认,这里勾选清库,然后保存。
下一页是设置管理员的账号密码,完成后就可以进入到登录页面了。
这里,忘记截图了,可以参考这篇文章 5、禅道初始化 开始的内容:
docker部署禅道-CSDN博客