-
Notifications
You must be signed in to change notification settings - Fork 3
Deployment
Koishi edited this page Mar 19, 2026
·
2 revisions
Deploy MomShell with Docker for production environments.
# Arch Linux
sudo pacman -S docker docker-compose
# Ubuntu/Debian
sudo apt install docker.io docker-compose
sudo systemctl start docker
sudo systemctl enable docker# 1. Configure environment
cp .env.example .env
# Edit .env: uncomment the Docker DATABASE_URL line (postgres host)
# Set JWT_SECRET_KEY, OPENAI_API_KEY, etc.
# 2. Start all services
make docker-up
# 3. Access
# App: http://localhost
# Admin panel: http://localhost/adminA single Docker image contains both frontend and backend:
Browser → Nginx (:80)
├── / → static files (Vue SPA)
├── /api/ → proxy → Go backend (:8000)
├── /uploads/ → proxy → Go backend (:8000)
└── /admin → proxy → Go backend (:8000)
docker-compose.yml (in deploy/) runs two containers:
| Service | Image | Port |
|---|---|---|
| app | Nginx + Go binary (single image) | 80 (exposed) |
| postgres | PostgreSQL 16 | 5432 (internal) |
The root Dockerfile uses multi-stage builds:
-
frontend-builder — Node 24,
npm ci && npm run build→dist/ -
backend-builder — Go 1.25,
go build→ binary - final — Nginx Alpine + Go binary + entrypoint script
For single-container platforms like ModelScope Studios, the Dockerfile also supports embedded PostgreSQL:
docker build -t momshell .
docker run -d -p 7860:7860 --env-file .env momshellThe entrypoint script (deploy/entrypoint.sh) auto-initializes PostgreSQL (initdb, create user/db) when no external database is configured. Nginx listens on port 7860 in this mode.
make docker-build # Build Docker image
make docker-up # Start all services (app + postgres)
make docker-down # Stop all services
make docker-logs # View logsKey environment variables for deployment:
| Variable | Description |
|---|---|
DATABASE_URL |
postgres://momshell:momshell@postgres:5432/momshell?sslmode=disable |
POSTGRES_USER |
PostgreSQL container user (default: momshell) |
POSTGRES_PASSWORD |
PostgreSQL container password (default: momshell) |
POSTGRES_DB |
PostgreSQL container database (default: momshell) |
JWT_SECRET_KEY |
Secure random secret |
OPENAI_API_KEY |
LLM API key |
PORT |
Backend server port (default: 8000, internal) |
VITE_API_BASE_URL is not needed in Docker — Nginx proxies /api/ to the backend within the same container.
See Configuration for the full reference.
PostgreSQL data is stored in a Docker named volume pgdata. To reset:
make docker-down
docker volume rm deploy_pgdata
make docker-up