2.1 KiB
2.1 KiB
Service Setup Guide: Gitea
Gitea is a painless self-hosted Git service covering the entire software development lifecycle.
1. Pre-Setup (Manual)
Create Service User
- Manual: Create a local user named
svc-giteain Synology DSM (Control Panel > User & Group). - Manual: Give this user read/write access to the
dockershared folder.
Get User IDs
- Manual: SSH into your NAS and run
sudo synouser --get svc-gitea. - Confirmed IDs: Locate the
User ID(PUID) andGroup ID(PGID). - Action: Open
create_gitea_folders.shand update theUSER_ID="[PUID]:[PGID]"line. - Action: Open
stack.envand update theUSER_UIDandUSER_GIDvariables.
2. Infrastructure Setup
Run Setup Script
- Action: Run the setup script in Dry-Run mode to verify changes:
sudo bash create_gitea_folders.sh - Action: Apply the folder creation and ownership settings:
sudo bash create_gitea_folders.sh --run
3. Portainer Deployment
Environment Variables
- Action: Review
stack.env. EnsureDOMAINandROOT_URLexactly match the Cloudflare configuration (e.g.,gitea.chengs.uk) to prevent the mismatch security error.
Deploy Stack
- Action: Create a new stack named
gitea-stack. - Action: Upload or paste the environment variables from
stack.env. - Action: Paste the content of
docker-compose.portainer.ymland deploy. - Verification: Access the Gitea web interface at
http://[NAS_IP]:3001(or whatever HTTP port you defined).
4. Troubleshooting
ROOT_URL Error Mismatch
If you ever see the error:
Your ROOT_URL in app.ini is "http://...", it's unlikely matching the site you are visiting.
This means Gitea's security system noticed you are accessing it from a different URL than it was configured for. Ensure the GITEA__server__DOMAIN and GITEA__server__ROOT_URL environment variables exactly match the public address you use (like a Cloudflare Tunnel domain). This is already permanently fixed via the environment variables in the provided docker-compose.portainer.yml file.