Skip to content

Commit 9d108ae

Browse files
committed
feat: enhance Docker Compose for caching and replication services
- Update the README to indicate support for ZenTao version 21.2 - Add new Docker Compose configuration files for caching and replication services - Define a caching service using Redis in the new Docker Compose file - Define a replication setup with master and slave database services in the new Docker Compose file - Update the existing Docker Compose file to include health checks for database services Signed-off-by: ysicing <[email protected]>
1 parent 44a7d7b commit 9d108ae

4 files changed

+182
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Zentao API client enabling Go programs to interact with Zentao in a simple and u
1010

1111
## NOTE
1212

13-
基于ZenTao最新开源版本[`20.8`](https://github.com/easysoft/zentaopms/tree/zentaopms_20.8_20241022)
13+
基于ZenTao最新开源版本[`21.2`](https://github.com/easysoft/zentaopms/releases/tag/zentaopms_21.2_20241205)
1414

1515
## API
1616

hack/docker-compose-cache.yml

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#
2+
# Copyright 2024, Zentao
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
services:
18+
19+
# db service for zentao
20+
zentao-db:
21+
image: bitnami/mariadb:10.6
22+
container_name: zentao-db
23+
pull_policy: if_not_present
24+
restart: always
25+
volumes:
26+
- 'zentao_db:/bitnami/mariadb'
27+
environment:
28+
- MARIADB_USER=my_user
29+
- MARIADB_PASSWORD=my_password
30+
- MARIADB_DATABASE=zentao
31+
- MARIADB_CHARACTER_SET=utf8mb4
32+
- MARIADB_COLLATE=utf8mb4_unicode_ci
33+
- MARIADB_ROOT_PASSWORD=pass4Zentao
34+
healthcheck:
35+
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
36+
interval: 15s
37+
timeout: 5s
38+
retries: 6
39+
40+
zentao-cache:
41+
image: bitnami/redis:6.2
42+
container_name: zentao-cache
43+
pull_policy: if_not_present
44+
restart: always
45+
environment:
46+
- REDIS_PASSWORD=pass4Zentao
47+
volumes:
48+
- 'zentao_cache:/bitnami/redis/data'
49+
50+
# zentao service
51+
zentao:
52+
image: easysoft/zentao
53+
container_name: zentao
54+
pull_policy: always
55+
restart: always
56+
ports:
57+
- '80:80'
58+
volumes:
59+
- 'zentao_data:/data'
60+
depends_on:
61+
- zentao-db
62+
- zentao-cache
63+
environment:
64+
- ZT_MYSQL_HOST=zentao-db
65+
- ZT_MYSQL_PORT=3306
66+
- ZT_MYSQL_USER=root
67+
- ZT_MYSQL_PASSWORD=pass4Zentao
68+
- ZT_MYSQL_DB=zentao
69+
- PHP_EXT_REDIS=true
70+
- ZT_REDIS_HOST=zentao-cache
71+
- ZT_REDIS_PORT=6379
72+
- ZT_REDIS_PASSWORD=pass4Zentao
73+
- ZT_REDIS_SERIALIZER= igbinary # php, igbinary
74+
- ZT_CACHE_ENABLE=true
75+
- ZT_CACHE_TYPE=redis
76+
- ZT_CACHE_SCOPE=private
77+
- ZT_CACHE_LIFETIME=0
78+
79+
# persistence for mysql and zentao
80+
volumes:
81+
zentao_db:
82+
zentao_cache:
83+
zentao_data:

hack/docker-compose-replication.yml

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
#
2+
# Copyright 2024, Zentao
3+
#
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
#
16+
17+
services:
18+
19+
# db service for zentao
20+
zentao-db-master:
21+
image: bitnami/mariadb:10.6
22+
container_name: zentao-db-master
23+
pull_policy: if_not_present
24+
restart: always
25+
volumes:
26+
- 'zentao_db_master:/bitnami/mariadb'
27+
environment:
28+
- MARIADB_ROOT_PASSWORD=pass4Zentao
29+
- MARIADB_DATABASE=zentao
30+
- MARIADB_USER=my_user
31+
- MARIADB_PASSWORD=my_password
32+
- MARIADB_CHARACTER_SET=utf8mb4
33+
- MARIADB_COLLATE=utf8mb4_unicode_ci
34+
- MARIADB_REPLICATION_MODE=master
35+
- MARIADB_REPLICATION_USER=repl_user
36+
- MARIADB_REPLICATION_PASSWORD=repl_pass
37+
healthcheck:
38+
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
39+
interval: 15s
40+
timeout: 5s
41+
retries: 6
42+
43+
zentao-db-slave:
44+
image: bitnami/mariadb:10.6
45+
container_name: zentao-db-slave
46+
pull_policy: if_not_present
47+
restart: always
48+
volumes:
49+
- 'zentao_db_slave:/bitnami/mariadb'
50+
depends_on:
51+
- zentao-db-master
52+
environment:
53+
- MARIADB_USER=my_user
54+
- MARIADB_PASSWORD=my_password
55+
- MARIADB_DATABASE=zentao
56+
- MARIADB_CHARACTER_SET=utf8mb4
57+
- MARIADB_COLLATE=utf8mb4_unicode_ci
58+
- MARIADB_REPLICATION_MODE=slave
59+
- MARIADB_REPLICATION_USER=repl_user
60+
- MARIADB_REPLICATION_PASSWORD=repl_pass
61+
- MARIADB_MASTER_HOST=zentao-db-master
62+
- MARIADB_MASTER_PORT_NUMBER=3306
63+
- MARIADB_MASTER_ROOT_PASSWORD=pass4Zentao
64+
healthcheck:
65+
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
66+
interval: 15s
67+
timeout: 5s
68+
retries: 6
69+
70+
# zentao service
71+
zentao:
72+
image: easysoft/zentao
73+
container_name: zentao
74+
pull_policy: always
75+
restart: always
76+
ports:
77+
- '80:80'
78+
volumes:
79+
- 'zentao_data:/data'
80+
depends_on:
81+
- zentao-db-master
82+
environment:
83+
- ZT_MYSQL_HOST=zentao-db-master
84+
- ZT_MYSQL_PORT=3306
85+
- ZT_MYSQL_USER=root
86+
- ZT_MYSQL_PASSWORD=pass4Zentao
87+
- ZT_MYSQL_DB=zentao
88+
89+
# persistence for mysql and zentao
90+
volumes:
91+
zentao_db_master:
92+
zentao_db_slave:
93+
zentao_data:

hack/docker-compose.yml

+5
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ services:
3030
- MARIADB_DATABASE=zentao
3131
- MARIADB_CHARACTER_SET=utf8mb4
3232
- MARIADB_COLLATE=utf8mb4_unicode_ci
33+
healthcheck:
34+
test: ['CMD', '/opt/bitnami/scripts/mariadb/healthcheck.sh']
35+
interval: 15s
36+
timeout: 5s
37+
retries: 6
3338

3439
# zentao service
3540
zentao:

0 commit comments

Comments
 (0)