-
Notifications
You must be signed in to change notification settings - Fork 170
Expand file tree
/
Copy pathcompose.deploy.yml
More file actions
196 lines (179 loc) · 6.36 KB
/
compose.deploy.yml
File metadata and controls
196 lines (179 loc) · 6.36 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
# Production Reference Compose stack for phpVMS.
#
# The `app` service runs the FrankenPHP image with Laravel Octane worker
# mode enabled via a `command:` override (the upstream-documented way to
# launch Octane with serversideup/php:8.5-frankenphp). Octane keeps the
# framework booted across requests, which materially helps Filament /
# Livewire-heavy admin paths.
#
# To fall back to classic FrankenPHP + PHP-worker mode (matches the prior
# PHP-FPM request semantics — slower but bulletproof if an Octane bug hits):
# delete the `command:` line below and recreate the `app` container. No
# rebuild is required.
#
# Depending on your host, you might have to enter the contents of `.env`
# into their environment variable configuration; for example, that's the
# case for Railway or Dokploy. Dokploy creates a `.env` from the environment
# variables that you set in the interface, so the reading of `.env` is required
# regardless
#
# This compose file also includes a MariaDB and Redis containers, but they are
# commented out.
#
# You can run this within this stack, if you really want to. You *must* back up the
# Docker volumes listed at the bottom, but I highly recommend against it.
# Production deployments should use dedicated services for these components.
#
# For local development, see `compose.sail.yml` (Laravel Sail).
#
services:
app:
# If you want to use the remote image from Docker Hub, comment out this line
# or set it to "always" to pull the latest version
pull_policy: build
# Build from the local repository
image: ${PHPVMS_IMAGE_NAME:-phpvms/phpvms:latest}
# Build from the local repository
build:
context: .
dockerfile: Dockerfile.prod
args:
WWWUSER: "${WWWUSER:-1000}"
WWWGROUP: "${WWWGROUP:-1000}"
restart: unless-stopped
environment:
AUTORUN_ENABLED: "${AUTORUN_ENABLED:-true}"
AUTORUN_DEBUG: "${AUTORUN_DEBUG:-false}"
DISABLE_DEFAULT_CONFIG: "${DISABLE_DEFAULT_CONFIG:-false}"
# Octane configurations
OCTANE_HTTPS: "true"
# OPcache tuned for Octane: code is loaded once and stays in memory, so
# disable timestamp revalidation (deploys replace the container) and
# raise the file cap to cover Filament + module trees.
PHP_OPCACHE_ENABLE: "1"
PHP_OPCACHE_VALIDATE_TIMESTAMPS: "0"
PHP_OPCACHE_MAX_ACCELERATED_FILES: "20000"
PHP_OPCACHE_INTERNED_STRINGS_BUFFER: "16"
PHP_OPCACHE_JIT: "tracing"
PHP_OPCACHE_JIT_BUFFER_SIZE: "64M"
# For Caddy, no need to change
XDG_DATA_HOME: "/var/www/html/storage"
XDG_CONFIG_HOME: "/var/www/html/storage"
# Uncomment these lines if you're using MariaDB or Redis in this compose
DB_URL: "${DB_URL}"
REDIS_URL: "${REDIS_URL}"
# Delete this line to revert to classic FrankenPHP + PHP-worker mode.
command:
[
"php",
"/var/www/html/artisan",
"octane:start",
"--server=frankenphp",
"--host=0.0.0.0",
"--workers=auto",
"--max-requests=500",
]
ports:
# The image binds to 8000/8443 internally (unprivileged); host ports
# 8000/8443 are mapped at the Compose layer.
- "${FORWARD_HTTP_PORT:-8080}:8080"
- "${FORWARD_HTTPS_PORT:-8443}:8443"
# UIDs and GIDs of the serversideup images
user: "${WWWUSER:-1000}:${WWWGROUP:-1000}"
env_file:
- .env
volumes:
- phpvms_modules:/var/www/html/modules:ro
- phpvms_uploads:/var/www/html/public/uploads:rw
- phpvms_storage:/var/www/html/storage:rw
# depends_on:
# - mariadb
# - redis
healthcheck:
# Native health check script for Octane shipped by serversideup/php.
test: ["CMD", "healthcheck-octane"]
start_period: 30s
interval: 30s
timeout: 5s
retries: 3
task:
image: ${PHPVMS_IMAGE_NAME:-phpvms/phpvms:latest}
user: "${WWWUSER:-1000}:${WWWGROUP:-1000}"
restart: unless-stopped
command: ["php", "/var/www/html/artisan", "schedule:work"]
environment:
AUTORUN_ENABLED: "false"
PHP_OPCACHE_ENABLE: "1"
healthcheck:
# This is our native health check script for the scheduler
test: ["CMD", "healthcheck-schedule"]
start_period: 10s
env_file: .env
volumes:
- phpvms_modules:/var/www/html/modules:ro
- phpvms_uploads:/var/www/html/public/uploads:rw
- phpvms_storage:/var/www/html/storage:rw
queue:
image: ${PHPVMS_IMAGE_NAME:-phpvms/phpvms:latest}
user: "${WWWUSER:-1000}:${WWWGROUP:-1000}"
restart: unless-stopped
command: ["php", "/var/www/html/artisan", "queue:work", "--tries=3"]
environment:
AUTORUN_ENABLED: "false"
PHP_OPCACHE_ENABLE: "1"
healthcheck:
# This is our native health check script for the queue
test: ["CMD", "healthcheck-queue"]
start_period: 10s
env_file: .env
volumes:
- phpvms_modules:/var/www/html/modules:ro
- phpvms_uploads:/var/www/html/public/uploads:rw
- phpvms_storage:/var/www/html/storage:rw
# ----------------------------------------------------------
# BELOW HERE ARE THE CONTAINERS FOR THE DATABASE AND REDIS
#
# If you are planning to run this in production, I **highly**
# recommend using a managed database service like AWS RDS or
# Google Cloud SQL. These services offer high availability,
# automatic backups, and other features that are not available
# with self-hosted solutions.
#
# ----------------------------------------------------------
# You can also use PostgreSQL
# mariadb:
# hostname: mysql
# image: mariadb:11.8 # lts
# restart: unless-stopped
# expose:
# - 3306
# environment:
# MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
# MYSQL_DATABASE: "${DB_DATABASE}"
# MYSQL_USER: "${DB_USERNAME}"
# MYSQL_PASSWORD: "${DB_PASSWORD}"
# MYSQL_ALLOW_EMPTY_PASSWORD: "no"
# volumes:
# - database:/var/lib/mysql
# healthcheck:
# test: ["CMD", "healthcheck.sh", "--connect", "--innodb_initialized"]
# start_period: 10s
# interval: 10s
# timeout: 5s
# retries: 3
# redis:
# image: redis:8.8-alpine3.23
# restart: unless-stopped
# volumes:
# - redis:/data
# healthcheck:
# test: ["CMD", "redis-cli", "ping"]
# retries: 3
# timeout: 5s
volumes:
phpvms_modules:
phpvms_storage:
phpvms_uploads:
# Un-comment these lines to use the above containers
# database:
# redis: