1.9 KiB
1.9 KiB
Deployment Guide — Staging
Quick start (on the staging server)
- SSH to the staging server and clone the repo (or copy the project folder).
- Go into the
deployment/directory. - Copy the staging environment file:
cp .env.staging .env # edit .env to fill in any API keys you need - Run the deploy script:
./deploy.sh - The app is available on:
- Nginx (HTTP): http://localhost
- Next.js (direct): http://localhost:3000
What the script does
- Builds the Docker image from the project root using the
Dockerfile. - Starts two containers:
andris-app— the Next.js app (port 3000, exposed only on localhost).andris-nginx— reverse proxy on ports 80 / 443.
- SQLite database is stored in a Docker volume (
app-db) so data survives restarts. - On first boot the entrypoint auto-initialises the database (
prisma db push) and seeds the admin user.
Updating the app
cd deployment
./deploy.sh
This rebuilds the image with your latest source code and recreates the containers.
Files overview
| File | Purpose |
|---|---|
Dockerfile |
Multi-stage build (Next.js standalone) |
docker-compose.yml |
Production services: app + nginx |
docker-compose.override.yml |
Optional override for local dev |
nginx/nginx.conf |
Nginx main config |
nginx/default.conf |
Nginx site / reverse proxy config |
.env.staging |
Staging environment template |
deploy.sh |
One-command build & deploy script |
entrypoint.sh |
Container entrypoint (DB init + app start) |
Health check
A GET /api/health endpoint returns {"status":"ok"}.
The Docker healthcheck uses it every 30 s.
Notes
- The
.dockerignoreat the project root prevents the dev database,node_modules, and.envfrom being baked into the image. - For a real domain, update
server_nameinnginx/default.confand mount your TLS certificates.