Skip to content

Commit 52598d7

Browse files
committed
调整docker conpose部署脚本
1 parent 3af86be commit 52598d7

File tree

2 files changed

+61
-9
lines changed

2 files changed

+61
-9
lines changed
+20-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
version: '4.9'
21
services:
3-
mysql:
2+
opentask-mysql:
43
restart: always
54
image: registry.cn-hangzhou.aliyuncs.com/hgui/mysql:8.4.1
6-
container_name: mysql
5+
container_name: opentask-mysql
76
volumes:
87
- /apps/mysql/mysql:/var/lib/mysql
98
- /apps/mysql/conf.d:/etc/mysql/conf.d
109
environment:
11-
- "MYSQL_ROOT_PASSWORD=OPEN_TASK_!@#"
10+
- "MYSQL_ROOT_PASSWORD=OPEN_TASK_123" # 请修改此处的密码
1211
- "MYSQL_DATABASE=open_task"
1312
ports:
1413
- 3306:3306
@@ -18,19 +17,31 @@ services:
1817
timeout: 2s
1918
retries: 10
2019

21-
api:
20+
opentask-api:
2221
restart: always
2322
image: registry.cn-hangzhou.aliyuncs.com/hgui/opentask:latest
24-
container_name: opentask
23+
container_name: opentask-api
2524
depends_on:
26-
mysql:
25+
opentask-mysql:
2726
condition: service_healthy
2827
volumes:
2928
- /apps/opentask/logs:/app/logs
3029
environment:
31-
- "ConnectionStrings__Core=server=mysql;Port=3306;user id=root;database=open_task;pooling=true;password=OPEN_TASK_!@#"
30+
- "ConnectionStrings__Core=server=opentask-mysql;Port=3306;user id=root;database=open_task;pooling=true;password=OPEN_TASK_123" # 请修改此处的密码
3231
- "TZ=Asia/Shanghai"
3332
ports:
3433
- 8080:8080
3534
links:
36-
- mysql
35+
- opentask-mysql
36+
37+
opentask-nginx:
38+
restart: always
39+
image: registry.cn-hangzhou.aliyuncs.com/hgui/nginx:1.26.1
40+
container_name: opentask-nginx
41+
volumes:
42+
- ./nginx.conf:/etc/nginx/nginx.conf
43+
ports:
44+
- 80:80
45+
links:
46+
- opentask-api
47+

deploy/docker-compose/nginx.conf

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
2+
user nginx;
3+
worker_processes auto;
4+
5+
error_log /var/log/nginx/error.log notice;
6+
pid /var/run/nginx.pid;
7+
8+
9+
events {
10+
worker_connections 1024;
11+
}
12+
13+
14+
http {
15+
include /etc/nginx/mime.types;
16+
default_type application/octet-stream;
17+
18+
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
19+
'$status $body_bytes_sent "$http_referer" '
20+
'"$http_user_agent" "$http_x_forwarded_for"';
21+
22+
access_log /var/log/nginx/access.log main;
23+
24+
sendfile on;
25+
#tcp_nopush on;
26+
27+
keepalive_timeout 65;
28+
29+
#gzip on;
30+
31+
include /etc/nginx/conf.d/*.conf;
32+
33+
server {
34+
listen 80;
35+
server_name opentask.run;
36+
37+
location / {
38+
proxy_pass http://opentask-api:8080;
39+
}
40+
}
41+
}

0 commit comments

Comments
 (0)