Files
portioner/gitea/SETUP.md

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-gitea in Synology DSM (Control Panel > User & Group).
  • Manual: Give this user read/write access to the docker shared folder.

Get User IDs

  • Manual: SSH into your NAS and run sudo synouser --get svc-gitea.
  • Confirmed IDs: Locate the User ID (PUID) and Group ID (PGID).
  • Action: Open create_gitea_folders.sh and update the USER_ID="[PUID]:[PGID]" line.
  • Action: Open stack.env and update the USER_UID and USER_GID variables.

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. Ensure DOMAIN and ROOT_URL exactly 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.yml and 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.