Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/previews-serve-their-frontend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
---

Corrects the preview stack before pull request previews reach a release; no deployed behaviour
changes.
8 changes: 7 additions & 1 deletion docker/preview/compose.app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ services:
cpus: "1.0"
memory: 2G
pids: 512

webapp:
image: ghcr.io/ls1intum/hephaestus/webapp:${SOURCE_COMMIT:?Coolify supplies the deployed commit}
# `expose` is how Coolify learns which port to route ${SERVICE_FQDN_WEBAPP} to; the image's own
Expand All @@ -351,6 +350,13 @@ services:
- no-new-privileges:true
cap_drop:
- ALL
# nginx's master chowns its cache directories and then runs its workers as the nginx user. With
# CHOWN alone the master survives and every worker exits "fatal code 2 and cannot be respawned",
# which leaves a container that looks up and serves nothing.
cap_add:
- CHOWN
- SETGID
- SETUID
healthcheck:
test: ["CMD", "curl", "-f", "http://127.0.0.1:80/"]
interval: 10s
Expand Down
6 changes: 4 additions & 2 deletions scripts/check-preview-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,13 @@ const RENDER_ENV: Record<string, string> = {
/** Values the server refuses to start without: it validates them before the context is built, so an
* empty one here is a preview that restart-loops rather than a preview that misbehaves quietly. */
/**
* Capabilities a service may add back after `cap_drop: ALL`. PostgreSQL's entrypoint chowns its data
* directory and drops to its own user, which needs these five; every other service runs with none.
* Capabilities a service may add back after `cap_drop: ALL`. Both entries are servers whose root
* process prepares a directory and then runs its real work as another user; each set is the minimum
* found by running the image with less. The application server needs none.
*/
const ALLOWED_CAPABILITIES: Record<string, readonly string[]> = {
postgres: ["CHOWN", "DAC_OVERRIDE", "FOWNER", "SETGID", "SETUID"],
webapp: ["CHOWN", "SETGID", "SETUID"],
};

const REQUIRED_NON_EMPTY = ["HEPHAESTUS_TRUSTED_PROXIES", "WEBHOOK_SECRET"];
Expand Down
Loading