Overview
suSHi provides a complete Docker-based deployment solution using Docker Compose. The application runs in a multi-container setup with PostgreSQL as the database backend.Architecture
The Docker deployment consists of two main services:- postgres: PostgreSQL database using the Bitnami image
- sushi-backend: The main suSHi application server
Prerequisites
Before deploying suSHi with Docker, ensure you have:- Docker Engine 20.10 or later
- Docker Compose 3.8 or later
- At least 2GB of available RAM
- Ports 8080 and 5432 available on your host
Quick Start
Configure environment variables
Edit the
docker-compose.yaml file to set your environment variables, especially:JWT_SECRET: Change from the default value- OAuth credentials for Google and GitHub if using authentication
Start the services
- Pull the PostgreSQL image
- Pull the suSHi backend image (or build it if using a local Dockerfile)
- Start both containers
- Run database migrations automatically
Verify deployment
Check that all services are running:You should see both
postgres and sushi-backend containers running.Docker Compose Configuration
Thedocker-compose.yaml file defines the complete deployment:
Port Mappings
| Service | Container Port | Host Port | Description |
|---|---|---|---|
| postgres | 5432 | 5432 | PostgreSQL database |
| sushi-backend | 8080 | 8080 | suSHi API server |
Volume Mounts
./db/data:/bitnami/postgresql/data- Persists PostgreSQL data on the host machine
Building from Source
To build the suSHi backend image from source instead of using the pre-built image:Docker Image Structure
The production image includes:- Base: Debian with CA certificates
- Binary: Compiled Go application (
/sushi-backend/app) - Database migrations: SQL files in
/sushi-backend/db/migrations/ - Static files: Frontend assets in
/sushi-backend/static/ - Configuration: OAuth config in
/sushi-backend/config/ - Logs directory:
/sushi-backend/logs/for application logs
Container Management
View Logs
Restart Services
Stop and Remove
Production Considerations
Recommended Production Changes
-
Change default credentials:
-
Set production log level:
- Configure OAuth providers - Add your OAuth credentials for authentication
- Enable SSL/TLS - Use a reverse proxy like Nginx or Traefik
- Backup strategy - Implement regular backups of the PostgreSQL data volume
-
Resource limits - Add memory and CPU limits to containers:
Troubleshooting
Container won’t start
Check container logs:Database connection failed
Ensure theDB_HOST environment variable matches the PostgreSQL service name:
Migrations not running
Verify thatMIGRATE_DB=true is set in the sushi-backend environment variables.
Port already in use
Change the host port mapping in docker-compose.yaml:Next Steps
- Configure Environment Variables for your deployment
- Learn about Database Setup and migrations
- Set up OAuth authentication providers