Añade plugin Redmine Git Hosting 4.0.2

This commit is contained in:
Manuel Cillero 2020-12-05 13:57:05 +01:00
parent 472cb1ea76
commit bdd66d941f
494 changed files with 36768 additions and 0 deletions

View file

@ -0,0 +1,7 @@
stdout_redirect '/home/redmine/redmine/log/puma.stderr.log', '/home/redmine/redmine/log/puma.stdout.log'
on_worker_boot do
ActiveSupport.on_load(:active_record) do
ActiveRecord::Base.establish_connection
end
end

View file

@ -0,0 +1,36 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: redmine
# Required-Start: $local_fs $remote_fs $network $mysql $named
# Required-Stop: $local_fs $remote_fs $network $mysql $named
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Redmine projects manager
# Description: This file should be used to start and stop Redmine.
### END INIT INFO
[ -f /etc/default/rcS ] && . /etc/default/rcS
. /lib/lsb/init-functions
REDMINE_USER="redmine"
WEBSERVER="server_puma"
WORKER1="sidekiq_git_hosting"
case "$1" in
start)
su - $REDMINE_USER -c "${WEBSERVER}.sh start"
su - $REDMINE_USER -c "${WORKER1}.sh start"
;;
stop)
su - $REDMINE_USER -c "${WEBSERVER}.sh stop"
su - $REDMINE_USER -c "${WORKER1}.sh stop"
;;
restart)
su - $REDMINE_USER -c "${WEBSERVER}.sh restart"
su - $REDMINE_USER -c "${WORKER1}.sh restart"
;;
*)
echo "Usage : /etc/init.d/redmine {start|stop|restart}"
;;
esac

View file

@ -0,0 +1,75 @@
#!/bin/bash
# You should place this script in user's home bin dir like :
# /home/redmine/bin/server_puma.sh
#
# Normally the user's bin directory should be in the PATH.
# If not, add this in /home/redmine/.profile :
#
# ------------------>8
# #set PATH so it includes user's private bin if it exists
# if [ -d "$HOME/bin" ] ; then
# PATH="$HOME/bin:$PATH"
# fi
# ------------------>8
#
#
# This script *must* be run by the Redmine user so
# switch user *before* running the script :
# root$ su - redmine
#
# Then :
# redmine$ server_puma.sh start
# redmine$ server_puma.sh stop
# redmine$ server_puma.sh restart
SERVER_NAME="redmine"
RAILS_ENV="production"
REDMINE_PATH="$HOME/redmine"
CONFIG_FILE="$HOME/etc/puma.rb"
PID_FILE="$REDMINE_PATH/tmp/pids/puma.pid"
SOCK_FILE="$REDMINE_PATH/tmp/sockets/redmine.sock"
BIND_URI="unix://$SOCK_FILE"
THREADS="0:8"
WORKERS=2
function start () {
echo "Start Puma Server..."
puma --daemon --preload --bind $BIND_URI \
--environment $RAILS_ENV --dir $REDMINE_PATH \
--workers $WORKERS --threads $THREADS \
--pidfile $PID_FILE --tag $SERVER_NAME \
--config $CONFIG_FILE
echo "Done"
}
function stop () {
echo "Stop Puma Server..."
if [ -f $PID_FILE ] ; then
kill $(cat $PID_FILE) 2>/dev/null
rm -f $PID_FILE
rm -f $SOCK_FILE
fi
echo "Done"
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
*)
echo "Usage : server_puma.sh {start|stop|restart}"
;;
esac

View file

@ -0,0 +1,169 @@
#!/bin/bash
# You should place this script in user's home bin dir like :
# /home/redmine/bin/sidekiq_git_hosting.sh
#
# Normally the user's bin directory should be in the PATH.
# If not, add this in /home/redmine/.profile :
#
# ------------------>8
# #set PATH so it includes user's private bin if it exists
# if [ -d "$HOME/bin" ] ; then
# PATH="$HOME/bin:$PATH"
# fi
# ------------------>8
#
#
# This script *must* be run by the Redmine user so
# switch user *before* running the script :
# root$ su - redmine
#
# Then :
# redmine$ sidekiq_git_hosting.sh start
# redmine$ sidekiq_git_hosting.sh stop
# redmine$ sidekiq_git_hosting.sh restart
# WORKER_NAME is used to identify the worker among the processus list
# Example : sidekiq 3.2.1 redmine_git_hosting [0 of 1 busy]
WORKER_NAME="redmine_git_hosting"
# The Rails environment, default : production
RAILS_ENV=${RAILS_ENV:-production}
# The absolute path to Redmine
REDMINE_PATH=${REDMINE_PATH:-$HOME/redmine}
# The start detection timeout
TIMEOUT=${TIMEOUT:-15}
DESC="Sidekiq worker '$WORKER_NAME'"
LOG_DIR="$REDMINE_PATH/log"
PID_DIR="$REDMINE_PATH/tmp/pids"
LOG_FILE="$LOG_DIR/worker_${WORKER_NAME}.log"
PID_FILE="$PID_DIR/worker_${WORKER_NAME}.pid"
# Do not change these values !
# See here for more details :
# https://github.com/jbox-web/redmine_git_hosting/wiki/Configuration-notes#sidekiq--concurrency
CONCURRENCY=1
QUEUE="redmine_git_hosting,1"
if [ "$RAILS_ENV" = "production" ] ; then
DAEMON_OPTS="--daemon --logfile $LOG_FILE --pidfile $PID_FILE"
else
DAEMON_OPTS=
fi
if [ ! -d $PID_DIR ] ; then
mkdir $PID_DIR
fi
RETVAL=0
################################
success() {
echo -e "\t\t[ \e[32mOK\e[0m ]"
}
failure() {
echo -e "\t\t[ \e[31mFailure\e[0m ]"
}
start () {
pid=$(get_pid)
if [ $pid -gt 1 ] ; then
echo "$DESC is already running (pid $pid)"
RETVAL=1
return $RETVAL
fi
echo -n "Starting $DESC ..."
sidekiq $DAEMON_OPTS --verbose --concurrency $CONCURRENCY \
--environment $RAILS_ENV --require $REDMINE_PATH \
--queue $QUEUE --tag $WORKER_NAME
if [ ! -z "$DAEMON_OPTS" ] ; then
for ((i=1; i<=TIMEOUT; i++)) ; do
pid=$(get_pid)
if [ $pid -gt 1 ] ; then
break
fi
echo -n '.' && sleep 1
done
echo -n " "
pid=$(get_pid)
if [ $pid -gt 1 ] ; then
success
RETVAL=0
else
failure
RETVAL=1
fi
fi
}
stop () {
echo -n "Shutting down $DESC ..."
kill $(cat $PID_FILE 2>/dev/null) >/dev/null 2>&1
RETVAL=$?
[ $RETVAL -eq 0 ] && success || failure
rm -f $PID_FILE >/dev/null 2>&1
}
status () {
# show status
pid=$(get_pid)
if [ $pid -gt 1 ] ; then
echo "$DESC is running (pid $pid)"
else
echo "$DESC is stopped"
fi
RETVAL=0
}
get_pid () {
# get status
pid=$(ps axo pid,command | grep sidekiq | grep $WORKER_NAME | awk '{print $1}')
if [ -z $pid ] ; then
rc=1
else
rc=$pid
fi
echo $rc
}
################################
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit $RETVAL