Custom Services
Guide: Custom Services
Section titled “Guide: Custom Services”Add up to 10 custom Docker services (CS_1 through CS_10) to your ɳSelf stack. Use this for app-specific services that aren’t covered by the plugin ecosystem.
How Custom Services Work
Section titled “How Custom Services Work”Custom services are defined via environment variables. ɳSelf reads CS_1_* through CS_10_* variables and generates the corresponding docker-compose service block automatically on nself build.
Adding a Custom Service
Section titled “Adding a Custom Service”Step 1: Define the service in .env
Section titled “Step 1: Define the service in .env”# CS_1: Node.js API serverCS_1_ENABLED=trueCS_1_NAME=my-apiCS_1_IMAGE=node:20-alpineCS_1_PORT=3100CS_1_COMMAND=node server.jsCS_1_WORKDIR=/app
# Pass environment variables to the serviceCS_1_ENV_NODE_ENV=productionCS_1_ENV_DATABASE_URL=${DATABASE_URL}Step 2: Rebuild and restart
Section titled “Step 2: Rebuild and restart”nself build # generates updated docker-compose.ymlnself restart # applies changesStep 3: Verify
Section titled “Step 3: Verify”nself status # should show my-api as runningnself urls # shows URL if routed through nginxAvailable Language Templates
Section titled “Available Language Templates”See 40+ starter templates to get going quickly:
nself service templatesTemplates include: Node.js, Python (FastAPI, Django), Go, Ruby on Rails, PHP, Java Spring Boot, Rust, and more.
Example: Python Worker (CS_2)
Section titled “Example: Python Worker (CS_2)”CS_2_ENABLED=trueCS_2_NAME=workerCS_2_IMAGE=python:3.12-slimCS_2_COMMAND=python -m celery workerCS_2_ENV_CELERY_BROKER_URL=redis://redis:6379/0Custom Service Variables Reference
Section titled “Custom Service Variables Reference”| Variable | Description |
|---|---|
CS_N_ENABLED | true / false |
CS_N_NAME | Service name (lowercase, alphanumeric + hyphens) |
CS_N_IMAGE | Docker image reference |
CS_N_PORT | Internal port the service listens on |
CS_N_COMMAND | Override container command |
CS_N_WORKDIR | Working directory inside container |
CS_N_ENV_* | Environment variables passed to the service |
See Also
Section titled “See Also”- Config-Custom-Services: full env var reference
- cmd-service: service command reference
- Architecture: how custom services fit the stack