-
Notifications
You must be signed in to change notification settings - Fork 703
Expand file tree
/
Copy pathdocker-compose.prebuilt.yml
More file actions
151 lines (143 loc) · 4.77 KB
/
Copy pathdocker-compose.prebuilt.yml
File metadata and controls
151 lines (143 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
# 预构建镜像部署:服务器只 pull 镜像并启动,不执行 Docker build。
# 用法:docker compose --env-file .env.prod -f docker-compose.prebuilt.yml up -d
name: geoflow-laravel-prod
services:
postgres:
image: ${PGVECTOR_IMAGE:-pgvector/pgvector:pg18}
container_name: geoflow-postgres-prod
environment:
POSTGRES_DB: "${DB_DATABASE:-geo_flow}"
POSTGRES_USER: "${DB_USERNAME:-geo_user}"
POSTGRES_PASSWORD: "${DB_PASSWORD:-change-this-password}"
volumes:
- ${POSTGRES_DATA_DIR:-./docker-data/prod/postgres}:${POSTGRES_CONTAINER_DATA_DIR:-/var/lib/postgresql}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U \"$$POSTGRES_USER\" -d \"$$POSTGRES_DB\""]
interval: 10s
timeout: 5s
retries: 10
restart: unless-stopped
redis:
image: ${REDIS_IMAGE:-redis:8-alpine}
container_name: geoflow-redis-prod
environment:
REDIS_PASSWORD: "${REDIS_PASSWORD:-}"
command:
- /bin/sh
- -lc
- |
if [ -n "$${REDIS_PASSWORD:-}" ]; then
exec redis-server --appendonly yes --requirepass "$${REDIS_PASSWORD}"
fi
exec redis-server --appendonly yes
healthcheck:
test:
[
"CMD-SHELL",
"if [ -n \"$${REDIS_PASSWORD:-}\" ]; then redis-cli -a \"$${REDIS_PASSWORD}\" ping; else redis-cli ping; fi",
]
interval: 10s
timeout: 5s
retries: 10
restart: unless-stopped
init:
image: ${GEOFLOW_APP_IMAGE:?GEOFLOW_APP_IMAGE is required for prebuilt deployment}
container_name: geoflow-init-prod
working_dir: /var/www/html
env_file:
- ./.env.prod
command: ["php", "artisan", "about"]
volumes:
- ./.env.prod:/var/www/html/.env
- ./storage:/var/www/html/storage
depends_on:
postgres:
condition: service_healthy
redis:
condition: service_healthy
restart: "no"
app:
image: ${GEOFLOW_APP_IMAGE:?GEOFLOW_APP_IMAGE is required for prebuilt deployment}
container_name: geoflow-app-prod
working_dir: /var/www/html
volumes:
- ./.env.prod:/var/www/html/.env
- ./storage:/var/www/html/storage
depends_on:
init:
condition: service_completed_successfully
healthcheck:
test: ["CMD-SHELL", "php-fpm -t"]
interval: 30s
timeout: 5s
retries: 3
restart: unless-stopped
web:
image: ${GEOFLOW_WEB_IMAGE:?GEOFLOW_WEB_IMAGE is required for prebuilt deployment}
container_name: geoflow-web-prod
ports:
- "${WEB_PORT:-18080}:80"
volumes:
- ./storage:/var/www/html/storage:ro
depends_on:
app:
condition: service_started
reverb:
condition: service_started
healthcheck:
test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1/ || exit 1"]
interval: 30s
timeout: 5s
retries: 3
restart: unless-stopped
queue:
image: ${GEOFLOW_APP_IMAGE:?GEOFLOW_APP_IMAGE is required for prebuilt deployment}
container_name: geoflow-queue-prod
working_dir: /var/www/html
command: ["php", "artisan", "queue:work", "redis", "--queue=geoflow,distribution,theme-replication,default", "--sleep=1", "--tries=1", "--timeout=300"]
volumes:
- ./.env.prod:/var/www/html/.env
- ./storage:/var/www/html/storage
depends_on:
init:
condition: service_completed_successfully
redis:
condition: service_healthy
restart: unless-stopped
scheduler:
image: ${GEOFLOW_APP_IMAGE:?GEOFLOW_APP_IMAGE is required for prebuilt deployment}
container_name: geoflow-scheduler-prod
working_dir: /var/www/html
command: ["php", "artisan", "schedule:work"]
volumes:
- ./.env.prod:/var/www/html/.env
- ./storage:/var/www/html/storage
depends_on:
init:
condition: service_completed_successfully
restart: unless-stopped
reverb:
image: ${GEOFLOW_APP_IMAGE:?GEOFLOW_APP_IMAGE is required for prebuilt deployment}
container_name: geoflow-reverb-prod
working_dir: /var/www/html
# 端口由 .env.prod 的 REVERB_SERVER_PORT 决定(见 config/reverb.php);nginx /reverb 反代端口须与之对齐
command: ["php", "artisan", "reverb:start", "--host=0.0.0.0"]
ports:
- "${REVERB_EXPOSE_PORT:-18081}:${REVERB_SERVER_PORT:-18080}"
volumes:
- ./.env.prod:/var/www/html/.env
- ./storage:/var/www/html/storage
depends_on:
init:
condition: service_completed_successfully
redis:
condition: service_healthy
restart: unless-stopped
networks:
default:
name: ${DOCKER_NETWORK_NAME:-geoflow-prod-net}
ipam:
config:
# 避开 VPC 172.16.0.0/12,避免容器路由与内网地址冲突。
- subnet: ${DOCKER_NETWORK_SUBNET:-10.88.0.0/16}
gateway: ${DOCKER_NETWORK_GATEWAY:-10.88.0.1}