Skip to content

Commit 2baf356

Browse files
committed
feat: add redis and horizon to docker compose file
1 parent b333232 commit 2baf356

1 file changed

Lines changed: 195 additions & 175 deletions

File tree

docker-compose.yaml

Lines changed: 195 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -1,179 +1,199 @@
11
services:
2-
volume-prep:
3-
image: alpine
4-
command: >
5-
sh -c "
6-
mkdir -p /shared &&
7-
chown -R 9999:9999 /shared &&
8-
chmod 775 /shared &&
9-
echo 'Volume ready'"
10-
volumes:
11-
- shared-env:/shared
12-
networks:
13-
- mediaServer-db
14-
restart: on-failure
15-
app: &app
16-
image: aminnausin/mediaserver:${DOCKER_RELEASE:-latest}
17-
container_name: MediaServer
18-
volumes:
19-
- ./data:/var/www/html/storage/app/public
20-
- ./logs/mediaServer:/var/www/html/storage/logs
21-
- ./docker/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
22-
- ./docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf
23-
- ./logs/nginx:/var/log/nginx
24-
- shared-env:/var/www/html/shared
25-
ports:
26-
- '${APP_PORT:-8080}:8080'
27-
expose:
28-
- '${APP_PORT:-8080}'
29-
environment:
30-
- SHARED_UID=9999
31-
- SHARED_GID=9999
32-
healthcheck:
33-
test: curl --fail http://${APP_HOST:-app.test}:8080/api/health || exit 1
34-
# test: ['CMD', 'sh', '-c', 'test -f /var/www/html/shared/.env && curl --fail http://${APP_HOST:-app.test}:8080/api/health']
35-
#-f /var/www/html/shared/.env &&
36-
interval: 15s
37-
timeout: 10s
38-
retries: 3
39-
depends_on:
40-
postgres:
41-
condition: service_healthy
42-
# volume-prep:
43-
# condition: service_completed_successfully
44-
env_file:
45-
- .env
46-
labels:
47-
caddy: ${APP_HOST:-app.test}
48-
caddy.reverse_proxy: '* {{upstreams 8080}}'
49-
networks:
50-
mediaServer-db:
51-
default:
52-
aliases:
53-
- app.test
54-
queue:
55-
<<: *app
56-
container_name: job_queue
57-
command: ['php', '/var/www/html/artisan', 'queue:work', '--tries=3']
58-
environment:
59-
- LOG_FILENAME=laravel-queue.log
60-
ports: []
61-
expose: []
62-
stop_grace_period: 5s
63-
stop_signal: SIGTERM
64-
depends_on:
65-
app:
66-
condition: service_healthy
67-
healthcheck:
68-
test: ['CMD', 'healthcheck-queue']
69-
start_period: 10s
70-
networks:
71-
mediaServer-db:
72-
default:
73-
aliases: []
74-
event-queue:
75-
<<: *app
76-
container_name: event_queue
77-
command: ['php', '/var/www/html/artisan', 'queue:work', '--queue=high', '--tries=3']
78-
environment:
79-
- LOG_FILENAME=laravel-event-queue.log
80-
ports: []
81-
expose: []
82-
stop_grace_period: 5s
83-
stop_signal: SIGTERM
84-
depends_on:
85-
app:
86-
condition: service_healthy
87-
healthcheck:
88-
test: ['CMD', 'healthcheck-queue']
89-
networks:
90-
mediaServer-db:
91-
default:
92-
aliases: []
93-
scheduler:
94-
<<: *app
95-
container_name: laravel_scheduler
96-
command: ['php', '/var/www/html/artisan', 'schedule:work']
97-
environment:
98-
- LOG_FILENAME=laravel-scheduler.log
99-
ports: []
100-
expose: []
101-
stop_grace_period: 5s
102-
stop_signal: SIGTERM
103-
depends_on:
104-
app:
105-
condition: service_healthy
106-
healthcheck:
107-
test: ['CMD', 'healthcheck-schedule']
108-
networks:
109-
mediaServer-db:
110-
default:
111-
aliases: []
112-
ws:
113-
<<: *app
114-
container_name: ws
115-
command: php artisan reverb:start
116-
ports: []
117-
expose:
118-
- 6001
119-
environment:
120-
- LOG_FILENAME=laravel-ws.log
121-
labels:
122-
caddy: ${APP_HOST:-app.test}
123-
caddy.reverse_proxy: '* {{upstreams 6001}}'
124-
stop_grace_period: 5s
125-
stop_signal: SIGTERM
126-
depends_on:
127-
app:
128-
condition: service_healthy
129-
healthcheck:
130-
test: ['CMD', 'healthcheck-schedule']
131-
networks:
132-
mediaServer-db:
133-
default:
134-
aliases: []
135-
caddy:
136-
image: 'caddy:2.9.1-alpine'
137-
container_name: caddy
138-
ports:
139-
- 80:80
140-
- 443:443
141-
- 443:443/udp
142-
volumes:
143-
- ./docker/etc/caddy/Caddyfile:/etc/caddy/Caddyfile
144-
- ./logs/caddy:/var/log/caddy
145-
- /var/run/docker.sock:/var/run/docker.sock
146-
restart: unless-stopped
147-
environment:
148-
- CADDY_INGRESS_NETWORKS=proxy_network
149-
postgres:
150-
image: bitnami/postgresql:17.2.0
151-
container_name: database
152-
platform: linux/amd64
153-
ports:
154-
- 5432:5432
155-
restart: always
156-
volumes:
157-
- db-data:/bitnami/postgresql
158-
environment:
159-
- POSTGRESQL_DATABASE=${DB_DATABASE:-mediaServer}
160-
- POSTGRESQL_USERNAME=${DB_USERNAME:-postgres}
161-
- POSTGRESQL_PASSWORD=${DB_PASSWORD:-root}
162-
healthcheck:
163-
test: ['CMD-SHELL', 'pg_isready -U ${DB_USERNAME}', '-d', '${DB_DATABASE:-mediaServer}']
164-
interval: 5s
165-
timeout: 2s
166-
retries: 10
167-
networks:
168-
- mediaServer-db
2+
volume-prep:
3+
image: alpine
4+
command: >
5+
sh -c "
6+
mkdir -p /shared &&
7+
chown -R 9999:9999 /shared &&
8+
chmod 775 /shared &&
9+
echo 'Volume ready'"
10+
volumes:
11+
- shared-env:/shared
12+
networks:
13+
- mediaServer-db
14+
restart: on-failure
15+
app: &app
16+
image: aminnausin/mediaserver:${DOCKER_RELEASE:-latest}
17+
container_name: MediaServer
18+
volumes:
19+
- ./data:/var/www/html/storage/app/public
20+
- ./logs/mediaServer:/var/www/html/storage/logs
21+
- ./docker/etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf
22+
- ./docker/etc/nginx/nginx.conf:/etc/nginx/nginx.conf
23+
- ./logs/nginx:/var/log/nginx
24+
- shared-env:/var/www/html/shared
25+
ports:
26+
- '${APP_PORT:-8080}:8080'
27+
expose:
28+
- '${APP_PORT:-8080}'
29+
environment:
30+
- SHARED_UID=9999
31+
- SHARED_GID=9999
32+
healthcheck:
33+
test: curl --fail http://${APP_HOST:-app.test}:8080/api/health || exit 1
34+
# test: ['CMD', 'sh', '-c', 'test -f /var/www/html/shared/.env && curl --fail http://${APP_HOST:-app.test}:8080/api/health']
35+
#-f /var/www/html/shared/.env &&
36+
interval: 15s
37+
timeout: 10s
38+
retries: 3
39+
depends_on:
40+
postgres:
41+
condition: service_healthy
42+
# volume-prep:
43+
# condition: service_completed_successfully
44+
env_file:
45+
- .env
46+
labels:
47+
caddy: ${APP_HOST:-app.test}
48+
caddy.reverse_proxy: '* {{upstreams 8080}}'
49+
networks:
50+
mediaServer-db:
51+
default:
52+
aliases:
53+
- app.test
54+
redis:
55+
image: redis:8-alpine
56+
container_name: redis
57+
command: "redis-server --appendonly yes --requirepass phpredis"
58+
horizon:
59+
<<: *app
60+
container_name: horizon
61+
command: ["php", "/var/www/html/artisan", "horizon"]
62+
stop_signal: SIGTERM
63+
depends_on:
64+
- app
65+
- redis
66+
ports: []
67+
expose: []
68+
healthcheck:
69+
test: ["CMD", "healthcheck-horizon"]
70+
start_period: 10s
71+
networks:
72+
mediaServer-db:
73+
default:
74+
queue:
75+
<<: *app
76+
container_name: job_queue
77+
command: ['php', '/var/www/html/artisan', 'queue:work', '--tries=3']
78+
environment:
79+
- LOG_FILENAME=laravel-queue.log
80+
ports: []
81+
expose: []
82+
stop_grace_period: 5s
83+
stop_signal: SIGTERM
84+
depends_on:
85+
app:
86+
condition: service_healthy
87+
healthcheck:
88+
test: ['CMD', 'healthcheck-queue']
89+
start_period: 10s
90+
networks:
91+
mediaServer-db:
92+
default:
93+
aliases: []
94+
event-queue:
95+
<<: *app
96+
container_name: event_queue
97+
command: ['php', '/var/www/html/artisan', 'queue:work', '--queue=high', '--tries=3']
98+
environment:
99+
- LOG_FILENAME=laravel-event-queue.log
100+
ports: []
101+
expose: []
102+
stop_grace_period: 5s
103+
stop_signal: SIGTERM
104+
depends_on:
105+
app:
106+
condition: service_healthy
107+
healthcheck:
108+
test: ['CMD', 'healthcheck-queue']
109+
networks:
110+
mediaServer-db:
111+
default:
112+
aliases: []
113+
scheduler:
114+
<<: *app
115+
container_name: laravel_scheduler
116+
command: ['php', '/var/www/html/artisan', 'schedule:work']
117+
environment:
118+
- LOG_FILENAME=laravel-scheduler.log
119+
ports: []
120+
expose: []
121+
stop_grace_period: 5s
122+
stop_signal: SIGTERM
123+
depends_on:
124+
app:
125+
condition: service_healthy
126+
healthcheck:
127+
test: ['CMD', 'healthcheck-schedule']
128+
networks:
129+
mediaServer-db:
130+
default:
131+
aliases: []
132+
ws:
133+
<<: *app
134+
container_name: ws
135+
command: php artisan reverb:start
136+
ports: []
137+
expose:
138+
- 6001
139+
environment:
140+
- LOG_FILENAME=laravel-ws.log
141+
labels:
142+
caddy: ${APP_HOST:-app.test}
143+
caddy.reverse_proxy: '* {{upstreams 6001}}'
144+
stop_grace_period: 5s
145+
stop_signal: SIGTERM
146+
depends_on:
147+
app:
148+
condition: service_healthy
149+
healthcheck:
150+
test: ['CMD', 'healthcheck-schedule']
151+
networks:
152+
mediaServer-db:
153+
default:
154+
aliases: []
155+
caddy:
156+
image: 'caddy:2.9.1-alpine'
157+
container_name: caddy
158+
ports:
159+
- 80:80
160+
- 443:443
161+
- 443:443/udp
162+
volumes:
163+
- ./docker/etc/caddy/Caddyfile:/etc/caddy/Caddyfile
164+
- ./logs/caddy:/var/log/caddy
165+
- /var/run/docker.sock:/var/run/docker.sock
166+
restart: unless-stopped
167+
environment:
168+
- CADDY_INGRESS_NETWORKS=proxy_network
169+
postgres:
170+
image: bitnami/postgresql:17.2.0
171+
container_name: database
172+
platform: linux/amd64
173+
ports:
174+
- 5432:5432
175+
restart: always
176+
volumes:
177+
- db-data:/bitnami/postgresql
178+
environment:
179+
- POSTGRESQL_DATABASE=${DB_DATABASE:-mediaServer}
180+
- POSTGRESQL_USERNAME=${DB_USERNAME:-postgres}
181+
- POSTGRESQL_PASSWORD=${DB_PASSWORD:-root}
182+
healthcheck:
183+
test: ['CMD-SHELL', 'pg_isready -U ${DB_USERNAME}', '-d', '${DB_DATABASE:-mediaServer}']
184+
interval: 5s
185+
timeout: 2s
186+
retries: 10
187+
networks:
188+
- mediaServer-db
169189
volumes:
170-
db-data:
171-
driver: local
172-
shared-env:
173-
driver: local
190+
db-data:
191+
driver: local
192+
shared-env:
193+
driver: local
174194

175195
networks:
176-
default:
177-
driver: bridge
178-
mediaServer-db:
179-
driver: bridge
196+
default:
197+
driver: bridge
198+
mediaServer-db:
199+
driver: bridge

0 commit comments

Comments
 (0)