Docker Deploy
Lygotype is designed for Docker-based production deployment. This guide covers deploying to a fresh Ubuntu 24.04 VPS.
Prerequisites
- Ubuntu 20.04 / 22.04 / 24.04 VPS — 1 core, 512 MB RAM minimum (1 GB+ recommended)
- Docker Engine 24+ and Docker Compose v2 installed (see below)
- A domain name with an A record pointing to your VPS IP
- Caddy for SSL and reverse proxy (see Caddy Setup)
Installing Docker
If Docker isn't on your server yet, the official convenience script is the fastest path:
``bash
Install Docker Engine + Compose plugin in one step
curl -fsSL https://get.docker.com | sh
Add your user to the docker group (so you don't need sudo every time)
sudo usermod -aG docker $USER newgrp dockerVerify
docker --version # Docker version 24+ docker compose version # Docker Compose version v2+ `> If you prefer manual installation, follow the [official Docker docs for Ubuntu](https://docs.docker.com/engine/install/ubuntu/).
First deploy
`bash
SSH into your server
ssh root@your-server-ipCreate deploy directory
mkdir -p /srv/lygotype
cd /srv/lygotypeClone the repository
git clone https://github.com/mangopaws/lygotype.git .Configure environment
cp server/.env.example server/.env
nano server/.env
Fill in BETTER_AUTH_SECRET, VITE_API_URL, and optionally Stripe keys
Build and start
docker compose up -d --build
`The app will be available at
http://your-server-ip:3001.Docker Compose configuration
`yaml
docker-compose.yml
services:
lygotype:
build: .
container_name: lygotype-app
restart: unless-stopped
environment:
NODE_ENV: production
env_file:
- server/.env
volumes:
- ./data:/app/data
networks:
- webnetworks:
web:
external: true
`The
web network is shared with Caddy for reverse proxy routing. Create it if it doesn't exist:`bash
docker network create web
`Ports and firewall
Lygotype itself only binds to the internal Docker network — it does not expose a public port directly. Caddy handles all public traffic.
| Port | Protocol | Direction | Purpose |
|---|---|---|---|
| 80 | TCP | Inbound | HTTP (Caddy — redirects to HTTPS) |
| 443 | TCP | Inbound | HTTPS (Caddy — proxies to Lygotype) |
| 3001 | TCP | Internal only | Lygotype app (Docker network, not public) |
| 22 | TCP | Inbound | SSH access to your server |
You do not need to open port 3001. Caddy reaches the app container over the shared
web Docker network by container name, so port 3001 never needs to be exposed to the internet.If you're using
ufw (Ubuntu's firewall), here's the minimal required setup:`bash
sudo ufw allow 22/tcp # SSH — do this first or you'll lock yourself out
sudo ufw allow 80/tcp # HTTP
sudo ufw allow 443/tcp # HTTPS
sudo ufw enablesudo ufw status # Confirm rules
`Data persistence
Form data and responses are stored in SQLite at
./data/lygotype.db. The volumes mount ensures data persists across container restarts and rebuilds.Always back up the
./data directory before major updates.Checking status
`bash
View running containers
docker psView logs
docker logs lygotype-appFollow logs
docker logs -f lygotype-app
`Updating
`bash
cd /srv/lygotype
git pull
docker compose up -d --build
``Database migrations run automatically on startup.