Gogs
Gogs is a Git repository manager written in Go.
Initial Configuration¶
To run Gogs, you must first ensure the correct configuration of the domain. Before proceeding, make sure that:
- One TCP port has been reserved.
- The domain is correctly added and configured in our DNS system.
- A Website has been added with type Proxy pointing to the previously reserved port.
- A MySQL or PostgreSQL database has been created.
- The ability to run custom software has been enabled – Binexec.
- An email account has been configured for the reserved domain (optional).
Installing Go¶
Before installing Gogs, you need to install a new version of Go:
wget https://dl.google.com/go/go1.14.2.freebsd-amd64.tar.gz
tar -zxf go1.14.2.freebsd-amd64.tar.gz
mkdir ~/bin
ln -s ~/go/bin/go ~/bin/ && ln -s ~/go/bin/gofmt ~/bin/
echo 'export PATH=$HOME/bin:$PATH' >> $HOME/.bash_profile
source $HOME/.bash_profile
Installing Gogs¶
Gogs must be installed from source. To do this, run the following commands:
git clone --depth 1 https://github.com/gogs/gogs.git gogs
cd gogs
go build -o gogs
First Run¶
Start the server with the command:
nohup ~/gogs/gogs web -p
reserved_port
&
Then open your browser, go to the previously configured domain, and complete the installation form.
Automatic Startup After Reboot¶
Since Gogs requires manual startup, here’s how to automate its launch after a server reboot.
Create a file gogscron.sh
in your home directory with the following content:
#!/bin/bash
export PATH=$HOME/bin:$PATH
nohup ~/gogs/gogs web -p reserved_port
Set execution permission:
chmod +x gogscron.sh
To automatically start Gogs after server reboot, add the following line to the Cron table (crontab -e
):
@reboot /home/login/gogscron.sh
(where login is the hosting account username).
Integration with MyDevil.net Repositories¶
It is possible to use Gogs with our Git repositories. Simply create a symbolic link to the selected repository:
cd /home/login/gogs-repositories/gogs_login/
rm -r gogs_repo.git
ln -s /home/login/repo/git/repo_visibility/repo_name gos_repo.git
SSH¶
By default, Gogs blocks SSH access to the hosting account. However, it allows running its own internal SSH server.