Skip to content

Instantly share code, notes, and snippets.

@adamlwgriffiths
Last active November 15, 2025 13:44
Show Gist options
  • Select an option

  • Save adamlwgriffiths/3d7c1f101d0b21757c162d01f1a1f251 to your computer and use it in GitHub Desktop.

Select an option

Save adamlwgriffiths/3d7c1f101d0b21757c162d01f1a1f251 to your computer and use it in GitHub Desktop.
Setup Gitea on Synology DiskStation NAS

Synology Gitea setup

Install Docker

Package Centre > Docker > Install

Create folders

    /docker/gitea/postgresql
    /docker/gitea/gitea

Create HTTPS redirect

Do this now so you reserve the appropriate ports. You need 3 ports:

  • HTTPS, which redirects to:
  • HTTP
  • SSH port

Control Panel > Application Portal > Reverse Proxy > Create

    Source
      Protocol: HTTPS
      Hostname: *
      Port: <HTTPS Port>
      Enable HSTS
      Enable HTTP/2
    Destination
      Protocol: HTTP
      Hostname: localhost
      Port: <HTTP Port>

Install Postgresql

Apps > Docker > Registry > Search > sameersbn/postgresql

This is the image that Synology uses when installing Postgres.

    Name: gitea_postgresql
    Volume:
        /docker/gitea/postgresql -> /var/lib/postgresql
    Network: bridge
    Env:
        DB_NAME gitea
        DB_USER gitea_user
        DB_PASS gitea_pass

Install Gitea

Apps > Docker > Registry > Search > gitea/gitea

Based on these instructions

Note: We configure Gitea to use the reverse proxied ports so that any URLs are correct.

    Name: gitea_gitea
    Ports:
        <HTTP Port> -> <HTTPS Port> tcp
        <SSH Port> -> <SSH Port> tcp
    Volume:
        /docker/gitea/gitea -> /data
    Links:
        gitea_postgresql -> db
    Network: bridge
    Env:
       DB_TYPE: postgres
       DB_HOST: db:5432
       DB_NAME: gitea
       DB_USER: gitea_user
       DB_PASSWD: gitea_pass
       HTTP_PORT: <HTTPS Port>
       SSH_PORT: <SSH Port>
       LFS_START_SERVER: true (optional)

Run Gitea

Docker > Containers > gitea_gitea > On

TODO:

  • Simplify port re-direction (https -> http -> docker http)
@jzer7
Copy link

jzer7 commented Aug 26, 2025

Thanks for the writeup.

This could be something new on my side. I ran into a tiny hiccup at the end. The install failed, with "permission denied for schema public". It seems the new gitea database was owned by the postgres user, not by the gitea user.

A fix was to transfer get a terminal to the postgresql container, and give ownership to the gitea user.

ALTER DATABASE gitea_user OWNER TO gitea;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment