Add CI/CD pipeline and Docker deployment #8
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Set up a CI/CD pipeline using Gitea Actions and Docker to build, test, and deploy the Initiative app to a VPS at https://initiative.dostulata.rocks. The workflow runs quality checks on every push and builds/publishes a Docker image on semver tags. The VPS serves the static SPA behind Caddy (automatic HTTPS).
Acceptance Criteria
pnpm checkon every pushVPS Setup Guide
VPS Setup Guide — Initiative
This guide walks you through setting up a VPS to host the Initiative app at
initiative.dostulata.rocks.1. Get a VPS
Recommended: Hetzner Cloud CX22 (~4 EUR/mo) — 2 vCPU, 4GB RAM, 40GB disk.
Any provider works (DigitalOcean, Contabo, Netcup, etc). Requirements:
2. Point your domain
In your domain registrar's DNS settings, create:
If you also want
www.dostulata.rocks:Verify propagation (may take a few minutes):
3. Initial VPS setup
SSH into your VPS:
3.1 Update system and install Docker
3.2 Create a non-root user (optional but recommended)
Then log in as
deployfor the remaining steps, or continue as root.4. Set up Caddy (reverse proxy + automatic HTTPS)
Caddy runs directly on the VPS (not in Docker) and proxies requests to your app container. It handles HTTPS certificates from Let's Encrypt automatically.
4.1 Install Caddy
4.2 Configure Caddy
That's it. Caddy will automatically obtain and renew HTTPS certificates.
4.3 Start Caddy
5. Set up Gitea Actions Runner
The runner executes your CI/CD workflows on this VPS.
5.1 Download act_runner
Check the latest version at https://gitea.com/gitea/act_runner/releases, then:
5.2 Get a registration token
https://git.bahamut.nitrix.one/dostulata/initiative/settings/actions/runners5.3 Register the runner
The
--labelsflag maps theubuntu-latestlabel (used in workflows) to a Docker image the runner will use.5.4 Run as a systemd service
Verify it's running:
You should also see the runner appear as "Online" in your Gitea repo's runner settings.
6. Set up the app container
6.1 Create an app directory
6.2 Create docker-compose.yml
This maps port 8080 (what Caddy proxies to) to port 80 inside the container (where Nginx serves the static files).
6.3 Log in to the Gitea container registry
To create a token: Gitea > Settings > Applications > Generate New Token (enable
read:package).6.4 First deploy (once the CI has pushed an image)
7. Deploy new versions
After the CI builds and pushes a new image (triggered by a git tag), update the running container:
Optional: Auto-deploy with Watchtower
To automatically pull and restart when a new
latestimage is pushed:Watchtower checks every 5 minutes for new images and auto-deploys.
8. Verify everything works
https://git.bahamut.nitrix.one/dostulata/initiative/actionshttps://initiative.dostulata.rocks— you should see your app with HTTPSTroubleshooting
Caddy not getting certificates:
dig +short dostulata.rocksjournalctl -u caddyRunner not picking up jobs:
systemctl status act_runnerjournalctl -u act_runnerDocker pull failing:
docker login git.bahamut.nitrix.oneread:packagescopeContainer not starting:
cd /opt/initiative && docker compose logs