Installing Forgejo on Synology NAS with Docker
Forgejo is a fork of Gitea. While most people use Gitea as their personal Git server on NAS, I decided to instlal Forgejo instead becuase I appreciate their philosophy and community approach.
Installing Forgejo using a docker-compose file in Portainer is the simplest method. Here's the configuration I used:
services:
forgejo:
image: codeberg.org/forgejo/forgejo:14
container_name: Forgejo
hostname: forgejo
security_opt:
- no-new-privileges:true
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000"]
interval: 30s
timeout: 5s
retries: 5
ports:
- "3053:3000"
- "2222:22"
volumes:
- /volume1/docker/forgejo/data:/data:rw
- /etc/TZ:/etc/timezone:ro
- /etc/localtime:/etc/localtime:ro
environment:
- USER_UID=1026
- USER_GID=100
- ROOT_URL=https://forgejo.yourname.synology.me
# SQLite configuration (optional but explicit)
- GITEA__database__DB_TYPE=sqlite3
- GITEA__database__PATH=/data/forgejo.db
restart: unless-stopped
Important notes:
- Update the prot numbers to match your preferences
- Modify the envrionment variables according to your NAS settings (sepcailly USER_UID and USER_GID)
When you first access the web interface, you only need to chang the port number in the setup page to match your configuration. The, uncheck the "disable self-registration" checkbox and click the "Install" button. The setup should complete without any issues.
Most Forgejo installaion guides online recommend using PostgreSQL as the database. However, I consistently encourted errors with that setup, which led me to use SQLite instead. For my use case, SQLite works perfectly fine since I plan to use GitHub for sharing larger, collaborative projects anyway.