-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.yml
131 lines (124 loc) · 3.75 KB
/
docker-compose.yml
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
# Production environment
services:
laravel:
build:
context: ./
dockerfile: Dockerfile
image: smcu-admin-app
pull_policy: build
volumes:
- /storage/smcu-admin-storage:/var/www/html/storage/app:rw,z
- /storage/smcu-admin-storage/public:/var/www/html/public/storage:rw,z
# - ./database:/var/www/html/database:Z # For testing
# - ./.env:/var/www/html/.env:Z # For testing
restart: on-failure:2
environment:
# https://serversideup.net/open-source/docker-php/docs/getting-started/default-configurations
- PHP_UPLOAD_MAX_FILE_SIZE=30M
- PHP_OPCACHE_ENABLE=1
# Enable Laravel config/route/view/event caching (caution: do not call env() in other places than config files)
#- AUTORUN_ENABLED=true
- APP_ENV=production
- APP_DEBUG=false
- REDIS_HOST=redis
- REDIS_PASSWORD=null
- REDIS_PORT=6379
- CACHE_DRIVER=redis
- LOG_CHANNEL=stderr
- SESSION_DRIVER=redis
# Load environment variables from Portainer stack configuration
env_file:
- stack.env
#ports: # For testing
# - "8080:8080"
labels:
# Traefik configuration discovery
# https://doc.traefik.io/traefik/providers/docker/#routing-configuration-with-labels
- "traefik.enable=true"
- "traefik.http.middlewares.admin-redirect.redirectscheme.scheme=https"
- "traefik.http.middlewares.admin-redirect.redirectscheme.permanent=true"
- "traefik.http.routers.admin-http.middlewares=admin-redirect"
- "traefik.http.routers.admin-http.rule=Host(`admin.docchula.com`)"
- "traefik.http.routers.admin-http.entrypoints=web"
- "traefik.http.routers.admin-https.rule=Host(`admin.docchula.com`)"
- "traefik.http.routers.admin-https.entrypoints=websecure"
- "traefik.http.routers.admin-https.tls.certresolver=leresolver"
- "traefik.http.services.admin-https.loadbalancer.server.port=8080"
deploy:
resources:
limits:
cpus: '2'
memory: 1G
healthcheck:
test: [ "CMD", "curl", "-f", "http://localhost:8080/up" ]
interval: 30s
timeout: 10s
retries: 3
start_period: 30s
schedule-runner:
image: smcu-admin-app
command: [ "php", "/var/www/html/artisan", "schedule:work" ]
depends_on:
- laravel
volumes:
- /storage/smcu-admin-storage:/var/www/html/storage/app:rw,z
- /storage/smcu-admin-storage/public:/var/www/html/public/storage:rw,z
restart: on-failure:2
environment:
- APP_ENV=production
- REDIS_HOST=redis
- REDIS_PASSWORD=null
- REDIS_PORT=6379
- CACHE_DRIVER=redis
- LOG_CHANNEL=stderr
env_file:
- stack.env
healthcheck:
test: [ "CMD", "healthcheck-schedule" ]
deploy:
resources:
limits:
cpus: '2'
memory: 500M
queue-runner:
image: smcu-admin-app
command: [ "php", "/var/www/html/artisan", "queue:work", "-v" ]
restart: on-failure:2
environment:
- APP_ENV=production
- REDIS_HOST=redis
- REDIS_PASSWORD=null
- REDIS_PORT=6379
- CACHE_DRIVER=redis
- LOG_CHANNEL=stderr
env_file:
- stack.env
healthcheck:
test: [ "CMD", "healthcheck-queue" ]
deploy:
resources:
limits:
cpus: '2'
memory: 500M
redis:
image: redis:7-alpine
restart: unless-stopped
volumes:
- redis-cache:/data
environment:
- REDIS_PASSWORD=null
- REDIS_PORT=6379
- REDIS_DATABASES=16
healthcheck:
test: [ "CMD-SHELL", "redis-cli ping | grep PONG" ]
interval: 1s
timeout: 3s
retries: 5
deploy:
resources:
limits:
cpus: '1'
memory: 500M
volumes:
redis-cache:
driver: local