Gogs is that great Github clone which is also available as a docker image. Works perfectly if started by the user but since you probably want to run it on your server and without interruption you can add a systemd script to start up Gogs on boot. My script looks like this:
# /etc/systemd/system/docker.gogs.service
[Unit]
Description=Gogs container
Requires=docker.service
Require=postgresql.service
After=docker.service
After=postgresql.service
[Service]
Restart=always
ExecStart=/usr/bin/docker run --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs
ExecStop=/usr/bin/docker stop -t 2 gogs ; /usr/bin/docker rm -f gogs
[Install]
WantedBy=multi-user.targetThis script expects to find docker and postgres running since those are the two dependencies.
It will always restart if it crashes and run on ports 10022 for ssh and 10088 for http. Data is stored under /var/data. If the container stops it is immediately purged and restarted.
In order to activate your script you need to:
sudo systemctl enable docker.gogsYou can now either just connect to your ip:10080 or set up a webserver backproxy so that you can easily integrate your service with other web services.