docs/installation/scalingo.md
This guide explains how to deploy Docs on Scalingo using a custom buildpack.
Scalingo is a Platform-as-a-Service (PaaS) that simplifies application deployment. This setup uses a custom buildpack to handle both the frontend (Next.js static export) and backend (Django) builds, serving them through Nginx. The collaboration server (y-provider) runs alongside the Django backend.
Create a new app on Scalingo using scalingo CLI or using the Scalingo dashboard.
Add the required PostgreSQL and Redis services.
This will set the following environment variables automatically:
SCALINGO_POSTGRESQL_URL - Database connection stringSCALINGO_REDIS_URL - Redis connection stringSet the following environment variables in your Scalingo app:
scalingo env-set BUILDPACK_URL="https://github.com/suitenumerique/buildpack#main"
scalingo env-set LASUITE_APP_NAME="docs"
scalingo env-set LASUITE_BACKEND_DIR="src/backend/"
scalingo env-set LASUITE_FRONTEND_DIR="src/frontend/"
scalingo env-set LASUITE_NGINX_DIR="."
scalingo env-set LASUITE_SCRIPT_POSTCOMPILE="bin/buildpack_postcompile.sh"
scalingo env-set LASUITE_SCRIPT_POSTFRONTEND="bin/buildpack_postfrontend.sh"
scalingo env-set DATABASE_URL="\$SCALINGO_POSTGRESQL_URL"
scalingo env-set REDIS_URL="\$SCALINGO_REDIS_URL"
scalingo env-set DJANGO_SETTINGS_MODULE="impress.settings"
scalingo env-set DJANGO_CONFIGURATION="Production"
scalingo env-set DJANGO_SECRET_KEY="<generate-a-secure-secret-key>"
scalingo env-set DJANGO_ALLOWED_HOSTS="my-docs-app.osc-fr1.scalingo.io"
Configure your OIDC provider (e.g., Keycloak, Authentik):
scalingo env-set OIDC_RP_CLIENT_ID="docs-client-id"
scalingo env-set OIDC_RP_CLIENT_SECRET="<your-client-secret>"
scalingo env-set OIDC_RP_SIGN_ALGO="RS256"
scalingo env-set OIDC_OP_BASE_URL="https://auth.yourdomain.com/realms/docs"
Or configure individual endpoints if your provider doesn't support discovery:
scalingo env-set OIDC_OP_AUTHORIZATION_ENDPOINT="https://auth.yourdomain.com/authorize"
scalingo env-set OIDC_OP_TOKEN_ENDPOINT="https://auth.yourdomain.com/token"
scalingo env-set OIDC_OP_USER_ENDPOINT="https://auth.yourdomain.com/userinfo"
scalingo env-set OIDC_OP_JWKS_ENDPOINT="https://auth.yourdomain.com/.well-known/jwks.json"
scalingo env-set OIDC_OP_LOGOUT_ENDPOINT="https://auth.yourdomain.com/logout"
To store uploaded media files in an S3-compatible object storage:
scalingo env-set AWS_S3_ENDPOINT_URL="https://s3.amazonaws.com"
scalingo env-set AWS_S3_ACCESS_KEY_ID="<your-access-key>"
scalingo env-set AWS_S3_SECRET_ACCESS_KEY="<your-secret-key>"
scalingo env-set AWS_STORAGE_BUCKET_NAME="docs-media"
scalingo env-set AWS_S3_REGION_NAME="eu-west-1"
For email notifications see https://doc.scalingo.com/platform/app/sending-emails:
scalingo env-set DJANGO_EMAIL_HOST="smtp.example.org"
scalingo env-set DJANGO_EMAIL_PORT="587"
scalingo env-set DJANGO_EMAIL_HOST_USER="<smtp-user>"
scalingo env-set DJANGO_EMAIL_HOST_PASSWORD="<smtp-password>"
scalingo env-set DJANGO_EMAIL_USE_TLS="True"
scalingo env-set DJANGO_EMAIL_FROM="[email protected]"
Deploy your application:
git push scalingo main
The buildpack will automatically:
After the first deployment, create an admin user:
scalingo run python manage.py createsuperuser
To use a custom domain:
DJANGO_ALLOWED_HOSTS with your custom domainscalingo domains-add docs.yourdomain.com
scalingo env-set DJANGO_ALLOWED_HOSTS="docs.yourdomain.com,my-docs-app.osc-fr1.scalingo.io"
Docs supports theme customization via environment variables. The theme controls the appearance of the header, footer, waffle (La Suite services widget), favicon, and more.
To replace the default Docs logo with your own, set the THEME_CUSTOMIZATION_LOGO_URL environment variable with an HTTPS URL pointing to an SVG file (max 5MB):
scalingo env-set THEME_CUSTOMIZATION_LOGO_URL="https://cdn.yourdomain.com/logo.svg"
The logo is validated during build:
To customize the theme (footer links, waffle, translations, etc.), set the THEME_CUSTOMIZATION_JSON environment variable with a JSON object. The buildpack merges your custom JSON with the default theme, so you only need to specify the parts you want to override.
Important: The
THEME_CUSTOMIZATION_JSONvalue must be valid JSON. Ensure it is properly escaped when setting as an environment variable.
scalingo env-set THEME_CUSTOMIZATION_JSON='{"footer":{"default":{"externalLinks":[{"label":"GitHub","href":"https://github.com/your-org/"},{"label":"Your Org","href":"https://yourdomain.com"}],"legalLinks":[{"label":"Legal Notice","href":"https://docs.yourdomain.com/legal/"},{"label":"Privacy Policy","href":"https://docs.yourdomain.com/privacy/"}],"bottomInformation":{"label":"Unless otherwise stated, all content on this site is under","link":{"label":"licence etalab-2.0","href":"https://github.com/etalab/licence-ouverte/blob/master/LO.md"}}},"en":{"bottomInformation":{"label":"Unless otherwise stated, all content on this site is under","link":{"label":"licence MIT","href":"https://github.com/your-org/license"}}},"fr":{"bottomInformation":{"label":"Sauf mention contraire, tout le contenu de ce site est sous","link":{"label":"licence etalab-2.0","href":"https://github.com/etalab/licence-ouverte/blob/master/LO.md"}}}},"waffle":{"apiUrl":"https://your-api.example.com/api/v1.0/lagaufre/services/","widgetPath":"https://static.example.com/widgets/"},"header":{"logo":{},"icon":{"src":"/assets/icon-docs.svg","style":{"width":"32px","height":"auto"},"alt":"Your Org Logo","withTitle":true}},"home":{"with-proconnect":false,"icon-banner":{"src":"/assets/icon-docs.svg","style":{"width":"64px","height":"auto"},"alt":"Your Org Logo"}},"favicon":{"light":{"href":"/assets/favicon-light.png","type":"image/png"},"dark":{"href":"/assets/favicon-dark.png","type":"image/png"}}}'
For detailed information on all available theme sections, waffle configuration modes, and customization options, see the Customization Guide.
The theme is cached in Redis for 24 hours by default. If you update THEME_CUSTOMIZATION_JSON and don't see changes, clear the Redis cache:
scalingo run python -c "from django.core.cache import cache; cache.clear()"
Or set THEME_CUSTOMIZATION_CACHE_TIMEOUT to a shorter duration:
scalingo env-set THEME_CUSTOMIZATION_CACHE_TIMEOUT=60
Note: Changing
THEME_CUSTOMIZATION_CACHE_TIMEOUTdoes not clear existing cached values in Redis. After changing this setting, clear the cache manually:scalingo run python -c "from django.core.cache import cache; cache.clear()"
scalingo logs --tail
DATABASE_URL is correctly set to $SCALINGO_POSTGRESQL_URLscalingo run python -c "from django.core.cache import cache; cache.clear()"# Open a console
scalingo run bash
# Restart the app
scalingo restart
# Scale containers
scalingo scale web:2
# One-off command
scalingo run python manage.py shell
# Check environment variables
scalingo env
# View app status
scalingo status
On Scalingo, the application runs as follows:
bin/buildpack_postcompile.sh runs to clean up unused files and reduce slug sizebin/buildpack_postfrontend.sh moves the frontend build to build/frontend-out, downloads custom logos, injects the custom theme, and prepares the deployment structureThe bin/buildpack_start.sh script starts three processes:
Nginx routes:
/api/ and /admin/ → Django backend (port 8000)/collaboration/api/ and /collaboration/ws/ → y-provider (port 4444)/media/ → S3 object storage (with auth proxy)/ → Static frontend files