Gogs git server
install gogs
https://gogs.io/docs/installation
support self-signed certificates (using cert)
- download : wget https://dl.gogs.io/0.13.0/gogs_0.13.0_linux_amd64.tar.gz
- Check that prerequisites are installed ( git , database if not sqlite3 )
sudo apt-get install git
- Extract the archive
run as app
- cd into the directory that was created.
- Execute
./gogs webThis will run gogs as an application.
./gogs web &will run gogs detached from terminal => not in a ssh session on almalinux
Gogs will start up a HTTP service at port 3000 as default. Browse /install for initial configuration (e.g. http://localhost:3000/install).
https://gogs.io/docs/installation/configuration_and_run.html
now run http://80.209.239.124:3000 in a browser from elsewhere
the first time you open this , you will be asked to configure gogs , see [[gogs setup & config]]
customize
Corresponding keys in corresponding sections in custom/conf/app.ini will overwrite the values set in conf/app.ini.
to change the root path of where raw repository data is being stored, add :
[repository]
ROOT = /home/wmftp/main/repos
running gogs as daemon via init
(eg. using openrc) https://gogs.io/docs/installation/configuration_and_run#running-as-daemon-via-init-(eg.-openrc)
create a file /etc/init.d/gogs
cd /etc/init.d
echo ## > gogs
nano gogs
copy script into this file ,
assuming gogs is installed in the /home/git user => no , adapt in below code (zie custom version below code block)
GOGS_USER=wmftp
location : GOGS_PATH=/home/wmftp/main/gogs ( GOGS_HOME not needed)
#!/sbin/openrc-run
SVCNAME=gogs
GOGS_PIDFILE=/var/run/gogs.pid
GOGS_USER=git
GOGS_HOME=/home/$GOGS_USER
GOGS_PATH=$GOGS_HOME/go/src/github.com/gogs/gogs
COMMAND="${GOGS_PATH}/gogs"
ARGS="web"
depend() {
need net
use dns logger mysql
}
checkconfig() {
if [ ! -d "$GOGS_PATH" ] ; then
eerror "gogs not installed" || return 1
fi
return 0
}
start() {
checkconfig || return 1
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --quiet --background \
--make-pidfile --pidfile "${GOGS_PIDFILE}" \
--user "${GOGS_USER}" \
-d ${GOGS_PATH} \
--exec "${COMMAND}" "${ARGS}"
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet --pidfile $GOGS_PIDFILE
eend $?
}
```
custom version wm :
``` shell
#!/sbin/openrc-run
SVCNAME=gogs
GOGS_PIDFILE=/var/run/gogs.pid
GOGS_USER=wmftp
GOGS_HOME=/home/$GOGS_USER
GOGS_PATH=/home/wmftp/main/gogs
COMMAND="${GOGS_PATH}/gogs"
ARGS="web"
depend() {
need net
use dns logger mysql
}
checkconfig() {
if [ ! -d "$GOGS_PATH" ] ; then
eerror "gogs not installed" || return 1
fi
return 0
}
start() {
checkconfig || return 1
ebegin "Starting ${SVCNAME}"
start-stop-daemon --start --quiet --background \
--make-pidfile --pidfile "${GOGS_PIDFILE}" \
--user "${GOGS_USER}" \
-d ${GOGS_PATH} \
--exec "${COMMAND}" "${ARGS}"
eend $?
}
stop() {
ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --quiet --pidfile $GOGS_PIDFILE
eend $?
}