Skip to content

Instantly share code, notes, and snippets.

@darth-veitcher
Forked from adamlwgriffiths/gitea.md
Created February 17, 2024 17:42
Show Gist options
  • Save darth-veitcher/f61372dde68a8d19ca0153ce13ee7153 to your computer and use it in GitHub Desktop.
Save darth-veitcher/f61372dde68a8d19ca0153ce13ee7153 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