This Tutorial is Work in progress

Advanced: In-house GIN service - without Docker

Preamble

This Tutorial is written with respect to Ubuntu 16.04. It should work for all tuxish distributions, however, the packages might have different names and their installation could be different.

Install dependencies

You will probably need root permission to do this

apt-get install -y --no-install-recommends \
                   make golang \
                   git git-annex openssh-server \
                   sqlite

Setup the environment

Here we are going to set up a temporary path for your go libraries (GOPATH). Choose its location wisely. Please note, this path will not be set permanently (you can make it permanent by e.g. by modifying your .bashrc). If you follow the description below, everything will be installed in a folder called go inside your home diretory:

export GOPATH=~/go

and now we derive other path:

export PATH=/usr/local/go/bin:${PATH}:${GOPATH}/bin
export GO15VENDOREXPERIMENT=1

Install required go packages

go get golang.org/x/crypto/bcrypt
go get github.com/jteeuwen/go-bindata
go get github.com/G-Node/gin-doi/src
go get github.com/G-Node/git-module
go get gopkg.in/yaml.v2

Putting go-bindata into path

cd ${GOPATH}/src/github.com/jteeuwen/go-bindata/go-bindata
go install

Getting and compiling GIN/Gogs

First, we will ensure that the directory where GIN/Gogs needs to live in is good to go: rm -rf ${GOPATH}/src/github.com/G-Node/gogs

Now we git clone the latest G-Node gogs version:

git clone -b gin@home https://github.com/G-Node/gogs.git ${GOPATH}/src/github.com/G-Node/gogs

And compile it:

cd ${GOPATH}/src/github.com/G-Node/gogs
make build TAGS="sqlite cert pam"

Ready for a first start

cd ${GOPATH}/src/github.com/G-Node/gogs
./gogs web

This should get you going and you can now visit the installation page of your GIN on:

http://localhost:3000

Configure Server

Basics

After visiting the locally hosted website for the first time, you will be asked to setup quite some things

  • For the database, we recommend the use of SQLite3. Select this option at the top.
  • We also recommend using the built-in ssh server which should be set to another port than 2222 and ideally to a high port number.
  • Fill out the other details and start ginning by going to. http://localhost:3000

You can always start you gin server with:

cd ${GOPATH}/src/github.com/G-Node/gogs
./gogs web

again. The configuration is (typically) stored in: ${GOPATH}/src/github.com/G-Node/gogs/customapp.ini

SSH

If you want to use the SSH of your server, the setup is a bit more intricate and involves:

  • making your users (or some users) allowed_keys file accessible and writable to the service
  • by e. g. putting a link to it to a location the service expects it with something like ln -sf /data/git /home/git
Achilleas Koutsou edited this page 3 years ago