Skip to content

Instantly share code, notes, and snippets.

@adamlwgriffiths
Last active April 7, 2024 22:17
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adamlwgriffiths/3d7c1f101d0b21757c162d01f1a1f251 to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment