Deploy the backend API to the Hetzner server (api.openlegalcodes.org). Use when backend code changes need to go live.
Deploy the backend API server to the Hetzner VPS at api.openlegalcodes.org.
openlegalcodes-api (app) + caddy (reverse proxy/SSL)tar czf /tmp/olc-deploy.tar.gz \
--exclude='node_modules' --exclude='web' --exclude='codes' \
--exclude='.git' --exclude='dist' --exclude='.next' --exclude='.context' \
Dockerfile package*.json tsconfig.json src/ data/
scp -i /tmp/hetzner-openlegalcodes /tmp/olc-deploy.tar.gz [email protected]:/root/olc-deploy.tar.gz
ssh -i /tmp/hetzner-openlegalcodes [email protected] '
cd /root/app && tar xzf /root/olc-deploy.tar.gz 2>/dev/null &&
docker build -t openlegalcodes-api . &&
docker stop openlegalcodes-api && docker rm openlegalcodes-api &&
docker run -d --name openlegalcodes-api --restart unless-stopped \
--network host \
-v /root/codes:/app/codes \
openlegalcodes-api'
ssh -i /tmp/hetzner-openlegalcodes [email protected] 'docker logs openlegalcodes-api 2>&1 | tail -5'
curl -s "https://api.openlegalcodes.org/api/v1/lookup?slug=mountain-view&state=CA"
--network host flag is required so Caddy can reach the API on localhost:3100