Skip to content

Commit e062949

Browse files
committed
finish productionizing
1 parent ef21aaa commit e062949

File tree

3 files changed

+55
-9
lines changed

3 files changed

+55
-9
lines changed

Caddyfile

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
admin off
3+
4+
frankenphp {
5+
worker "{$APP_PUBLIC_PATH}/frankenphp-worker.php" {$CADDY_SERVER_WORKER_COUNT}
6+
}
7+
}
8+
9+
davidharting.com {
10+
log {
11+
level {$CADDY_SERVER_LOG_LEVEL}
12+
13+
# Redact the authorization query parameter that can be set by Mercure...
14+
format filter {
15+
wrap {$CADDY_SERVER_LOGGER}
16+
fields {
17+
uri query {
18+
replace authorization REDACTED
19+
}
20+
}
21+
}
22+
}
23+
24+
route {
25+
root * "{$APP_PUBLIC_PATH}"
26+
encode zstd br gzip
27+
28+
# Mercure configuration is injected here...
29+
{$CADDY_SERVER_EXTRA_DIRECTIVES}
30+
31+
php_server {
32+
index frankenphp-worker.php
33+
# Required for the public/storage/ directory...
34+
resolve_root_symlink
35+
}
36+
}
37+
}
38+

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:22 as frontend_builder
1+
FROM node:22 AS frontend_builder
22

33
COPY . /app
44
WORKDIR /app
@@ -38,4 +38,4 @@ RUN composer install --optimize-autoloader \
3838

3939

4040
ENTRYPOINT ["bash", "/entrypoint.sh"]
41-
CMD ["php", "artisan", "octane:frankenphp", "--host", "localhost", "--https", "--http-redirect"]
41+
CMD ["php", "artisan", "octane:frankenphp", "--caddyfile", "Caddyfile", "--https", "--http-redirect"]

docker-compose.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
volumes:
22
db_data:
3+
caddy_data:
34

45
secrets:
56
DB_PASSWORD:
@@ -31,15 +32,15 @@ x-laravel-config: &laravel-config
3132
LOG_DEPRECATIONS_CHANNEL: null
3233
LOG_LEVEL: debug
3334
MAIL_FROM_ADDRESS: "hello@davidharting.com"
34-
MAIL_FROM_NAME: "${APP_NAME}"
35+
MAIL_FROM_NAME: davidharting.com
3536
MAIL_LOG_CHANNEL: stderr
3637
MAIL_MAILER: log # TODO: Re-send mailer for prod
3738
OCTANE_HTTPS: true
3839
OCTANE_SERVER: frankenphp
3940
QUEUE_CONNECTION: database
4041
SESSION_DRIVER: file # TODO: database driver
4142
SESSION_LIFETIME: 120
42-
VITE_APP_NAME: "${APP_NAME}"
43+
VITE_APP_NAME: davidharting.com
4344

4445
depends_on:
4546
database:
@@ -64,6 +65,8 @@ services:
6465
interval: 1s
6566
timeout: 5s
6667
retries: 15
68+
volumes:
69+
- db_data:/var/lib/postgresql/data
6770

6871
migrations:
6972
<<: *laravel-config
@@ -73,23 +76,28 @@ services:
7376
web:
7477
<<: *laravel-config
7578
ports:
76-
- 8000:8000
77-
- 443:443
78-
- 443:443/udp
79+
- "80:80"
80+
- "443:443"
81+
- "443:443/udp"
7982
command:
8083
[
8184
"php",
8285
"artisan",
8386
"octane:frankenphp",
84-
"--host",
85-
"localhost",
87+
"--caddyfile",
88+
"Caddyfile",
8689
"--https",
8790
"--http-redirect",
91+
"--host",
92+
"davidharting.com"
8893
]
8994
depends_on:
9095
migrations:
9196
condition: service_completed_successfully
9297

98+
volumes:
99+
- caddy_data:/data
100+
93101
# cron:
94102
# <<: *laravel-config
95103
# command: ["php", "artisan", "schedule:work"]

0 commit comments

Comments
 (0)