Skip to content

Repository files navigation

Mesa Docker Deployment Guide

This project can run fully in Docker with three services:

  • app (SvelteKit + Bun)
  • postgres (postgres:18-alpine)
  • redis (redis:latest)

1. Server Requirements

  • Linux server (Ubuntu/Debian recommended)
  • Docker Engine + Docker Compose plugin (docker compose)
  • Open ports:
    • 5173 for the app
    • 5432 only if you need external DB access
    • 6379 only if you need external Redis access

2. Upload Project To Server

Choose one method.

Option A: Git clone on server

git clone <YOUR_REPO_URL> mesa
cd mesa

Option B: Upload local folder

rsync -avz --exclude node_modules --exclude .svelte-kit --exclude dist ./ user@your-server:/opt/mesa
ssh user@your-server
cd /opt/mesa

3. Configure Environment

Create .env from example and update values.

cp .env.example .env

Minimum values:

POSTGRES_DB="mesa"
POSTGRES_USER="postgres"
POSTGRES_PASSWORD="change-this-password"
DATABASE_URL="postgres://postgres:change-this-password@localhost:5432/mesa"
REDIS_URL="redis://localhost:6379"

Notes:

  • In docker-compose.yml, the app internally uses postgres and redis service names.
  • POSTGRES_* values in .env are used by both database container and app container wiring.

4. Build And Start Services

docker compose up -d --build

Check status:

docker compose ps

View logs:

docker compose logs -f app
docker compose logs -f postgres
docker compose logs -f redis

5. Initialize Database

Run once on first deployment:

docker compose exec app bun run db:push

Optional seed:

docker compose exec app bun run db:seed

If seed fails with duplicate user errors, data may already be seeded.

6. Access The App

Open:

http://<SERVER_IP>:5173

7. Update Deployment

When you push new code:

cd /opt/mesa
git pull
docker compose up -d --build
docker compose exec app bun run db:push

8. Useful Operations

Restart all services:

docker compose restart

Stop all services:

docker compose down

Stop and remove volumes (DANGER: deletes DB data):

docker compose down -v

Open PostgreSQL shell:

docker compose exec postgres psql -U "$POSTGRES_USER" -d "$POSTGRES_DB"

9. Production Hardening Checklist

  • Use a strong POSTGRES_PASSWORD.
  • Put the app behind a reverse proxy (Nginx/Caddy) with HTTPS.
  • Restrict 5432 and 6379 in firewall rules if not needed externally.
  • Set up backups for postgres_data volume.
  • Use image tag pinning for predictable deployments.

10. Current Compose Profile Note

The current app service is dev-friendly because it uses a bind mount and runs bun run dev. For production, this works but is not optimal. If you want, we can add a production compose profile (docker-compose.prod.yml) with:

  • no source bind mount
  • prebuilt app image
  • bun run build + bun run preview (or adapter-specific runtime)
  • tighter resource and security settings

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages