mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	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
This commit is contained in:
		
				
					committed by
					
						
						techknowlogick
					
				
			
			
				
	
			
			
			
						parent
						
							6400d8a3cb
						
					
				
				
					commit
					1aee261aae
				
			@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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"
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user