From 1aee261aae74881f65a1152f6fa57bc160adaa16 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Tue, 5 Jun 2018 05:02:04 +0300 Subject: More detailed documentation on how to set up from binary (#4121) * More detailed documentation on how to set up from binary Also change recommended file locations --- contrib/init/centos/gitea | 10 +++++----- contrib/init/debian/gitea | 17 ++++++++++------- contrib/init/freebsd/gitea | 5 +++-- contrib/init/gentoo/gitea | 6 +++--- contrib/init/openbsd/gitea | 6 +++--- contrib/init/suse/gitea | 8 ++++---- contrib/systemd/gitea.service | 6 +++--- 7 files changed, 31 insertions(+), 27 deletions(-) (limited to 'contrib') diff --git a/contrib/init/centos/gitea b/contrib/init/centos/gitea index c24fc1f01e..4f0d0d99b2 100644 --- a/contrib/init/centos/gitea +++ b/contrib/init/centos/gitea @@ -24,8 +24,8 @@ # Default values NAME=gitea -GITEA_HOME=/home/git/gitea -GITEA_PATH=${GITEA_HOME}/$NAME +GITEA_HOME=/var/lib/${NAME} +GITEA_PATH=/usr/local/bin/${NAME} GITEA_USER=git SERVICENAME="Gitea - Git with a cup of tea" LOCKFILE=/var/lock/subsys/gitea @@ -49,11 +49,11 @@ DAEMON_OPTS="--check $NAME" start() { cd ${GITEA_HOME} echo -n "Starting ${SERVICENAME}: " - daemon $DAEMON_OPTS "${GITEA_PATH} web > ${LOGFILE} 2>&1 &" + daemon $DAEMON_OPTS "${GITEA_PATH} web -c /etc/${NAME}/app.ini > ${LOGFILE} 2>&1 &" RETVAL=$? echo [ $RETVAL = 0 ] && touch ${LOCKFILE} - + return $RETVAL } @@ -63,7 +63,7 @@ stop() { killproc ${NAME} RETVAL=$? echo - [ $RETVAL = 0 ] && rm -f ${LOCKFILE} + [ $RETVAL = 0 ] && rm -f ${LOCKFILE} } case "$1" in diff --git a/contrib/init/debian/gitea b/contrib/init/debian/gitea index 1a371ba4a4..b7911f106e 100644 --- a/contrib/init/debian/gitea +++ b/contrib/init/debian/gitea @@ -14,17 +14,20 @@ # Do NOT "set -e" # PATH should only include /usr/* if it runs after the mountnfs.sh script -PATH=/sbin:/usr/sbin:/bin:/usr/bin -DESC="Git with a cup of tea" +PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin +DESC="Gitea - Git with a cup of tea" NAME=gitea SERVICEVERBOSE=yes PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME -WORKINGDIR=/home/git/gitea -DAEMON=$WORKINGDIR/$NAME -DAEMON_ARGS="web" +WORKINGDIR=/var/lib/$NAME +DAEMON=/usr/local/bin/$NAME +DAEMON_ARGS="web -c /etc/$NAME/app.ini" USER=git -USERBIND="setcap cap_net_bind_service=+ep" +USERBIND="" +# If you want to bind Gitea to a port below 1024 uncomment +# the line below +#USERBIND="setcap cap_net_bind_service=+ep" STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/1/KILL/5}" # Read configuration variable file if it is present @@ -36,7 +39,7 @@ STOP_SCHEDULE="${STOP_SCHEDULE:-QUIT/5/TERM/1/KILL/5}" do_start() { $USERBIND $DAEMON - sh -c "USER=$USER start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\ + sh -c "USER=$USER HOME=/home/$USER GITEA_WORK_DIR=$WORKINGDIR start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\ --background --chdir $WORKINGDIR --chuid $USER \\ --exec $DAEMON -- $DAEMON_ARGS" } diff --git a/contrib/init/freebsd/gitea b/contrib/init/freebsd/gitea index 898606f35f..2c034ce12c 100644 --- a/contrib/init/freebsd/gitea +++ b/contrib/init/freebsd/gitea @@ -19,9 +19,9 @@ load_rc_config $name : ${gitea_user:="git"} : ${gitea_enable:="NO"} -: ${gitea_directory:="/home/git"} +: ${gitea_directory:="/var/lib/gitea"} -command="${gitea_directory}/gitea web" +command="/usr/local/bin/gitea web -c /etc/gitea/app.ini" procname="$(echo $command |cut -d' ' -f1)" pidfile="${gitea_directory}/${name}.pid" @@ -33,6 +33,7 @@ gitea_start() { cd ${gitea_directory} export USER=${gitea_user} export HOME=/usr/home/${gitea_user} + export GITEA_WORK_DIR=${gitea_directory} /usr/sbin/daemon -f -u ${gitea_user} -p ${pidfile} $command } diff --git a/contrib/init/gentoo/gitea b/contrib/init/gentoo/gitea index d8c150d417..c40fc93f5f 100644 --- a/contrib/init/gentoo/gitea +++ b/contrib/init/gentoo/gitea @@ -1,11 +1,11 @@ #!/sbin/openrc-run -DIR=/home/git/gitea +DIR=/var/lib/gitea USER=git start_stop_daemon_args="--user ${USER} --chdir ${DIR}" -command="${DIR}/gitea" -command_args="web" +command="/usr/local/bin/gitea" +command_args="web -c /etc/gitea/app.ini" command_background=yes pidfile=/var/run/gitea.pid diff --git a/contrib/init/openbsd/gitea b/contrib/init/openbsd/gitea index c43190b558..89d4f6803e 100755 --- a/contrib/init/openbsd/gitea +++ b/contrib/init/openbsd/gitea @@ -2,11 +2,11 @@ # # $OpenBSD$ -daemon="/home/git/gitea/gitea" +daemon="/usr/local/bin/gitea" daemon_user="git" -daemon_flags="web" +daemon_flags="web -c /etc/gitea/app.ini" -gitea_directory="/home/git/gitea" +gitea_directory="/var/lib/gitea" rc_bg=YES diff --git a/contrib/init/suse/gitea b/contrib/init/suse/gitea index 77fb6689cf..23178583ff 100644 --- a/contrib/init/suse/gitea +++ b/contrib/init/suse/gitea @@ -18,10 +18,10 @@ # Default values NAME=gitea -GITEA_HOME=/home/git/gitea -GITEA_PATH=${GITEA_HOME}/$NAME +GITEA_HOME=/var/lib/$NAME +GITEA_PATH=/usr/local/bin/$NAME GITEA_USER=git -SERVICENAME="Git - with a cup of tea" +SERVICENAME="Gitea - Git with a cup of tea" LOCKFILE=/var/lock/subsys/gitea LOGPATH=${GITEA_HOME}/log LOGFILE=${LOGPATH}/error.log @@ -58,7 +58,7 @@ case "$1" in # return skipped as service is already running (exit 5) else - su - ${GITEA_USER} -c "USER=${GITEA_USER} ${GITEA_PATH} web 2>&1 >>${LOGFILE} &" + su - ${GITEA_USER} -c "USER=${GITEA_USER} GITEA_WORK_DIR=${GITEA_HOME} ${GITEA_PATH} web -c /etc/${NAME}/app.ini 2>&1 >>${LOGFILE} &" fi # Remember status and be verbose diff --git a/contrib/systemd/gitea.service b/contrib/systemd/gitea.service index 8c627e7b5c..387de14fa6 100644 --- a/contrib/systemd/gitea.service +++ b/contrib/systemd/gitea.service @@ -18,10 +18,10 @@ RestartSec=2s Type=simple User=git Group=git -WorkingDirectory=/home/git/gitea -ExecStart=/home/git/gitea/gitea web +WorkingDirectory=/var/lib/gitea/ +ExecStart=/usr/local/bin/gitea web -c /etc/gitea/app.ini Restart=always -Environment=USER=git HOME=/home/git +Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea # If you want to bind Gitea to a port below 1024 uncomment # the two values below ### -- cgit v1.2.3