forked from mirrors/gitea
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:
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
|
||||
|
@ -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
|
||||
###
|
||||
|
@ -20,8 +20,8 @@ embedded assets. This can be different for older releases. Choose the file match
|
||||
the destination platform from the [downloads page](https://dl.gitea.io/gitea), copy
|
||||
the URL and replace the URL within the commands below:
|
||||
|
||||
```
|
||||
wget -O gitea https://dl.gitea.io/gitea/1.3.2/gitea-1.3.2-linux-amd64
|
||||
```sh
|
||||
wget -O gitea https://dl.gitea.io/gitea/1.4.2/gitea-1.4.2-linux-amd64
|
||||
chmod +x gitea
|
||||
```
|
||||
|
||||
@ -34,6 +34,54 @@ location. When launched manually, Gitea can be killed using `Ctrl+C`.
|
||||
./gitea web
|
||||
```
|
||||
|
||||
## Recommended server configuration
|
||||
|
||||
### Prepare environment
|
||||
|
||||
Check that git is installed on the server, if it is not install it first.
|
||||
```sh
|
||||
git --version
|
||||
```
|
||||
|
||||
Create user to run gitea (ex. `git`)
|
||||
```sh
|
||||
adduser \
|
||||
--system \
|
||||
--shell /bin/bash \
|
||||
--gecos 'Git Version Control' \
|
||||
--group \
|
||||
--disabled-password \
|
||||
--home /home/git \
|
||||
git
|
||||
```
|
||||
|
||||
### Create required directory structure
|
||||
|
||||
```sh
|
||||
mkdir -p /var/lib/gitea/{custom,data,indexers,public,log}
|
||||
chown git:git /var/lib/gitea/{data,indexers,log}
|
||||
chmod 750 /var/lib/gitea/{data,indexers,log}
|
||||
mkdir /etc/gitea
|
||||
chown root:git /etc/gitea
|
||||
chmod 770 /etc/gitea
|
||||
```
|
||||
|
||||
**NOTE:** `/etc/gitea` is temporary set with write rights for user `git` so that Web installer could write configuration file. After installation is done it is recommended to set rights to read-only using:
|
||||
```
|
||||
chmod 750 /etc/gitea
|
||||
chmod 644 /etc/gitea/app.ini
|
||||
```
|
||||
|
||||
### Copy gitea binary to global location
|
||||
|
||||
```
|
||||
cp gitea /usr/local/bin/gitea
|
||||
```
|
||||
|
||||
### Create service file to start gitea automatically
|
||||
|
||||
See how to create [Linux service]({{< relref "run-as-service-in-ubuntu.en-us.md" >}})
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Old glibc versions
|
||||
|
Loading…
Reference in New Issue
Block a user