Skip to content

Environment Variables

Docker Compose uses .env in the asp-compose/ directory. On first initialization, init.sh creates it from .env.example and generates random Django, PostgreSQL, Redis, and RustFS credentials.

Apply changes with:

bash
docker compose up -d
./scripts/doctor.sh

Protect .env

.env contains service passwords and secrets. Restrict access and never commit it.

Images

VariableDefaultDescription
ASP_BACKEND_IMAGECurrent backend imageUsed by backend, Worker, and migration services.
ASP_FRONTEND_IMAGECurrent frontend imageUsed by the HTTPS entrypoint and frontend.

The upgrade script updates both variables from the latest release package.

HTTPS entrypoint

VariableDefaultDescription
ASP_BIND0.0.0.0Host bind address.
ASP_HTTPS_PORT443Host HTTPS port.
ASP_PUBLIC_HOSTNAMElocalhostCN and SAN used only for the fallback self-signed certificate.
ASP_CERT_EXTRA_SANEmptyExtra SAN entries, such as DNS:asp.example.com,IP:10.0.0.10.
ASP_MAX_UPLOAD_SIZE20mMaximum request body accepted by Nginx.

Certificate hostname settings apply only when certs/asp.crt and certs/asp.key do not exist.

Web API

VariableDefaultDescription
ASP_WEB_WORKERS3Gunicorn worker processes.
ASP_WEB_THREADS4Threads per worker.
ASP_WEB_TIMEOUT210Request timeout in seconds; Nginx derives its proxy timeout from it.
ASP_WEB_KEEPALIVE5HTTP keep-alive duration in seconds.
ASP_WEB_MAX_REQUESTS1000Requests handled before recycling a worker.
ASP_WEB_MAX_REQUESTS_JITTER100Random offset for worker recycling.
ASP_DOCTOR_WAIT_SECONDS180Maximum seconds doctor.sh waits for services.

More workers and threads increase CPU, memory, and PostgreSQL connection usage.

Management UIs

VariableDefaultDescription
ASP_MANAGEMENT_BIND0.0.0.0Host bind address for both management UIs.
ASP_REDIS_UI_PORT8001Redis Stack UI host port.
ASP_RUSTFS_CONSOLE_PORT9001RustFS Console host port.

Restrict production access with a firewall or VPN. See Service Management UIs.

Django

VariableDefaultDescription
DJANGO_SECRET_KEYGeneratedDjango signing secret.
DJANGO_DEBUGfalseEnables Django Debug; keep disabled in production.
DJANGO_ALLOWED_HOSTS*Comma-separated accepted Host values.
DJANGO_LOG_LEVELINFOApplication root log level.
DJANGO_LOG_LEVEL_DJANGOINFODjango framework log level.
DJANGO_LOG_FORMATtexttext or json.

PostgreSQL

Connection

VariableDefaultDescription
POSTGRES_DBaspDatabase name.
POSTGRES_USERpostgresDatabase user.
POSTGRES_PASSWORDGeneratedDatabase password.
POSTGRES_HOSTpostgresDatabase host used by ASP.
POSTGRES_PORT5432Database port used by ASP.
POSTGRES_CONN_MAX_AGE60Django persistent connection lifetime in seconds.
POSTGRES_CONN_HEALTH_CHECKStrueChecks persistent connections before reuse.

Server tuning

VariableDefaultDescription
POSTGRES_MAX_CONNECTIONS150Maximum database connections.
POSTGRES_SHARED_BUFFERS512MBPostgreSQL shared buffers.
POSTGRES_EFFECTIVE_CACHE_SIZE2GBPlanner estimate of available cache; not a direct allocation.
POSTGRES_WORK_MEM8MBMemory available per sort or hash operation.
POSTGRES_MAINTENANCE_WORK_MEM256MBMemory for maintenance operations.
POSTGRES_CHECKPOINT_COMPLETION_TARGET0.9Fraction of the checkpoint interval used for writes.
POSTGRES_RANDOM_PAGE_COST1.1Planner random page read cost.
POSTGRES_LOG_MIN_DURATION_STATEMENT1000Slow-query logging threshold in milliseconds.

PostgreSQL memory settings are cumulative. Evaluate host memory, connection count, and workload before changing them.

Redis

VariableDefaultDescription
REDIS_HOSTredis-stackRedis host used by ASP.
REDIS_PORT6379Redis port used by ASP.
REDIS_DB1Redis logical database used by ASP.
REDIS_PASSWORDGeneratedRedis password.

RustFS

VariableDefaultDescription
RUSTFS_ENDPOINT_URLhttp://rustfs:9000S3-compatible API endpoint used by ASP.
RUSTFS_ACCESS_KEYaspS3-compatible Access Key.
RUSTFS_SECRET_KEYGeneratedS3-compatible Secret Key.
RUSTFS_BUCKETaspBucket used for attachments and objects.
RUSTFS_REGIONus-east-1Region used for S3 request signing.

Changing credentials

After initialization, do not change only the PostgreSQL, Redis, or RustFS password in .env. Existing server credentials do not update automatically.

For credential rotation, change the credential in the service first, then update .env and run docker compose up -d.

Next Steps