Install with Docker Compose
Run SlugBase from docker-compose.example.yml: ports, env file, SQLite volume, and optional PostgreSQL.
What you need
- Docker and Docker Compose v2.
- A copy of the SlugBase repository or at least its
Dockerfileanddocker-compose.example.yml. - An
.envfile with production secrets and URLs — see Configuration.
The repository ships docker-compose.example.yml as the template. Copy it to docker-compose.yml and adjust values for your environment (the project README describes this pattern).
Steps
Copy the Compose template
cp docker-compose.example.yml docker-compose.yml
Create .env and data directory
Add at least JWT_SECRET, ENCRYPTION_KEY, and SESSION_SECRET (production length requirements apply). Set BASE_URL and FRONTEND_URL to your public site URL when deploying behind a domain.
mkdir -p ./data
The example compose file mounts ./data to /app/data so the SQLite file survives container restarts.
Start the stack
docker compose up -d
The example service:
- Builds from the root
Dockerfilewhen you usebuild: .(or pullsslugbase/slugbase:latestif you pointimagethere instead). - Publishes
${PORT:-5000}:5000. - Loads
env_file: .env. - Sets
DB_PATH=/app/data/slugbase.dbinside the container. - Defines a healthcheck against
/api/healthlike the Dockerfile.
Open the app
Visit http://localhost:5000 (or your host and mapped port). Complete First run setup when the database is new.
Optional PostgreSQL
The same example file contains a commented slugbase-postgres service and notes for switching the app service to DB_TYPE=postgresql with a dependency on Postgres health. Uncomment and wire credentials to match your .env when you outgrow SQLite or need a remote database.
# slugbase-postgres:
# image: postgres:16-alpine
# environment:
# - POSTGRES_DB=${DB_NAME:-slugbase}
# - POSTGRES_USER=${DB_USER:-slugbase}
# - POSTGRES_PASSWORD=${DB_PASSWORD:-change-this-password}
# volumes:
# - postgres-data:/var/lib/postgresql/data
# In .env when using Postgres (conceptual; adjust to your compose network)
DB_TYPE=postgresql
DATABASE_URL=postgresql://user:pass@slugbase-postgres:5432/slugbase
Verify
| Check | Expected |
|---|---|
docker compose ps | Service healthy after start period. |
| Browser | Initial Setup or login at your base URL. |
| Logs | No repeated crash loops; address validation errors if secrets are missing. |
Troubleshooting
Related
Last updated 3 days ago
Built with Documentation.AI