Skip to content

Instantly share code, notes, and snippets.

@joubertredrat
Last active November 2, 2020 18:09
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save joubertredrat/74f198300a455e5dcaa9c3660c9d760a to your computer and use it in GitHub Desktop.
Save joubertredrat/74f198300a455e5dcaa9c3660c9d760a to your computer and use it in GitHub Desktop.
Install Gogs from binary on VestaCP panel

Install Gogs from binary on VestaCP

This tutorial was written based on Ubuntu 14.04 with VestaCP.

For this example, I created user cooler, domain repo.my.cooler and database cooler_repo on VestaCP panel.

To install Gogs, you will need to use user with admin rights, on my tutorial I'm using default admin user from VestaCP.

1 - install supervisor.

$ sudo apt-get -y install supervisor

2 - Go to your domain root and download latest Gogs binary. To see latest build, go to https://gogs.io/docs/installation/install_from_binary and get correct link.

$ cd /home/coller/web/repo.my.cooler
/home/coller/web/repo.my.cooler$ sudo wget https://dl.gogs.io/gogs_v0.9.13_linux_amd64.tar.gz
/home/coller/web/repo.my.cooler$ sudo tar -zxvf gogs_v0.9.13_linux_amd64.tar.gz

3 - Create folder to contain git repositories and apply correct user permissions.

/home/coller/web/repo.my.cooler$ sudo mkdir gogs-repositories
/home/coller/web/repo.my.cooler$ sudo chown cooler. gogs gogs-repositories

4 - Create supervisor config for Gogs with your favorite editor.

$ sudo vim /etc/supervisor/conf.d/gogs.conf

Note: look that in my config I'm using my user cooler and domain repo.my.cooler examples.

[program:gogs]
directory=/home/cooler/web/repo.my.cooler/gogs/
command=/home/cooler/web/repo.my.cooler/gogs/gogs web
autostart=true
autorestart=true
startsecs=10
stdout_logfile=/home/cooler/web/repo.my.cooler/logs/gogs-stdout.log
stdout_logfile_maxbytes=1MB
stdout_logfile_backups=10
stdout_capture_maxbytes=1MB
stderr_logfile=/home/cooler/web/repo.my.cooler/logs/gogs-stderr.log
stderr_logfile_maxbytes=1MB
stderr_logfile_backups=10
stderr_capture_maxbytes=1MB
environment = HOME="/home/cooler", USER="cooler"
user = cooler

5 - Create reverse proxy config for Gogs on your domain with your favorite editor.

$ sudo vim /home/cooler/conf/web/apache2.repo.my.cooler.conf
ProxyRequests Off
ProxyPass / http://localhost:3000/
ProxyPassReverse / http://localhost:3000/

6 - Enable apache proxy modules and restart apache and supervisor.

$ sudo a2enmod proxy
$ sudo a2enmod proxy_http
$ sudo service supervisor restart
$ sudo service apache2 restart

7 - Open domain in your browser and configure your Gogs as example below:

Gogs 1

8 - After this, click on "Install Gogs" and done, your Gogs is ready as example below:

Gogs 2

@ameeno
Copy link

ameeno commented Sep 26, 2018

getting error 500's and stuff, it does not work well. will try gittea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment