fix: revert to Coolify native SERVICE_FQDN_* variables for domain management

COOLIFY_URL/COOLIFY_FQDN were custom variables requiring manual setup,
causing VITE_BACKEND_WS_URL to resolve to wss://backend/graphql (broken).
SERVICE_FQDN_HOPPSCOTCH_80 triggers Coolify auto-generation of an editable
domain, and SERVICE_URL_HOPPSCOTCH provides the scheme-less form needed for
the wss:// WebSocket URL.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
thibaud-leclere 2026-05-11 14:48:08 +00:00
parent c438d6c9ab
commit 8e8b715962
3 changed files with 22 additions and 19 deletions

View file

@ -48,8 +48,10 @@ API_CLIENT_TAG=latest
#-----------------------Coolify Prod Local Defaults----------------#
# Used only when running docker-compose.prod.yml locally.
# Coolify generates these SERVICE_* values itself in production.
COOLIFY_URL=http://localhost:3000
COOLIFY_FQDN=localhost:3000
# In production, Coolify auto-generates SERVICE_FQDN_* and SERVICE_URL_* from the
# domain configured in the Coolify UI (editable per deployment).
SERVICE_FQDN_HOPPSCOTCH_80=http://localhost:3000
SERVICE_FQDN_HOPPSCOTCH=http://localhost:3000
SERVICE_URL_HOPPSCOTCH=localhost:3000
SERVICE_PASSWORD_POSTGRES=testpass
SERVICE_BASE64_HOPPSCOTCH=0123456789abcdef0123456789abcdef

View file

@ -118,17 +118,17 @@ Le compose prod utilise l'image AIO et un seul domaine Coolify :
- `/admin` : admin
- `/backend` : backend GraphQL/API
Variables générées/préremplies pour Coolify :
Variables auto-générées par Coolify (éditables dans l'UI) :
- `COOLIFY_URL` : URL publique du service, issue du domaine renseigné dans Coolify
- `COOLIFY_FQDN` : domaine public sans schéma, issu du domaine renseigné dans Coolify
- `SERVICE_FQDN_HOPPSCOTCH_80` : déclenche la génération du domaine public et la configuration du proxy
- `SERVICE_FQDN_HOPPSCOTCH` : URL publique avec schéma (`https://api-xxx.host.fr`)
- `SERVICE_URL_HOPPSCOTCH` : domaine sans schéma, utilisé pour l'URL WebSocket (`wss://`)
- `SERVICE_PASSWORD_POSTGRES` : mot de passe PostgreSQL généré
- `SERVICE_BASE64_HOPPSCOTCH` : clé stable générée de 32 caractères pour `DATA_ENCRYPTION_KEY`
- `SERVICE_BASE64_HOPPSCOTCH` : clé stable de 32 caractères pour `DATA_ENCRYPTION_KEY`
Ne pas modifier les variables `SERVICE_FQDN_*` / `SERVICE_URL_*` dans Coolify :
elles sont générées et peuvent être écrasées. Renseigner uniquement le domaine
du service `hoppscotch` dans Coolify. Les URLs app/admin/backend sont ensuite
dérivées par sous-chemins via `COOLIFY_URL` et `COOLIFY_FQDN`.
Coolify génère un domaine aléatoire au premier déploiement. Il est ensuite
modifiable dans l'UI Coolify sur le service `hoppscotch`. Les URLs
app/admin/backend sont dérivées par sous-chemins automatiquement.
Démarrer avec le tag `latest` :

View file

@ -22,21 +22,22 @@ services:
restart: unless-stopped
image: ${API_CLIENT_REGISTRY:-forge.lclr.dev}/${API_CLIENT_NAMESPACE:-thibaud-lclr}/${API_CLIENT_IMAGE_PREFIX:-api-client}-aio:${API_CLIENT_TAG:-latest}
environment:
- SERVICE_FQDN_HOPPSCOTCH_80
- SERVICE_BASE64_HOPPSCOTCH
- DATABASE_URL=postgresql://postgres:${SERVICE_PASSWORD_POSTGRES}@hoppscotch-db:5432/${POSTGRES_DB:-hoppscotch}
- DATA_ENCRYPTION_KEY=${SERVICE_BASE64_HOPPSCOTCH}
- REDIRECT_URL=${COOLIFY_URL}
- VITE_BASE_URL=${COOLIFY_URL}
- VITE_SHORTCODE_BASE_URL=${COOLIFY_URL}
- VITE_ADMIN_URL=${COOLIFY_URL}/admin
- VITE_BACKEND_GQL_URL=${COOLIFY_URL}/backend/graphql
- VITE_BACKEND_WS_URL=wss://${COOLIFY_FQDN}/backend/graphql
- VITE_BACKEND_API_URL=${COOLIFY_URL}/backend/v1
- REDIRECT_URL=${SERVICE_FQDN_HOPPSCOTCH}
- VITE_BASE_URL=${SERVICE_FQDN_HOPPSCOTCH}
- VITE_SHORTCODE_BASE_URL=${SERVICE_FQDN_HOPPSCOTCH}
- VITE_ADMIN_URL=${SERVICE_FQDN_HOPPSCOTCH}/admin
- VITE_BACKEND_GQL_URL=${SERVICE_FQDN_HOPPSCOTCH}/backend/graphql
- VITE_BACKEND_WS_URL=wss://${SERVICE_URL_HOPPSCOTCH}/backend/graphql
- VITE_BACKEND_API_URL=${SERVICE_FQDN_HOPPSCOTCH}/backend/v1
- VITE_APP_TOS_LINK=${VITE_APP_TOS_LINK:-https://docs.hoppscotch.io/support/terms}
- VITE_APP_PRIVACY_POLICY_LINK=${VITE_APP_PRIVACY_POLICY_LINK:-https://docs.hoppscotch.io/support/privacy}
- VITE_PROXYSCOTCH_ACCESS_TOKEN=${VITE_PROXYSCOTCH_ACCESS_TOKEN:-}
- ENABLE_SUBPATH_BASED_ACCESS=true
- WHITELISTED_ORIGINS=${COOLIFY_URL}/backend,${COOLIFY_URL},${COOLIFY_URL}/admin
- WHITELISTED_ORIGINS=${SERVICE_FQDN_HOPPSCOTCH}/backend,${SERVICE_FQDN_HOPPSCOTCH},${SERVICE_FQDN_HOPPSCOTCH}/admin
- TRUST_PROXY=${TRUST_PROXY:-true}
depends_on:
hoppscotch-db: