A simple Forgejo hosting project managed with Docker Compose and Make.
This project provides a complete setup for hosting a Forgejo instance, including a web server (Caddy), a bot protection layer (Anubis), a database (MariaDB/MySQL), and a Forgejo runner for CI/CD.
- Forgejo: forgejo.org
- Caddy: caddyserver.com
- Anubis: anubis.techaro.lol
Before you begin, ensure you have the following installed:
- Docker
- Docker Compose
- Make
Before running the project, you need to create the environment-specific .env files.
Copy the example file to .env.local:
cp .env.example .env.localThen, edit .env.local and fill in the required values.
Copy the example file to .env.prod:
cp .env.example .env.prodThen, edit .env.prod and fill in the required values.
To build and run the project in production mode:
# Build production images
make build ENV=prod
# Run the project in production
make run ENV=prodTo build and run the project locally:
make build
make runAfter starting the project, you must register the runner in Forgejo:
- Log in to Forgejo as an administrator.
- Go to Site Administration > Actions > Runners.
- Create a new runner and copy the Registration Token.
- Edit
.docker/runner/data/runner-config.yml: Example:connections: local: url: http://forgejo.internal uuid: #FORGEJO_RUNNER_UUID# token: #FORGEJO_RUNNER_TOKEN# labels: - ubuntu-latest:docker://ghcr.io/catthehacker/ubuntu:act-24.04
- Restart the runner service:
For HTTPS certificates to be trusted on your host machine (especially in local development), you need to add Caddy's root certificate to your host's trust store:
- Copy the root certificate from the Caddy container:
docker cp caddy:/data/caddy/pki/authorities/local/root.crt ./root.crt
- Add
root.crtto your system's trusted certificates (the process varies by OS).
make stop ENV=prod