Docker and Docker-Compose files for hosting a Gitea Server
These scripts are shared purely for information, and do not necessarily reflect best practices. No guarantees provided.
- On your synology, or other docker host, create a user and group called gitea. Grab the UID from the /etc/passwd file, and the GID from the /etc/group file on your host.
- Create a share called docker
- Create a folder within that share called gitea
- Create subfolders for the scripts, and a subfolder for data
#Update these locations to match your setup.
#Data directory
mkdir /volume1/docker/gitea/dataFolder/data
#Scripts directory
mkdir /volume1/docker/gitea/gitea-dockercompose- Change ownership of this new gitea directory to the gitea user and group
chgrp -R gitea /volume1/docker/gitea
chown -R gitea /volume1/docker/gitea- Update the GID and UID in the docker-compose.yml file.
- If required update the ports in the docker-compose.yml file
- Update the timezone in the timezone file.
- Update the location of your scripts directory in stop-update-start.sh
- Running stop-update-start.sh should create a new gitea instance. The first time you run it, it may complain about the container not existing.
- During the first run wizard, make sure to specify the correct URL with the ports specified in the docker-compose.yml, by default these are
- 3000 for http
- 222 for ssh.
Simply run stop-update-start.sh. This will update to the latest gitea version by default. If you wish, you can change the tag to update to in the docker-compose.yml file.
I schedule this to run once a week.
Note, I have tested these backups for myself, however provide no guarantees they work. Please run and verify your own backups.
Running a new backup will delete any backups already existing in /volume1/docker/gitea/dataFolder/data/backup. This is not meant to be the final backup location.
- Run, and preferably schedule backup.sh to run. This should run on the host and will execute a command within the container.
- Verify your backup now exists in /volume1/docker/gitea/dataFolder/data/backup
- Move/copy this backup to your desired safekeeping space.