Last active
August 25, 2016 10:36
-
-
Save cfallin/73313612543061ef0c136689eb04aac1 to your computer and use it in GitHub Desktop.
Five Minute Dockerized GitHub Replacement
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To set up a new server with a Gogs instance, similar to GitHub: | |
1. Create a clean VM with Debian (on e.g. Digital Ocean) and point a (sub)domain to it | |
2. Log in and change the SSH daemon to listen on port 2222 | |
- edit /etc/ssh/sshd_config, "Port 22" -> "Port 2222", systemctl restart ssh | |
- log out; log in with "ssh -p 2222 root@..." | |
3. Install Docker | |
- https://docs.docker.com/engine/installation/linux/debian/ | |
4. Create data directories | |
- mkdir /home/gogs | |
- mkdir /home/certs | |
5. Create containers | |
- export GITHOST=git.mydomain.com | |
- docker run --restart=always -d --name nginx-proxy -p 80:80 -p 443:443 -v /home/certs:/etc/nginx/certs:ro -v /etc/nginx/vhost.d -v /usr/share/nginx/html -v /var/run/docker.sock:/tmp/docker.sock:ro jwilder/nginx-proxy | |
- docker run --restart=always -d --name letsencrypt -v /home/certs:/etc/nginx/certs:rw --volumes-from nginx-proxy -v /var/run/docker.sock:/var/run/docker.sock:ro jrcs/letsencrypt-nginx-proxy-companion | |
- docker run --restart=always -d --name gogs -p 22:22 -v /home/gogs:/data -e VIRTUAL_HOST=$GITHOST,www.$GITHOST -e LETSENCRYPT_HOST=$GITHOST,www.$GITHOST -e LETSENCRYPT_EMAIL=root@$GITHOST -e VIRTUAL_PORT=3000 gogs/gogs | |
- now visit https://$GITHOST/ and go through the Gogs setup (choose SQLite as database option) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment