Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

fix: selfhosting compose file

Sidwebworks381ae119b5c3
diff --git a/contrib/deploying/simple-docker-caddy/deploy.sh b/contrib/deploying/simple-docker-caddy/deploy.sh
index ed807fcab9..2774234823 100755
--- a/contrib/deploying/simple-docker-caddy/deploy.sh
+++ b/contrib/deploying/simple-docker-caddy/deploy.sh
@@ -67,19 +67,31 @@ cmd_init() {
chmod +x "$HERE/bin/secrets-entrypoint.sh" "$HERE/postgres/"*.sh
log "Creating Docker secrets (skipping any that already exist)"
- local s
+ local s pgpw=""
for s in $GENERATED_SECRETS; do
if secret_exists "$s" && [ "$force" -ne 1 ]; then log "secret '$s' exists — skip"; continue; fi
secret_exists "$s" && docker secret rm "$s" >/dev/null
case "$s" in
- postgres_password) create_secret "$s" "$(openssl rand -hex 24)" ;;
+ postgres_password) pgpw="$(openssl rand -hex 24)"; create_secret "$s" "$pgpw" ;;
session_secret) create_secret "$s" "$(openssl rand -hex 32)" ;;
# Inngest self-host rejects the signkey- prefix — plain hex only.
inngest_signing_key) create_secret "$s" "$(openssl rand -hex 32)" ;;
inngest_event_key) create_secret "$s" "$(openssl rand -hex 16)" ;;
esac
done
-
+
+ # PostgREST's image has no shell, so it can't use the secrets-entrypoint shim.
+ # It reads any value from a file when prefixed with @, so it gets the full
+ # connection URI (password and all) as its own secret, minted from pgpw above.
+ if secret_exists postgrest_db_uri && [ "$force" -ne 1 ]; then
+ log "secret 'postgrest_db_uri' exists — skip"
+ elif [ -n "$pgpw" ]; then
+ secret_exists postgrest_db_uri && docker secret rm postgrest_db_uri >/dev/null
+ create_secret postgrest_db_uri "postgres://authenticator:${pgpw}@postgres:5432/postgres"
+ else
+ warn "postgres_password already existed — can't regenerate 'postgrest_db_uri'. Use '$SCRIPT_NAME init --force' to rotate both."
+ fi
+
# Supabase key trio — must be minted together (anon/service signed by jwt_secret).
if secret_exists jwt_secret && [ "$force" -ne 1 ]; then
log "secret 'jwt_secret' exists — skipping Supabase trio"
diff --git a/contrib/deploying/simple-docker-caddy/docker-compose.prod.yml b/contrib/deploying/simple-docker-caddy/docker-compose.prod.yml
index 88820191c1..4987d59475 100644
--- a/contrib/deploying/simple-docker-caddy/docker-compose.prod.yml
+++ b/contrib/deploying/simple-docker-caddy/docker-compose.prod.yml
@@ -281,22 +281,21 @@ services:
postgrest:
image: postgrest/postgrest:v13.0.8
- entrypoint: ["/usr/local/bin/carbon-secrets-entrypoint.sh"]
- command: ["postgrest"]
+ # PostgREST's image is FROM scratch (no shell), so it can't run the
+ # secrets-entrypoint shim the other services use. Instead it reads each value
+ # straight from its secret file via PostgREST's native @file syntax.
networks: [internal]
secrets:
- - postgres_password
+ - postgrest_db_uri
- jwt_secret
environment:
- PGRST_DB_URI: postgres://authenticator:__POSTGRES_PASSWORD__@postgres:5432/postgres
+ PGRST_DB_URI: "@/run/secrets/postgrest_db_uri"
PGRST_DB_SCHEMAS: public,storage,graphql_public
PGRST_DB_ANON_ROLE: anon
- PGRST_JWT_SECRET: __JWT_SECRET__
+ PGRST_JWT_SECRET: "@/run/secrets/jwt_secret"
PGRST_DB_USE_LEGACY_GUCS: "false"
- PGRST_APP_SETTINGS_JWT_SECRET: __JWT_SECRET__
+ PGRST_APP_SETTINGS_JWT_SECRET: "@/run/secrets/jwt_secret"
PGRST_APP_SETTINGS_JWT_EXP: "3600"
- volumes:
- - *shim
deploy:
<<: *restart
replicas: 1
@@ -563,6 +562,8 @@ volumes:
secrets:
postgres_password:
external: true
+ postgrest_db_uri:
+ external: true
jwt_secret:
external: true
anon_key: