Changeset - 99ad9d0af1a3
[Not reviewed]
Bradley M. Kuhn - 11 years ago 2014-07-03 01:04:40
bkuhn@sfconservancy.org
Rename init scripts and fix references inside them
8 files changed with 47 insertions and 47 deletions:
0 comments (0 inline, 0 general)
docs/upgrade.rst
Show inline comments
 
@@ -17,13 +17,13 @@ Upgrading from PyPI (aka "Cheeseshop")
 
   backed up to ``production.ini.1-3-6``.)
 

	
 

	
 
If using a sqlite database, stop the Rhodecode process/daemon/service, and
 
then make a copy of the database file::
 

	
 
 service rhodecode stop
 
 service kallithea stop
 
 cp rhodecode.db rhodecode.db.{version}
 

	
 

	
 
Back up your configuration file::
 

	
 
 cp production.ini production.ini.{version}
 
@@ -87,13 +87,13 @@ You may find it helpful to clear out you
 
readily apparent::
 

	
 
 echo > rhodecode.log
 

	
 
Once that is complete, you may now start your upgraded Rhodecode Instance::
 

	
 
 service rhodecode start
 
 service kallithea start
 

	
 
Or::
 

	
 
 paster serve /var/www/rhodecode/production.ini
 

	
 
.. note::
init.d/celeryd-upstart.conf
Show inline comments
 
# celeryd - run the celeryd daemon as an upstart job for rhodecode
 
# celeryd - run the celeryd daemon as an upstart job for kallithea
 
# Change variables/paths as necessary and place file /etc/init/celeryd.conf
 
# start/stop/restart as normal upstart job (ie: $ start celeryd)
 

	
 
description	"Celery for RhodeCode Mercurial Server"
 
author		"Matt Zuba <matt.zuba@goodwillaz.org"
 

	
 
start on starting rhodecode
 
stop on stopped rhodecode
 
start on starting kallithea
 
stop on stopped kallithea
 

	
 
respawn
 

	
 
umask 0022
 

	
 
env PIDFILE=/tmp/celeryd.pid
 
env APPINI=/var/hg/rhodecode/production.ini
 
env APPINI=/var/hg/kallithea/production.ini
 
env HOME=/var/hg
 
env USER=hg
 
# To use group (if different from user), you must edit sudoers file and change
 
# root's entry from (ALL) to (ALL:ALL)
 
# env GROUP=hg
 

	
 
script
 
    COMMAND="/var/hg/.virtualenvs/rhodecode/bin/paster celeryd $APPINI --pidfile=$PIDFILE"
 
    COMMAND="/var/hg/.virtualenvs/kallithea/bin/paster celeryd $APPINI --pidfile=$PIDFILE"
 
    if [ -z "$GROUP" ]; then
 
        exec sudo -u $USER $COMMAND
 
    else
 
        exec sudo -u $USER -g $GROUP $COMMAND
 
    fi
 
end script
init.d/kallithea-daemon-arch
Show inline comments
 
file renamed from init.d/rhodecode-daemon4 to init.d/kallithea-daemon-arch
 
@@ -3,13 +3,13 @@
 
#### THIS IS AN ARCH LINUX RC.D SCRIPT ####
 
###########################################
 

	
 
. /etc/rc.conf
 
. /etc/rc.d/functions
 

	
 
DAEMON=rhodecode
 
DAEMON=kallithea
 
APP_HOMEDIR="/srv"
 
APP_PATH="$APP_HOMEDIR/$DAEMON"
 
CONF_NAME="production.ini"
 
LOG_FILE="/var/log/$DAEMON.log"
 
PID_FILE="/run/daemons/$DAEMON"
 
APPL=/usr/bin/paster
init.d/kallithea-daemon-debian
Show inline comments
 
file renamed from init.d/rhodecode-daemon2 to init.d/kallithea-daemon-debian
 
#!/bin/sh -e
 
########################################
 
#### THIS IS A DEBIAN INIT.D SCRIPT ####
 
########################################
 
 
 
### BEGIN INIT INFO
 
# Provides:          rhodecode          
 
# Provides:          kallithea          
 
# Required-Start:    $all
 
# Required-Stop:     $all
 
# Default-Start:     2 3 4 5
 
# Default-Stop:      0 1 6
 
# Short-Description: starts instance of rhodecode
 
# Description:       starts instance of rhodecode using start-stop-daemon
 
# Short-Description: starts instance of kallithea
 
# Description:       starts instance of kallithea using start-stop-daemon
 
### END INIT INFO
 
 
 
APP_NAME="rhodecode"
 
APP_NAME="kallithea"
 
APP_HOMEDIR="opt"
 
APP_PATH="/$APP_HOMEDIR/$APP_NAME"
 
 
 
CONF_NAME="production.ini"
 
 
 
PID_PATH="$APP_PATH/$APP_NAME.pid"
init.d/kallithea-daemon-gentoo
Show inline comments
 
file renamed from init.d/rhodecode-daemon to init.d/kallithea-daemon-gentoo
 
#!/sbin/runscript
 
########################################
 
#### THIS IS AN GENTOO INIT.D SCRIPT####
 
########################################
 

	
 
APP_NAME="rhodecode"
 
APP_HOMEDIR="marcink/python_workspace"
 
APP_NAME="kallithea"
 
APP_HOMEDIR="username/python_workspace"
 
APP_PATH="/home/$APP_HOMEDIR/$APP_NAME"
 

	
 
CONF_NAME="production.ini"
 

	
 
PID_PATH="$APP_PATH/$APP_NAME.pid"
 
LOG_PATH="$APP_PATH/$APP_NAME.log"
 

	
 
PYTHON_PATH="/home/$APP_HOMEDIR/v-env"
 

	
 
RUN_AS="marcink"
 
RUN_AS="username"
 

	
 
DAEMON="$PYTHON_PATH/bin/paster"
 

	
 
DAEMON_OPTS="serve --daemon \
 
--user=$RUN_AS \
 
--group=$RUN_AS \
init.d/kallithea-daemon-redhat
Show inline comments
 
file renamed from init.d/rhodecode-daemon3 to init.d/kallithea-daemon-redhat
 
@@ -9,40 +9,40 @@
 
# Recommended default-startup: 2 3 4 5
 
# Recommended default-stop: 0 1 6
 
#
 
##################################################
 

	
 

	
 
APP_NAME="rhodecode"
 
APP_NAME="kallithea"
 
# the location of your app
 
# since this is a web app, it should go in /var/www
 
APP_PATH="/var/www/$APP_NAME"
 

	
 
CONF_NAME="production.ini"
 

	
 
# write to wherever the PID should be stored, just ensure
 
# that the user you run paster as has the appropriate permissions
 
# same goes for the log file
 
PID_PATH="/var/run/rhodecode/pid"
 
LOG_PATH="/var/log/rhodecode/rhodecode.log"
 
PID_PATH="/var/run/kallithea/pid"
 
LOG_PATH="/var/log/kallithea/kallithea.log"
 

	
 
# replace this with the path to the virtual environment you
 
# made for RhodeCode
 
PYTHON_PATH="/opt/python_virtualenvironments/rhodecode-venv"
 
PYTHON_PATH="/opt/python_virtualenvironments/kallithea-venv"
 

	
 
RUN_AS="rhodecode"
 
RUN_AS="kallithea"
 

	
 
DAEMON="$PYTHON_PATH/bin/paster"
 

	
 
DAEMON_OPTS="serve --daemon \
 
    --user=$RUN_AS \
 
    --group=$RUN_AS \
 
    --pid-file=$PID_PATH \
 
    --log-file=$LOG_PATH $APP_PATH/$CONF_NAME"
 

	
 
DESC="rhodecode-server"
 
DESC="kallithea-server"
 
LOCK_FILE="/var/lock/subsys/$APP_NAME"
 

	
 
# source CentOS init functions
 
. /etc/init.d/functions
 

	
 
RETVAL=0
 
@@ -58,72 +58,72 @@ ensure_pid_dir () {
 
    mkdir -p ${PID_DIR}
 
    chown -R ${RUN_AS}:${RUN_AS} ${PID_DIR}
 
    chmod 755 ${PID_DIR}
 
  fi
 
}
 

	
 
start_rhodecode () {
 
start_kallithea () {
 
    ensure_pid_dir
 
    PYTHON_EGG_CACHE="/tmp" daemon --pidfile $PID_PATH \
 
        --user $RUN_AS "$DAEMON $DAEMON_OPTS"
 
    RETVAL=$?
 
    [ $RETVAL -eq 0 ] && touch $LOCK_FILE
 
    return $RETVAL
 
}
 

	
 
stop_rhodecode () {
 
stop_kallithea () {
 
    if [ -e $LOCK_FILE ]; then
 
      killproc -p $PID_PATH
 
      RETVAL=$?
 
      rm -f $LOCK_FILE
 
      rm -f $PID_PATH
 
    else
 
      RETVAL=1
 
    fi
 
    return $RETVAL
 
}
 

	
 
status_rhodecode() {
 
status_kallithea() {
 
  if [ -e $LOCK_FILE ]; then
 
    # exit with non-zero to indicate failure
 
    RETVAL=1
 
  else
 
    RETVAL=0
 
  fi
 
  return $RETVAL
 
}
 

	
 
restart_rhodecode () {
 
    stop_rhodecode
 
    start_rhodecode
 
restart_kallithea () {
 
    stop_kallithea
 
    start_kallithea
 
    RETVAL=$?
 
}
 

	
 
case "$1" in
 
  start)
 
    echo -n $"Starting $DESC: "
 
    start_rhodecode
 
    start_kallithea
 
    echo
 
    ;;
 
  stop)
 
    echo -n $"Stopping $DESC: "
 
    stop_rhodecode
 
    stop_kallithea
 
    echo
 
    ;;
 
  status)
 
    status_rhodecode
 
    status_kallithea
 
    RETVAL=$?
 
    if [ ! $RETVAL -eq 0 ]; then
 
      echo "RhodeCode server is running..."
 
    else
 
      echo "RhodeCode server is stopped."
 
    fi
 
    ;;
 
  restart)
 
    echo -n $"Restarting $DESC: "
 
    restart_rhodecode
 
    restart_kallithea
 
    echo
 
    ;;
 
  *)
 
    echo $"Usage: $0 {start|stop|restart|status}"
 
    RETVAL=1
 
    ;;
init.d/kallithea-upstart.conf
Show inline comments
 
file renamed from init.d/rhodecode-upstart.conf to init.d/kallithea-upstart.conf
 
# rhodecode - run the rhodecode daemon as an upstart job
 
# Change variables/paths as necessary and place file /etc/init/rhodecode.conf
 
# start/stop/restart as normal upstart job (ie: $ start rhodecode)
 
# kallithea - run the kallithea daemon as an upstart job
 
# Change variables/paths as necessary and place file /etc/init/kallithea.conf
 
# start/stop/restart as normal upstart job (ie: $ start kallithea)
 

	
 
description	"RhodeCode Mercurial Server"
 
author		"Matt Zuba <matt.zuba@goodwillaz.org"
 

	
 
start on (local-filesystems and runlevel [2345])
 
stop on runlevel [!2345]
 

	
 
respawn
 

	
 
umask 0022
 

	
 
env PIDFILE=/var/hg/rhodecode/rhodecode.pid
 
env LOGFILE=/var/hg/rhodecode/log/rhodecode.log
 
env APPINI=/var/hg/rhodecode/production.ini
 
env PIDFILE=/var/hg/kallithea/kallithea.pid
 
env LOGFILE=/var/hg/kallithea/log/kallithea.log
 
env APPINI=/var/hg/kallithea/production.ini
 
env HOME=/var/hg
 
env USER=hg
 
env GROUP=hg
 

	
 
exec /var/hg/.virtualenvs/rhodecode/bin/paster serve --user=$USER --group=$GROUP --pid-file=$PIDFILE --log-file=$LOGFILE $APPINI
 
exec /var/hg/.virtualenvs/kallithea/bin/paster serve --user=$USER --group=$GROUP --pid-file=$PIDFILE --log-file=$LOGFILE $APPINI
 

	
 
post-stop script
 
	rm -f $PIDFILE
 
end script
init.d/supervisord.conf
Show inline comments
 
@@ -6,27 +6,27 @@
 
[inet_http_server]         ; inet (TCP) server disabled by default
 
port=127.0.0.1:9001        ; (ip_address:port specifier, *:port for all iface)
 
;username=user              ; (default is no username (open server))
 
;password=123               ; (default is no password (open server))
 

	
 
[supervisord]
 
logfile=/%(here)s/supervisord_rhodecode.log ; (main log file;default $CWD/supervisord.log)
 
logfile=/%(here)s/supervisord_kallithea.log ; (main log file;default $CWD/supervisord.log)
 
logfile_maxbytes=50MB        ; (max main logfile bytes b4 rotation;default 50MB)
 
logfile_backups=10           ; (num of main logfile rotation backups;default 10)
 
loglevel=info                ; (log level;default info; others: debug,warn,trace)
 
pidfile=/%(here)s/supervisord_rhodecode.pid ; (supervisord pidfile;default supervisord.pid)
 
pidfile=/%(here)s/supervisord_kallithea.pid ; (supervisord pidfile;default supervisord.pid)
 
nodaemon=true               ; (start in foreground if true;default false)
 
minfds=1024                  ; (min. avail startup file descriptors;default 1024)
 
minprocs=200                 ; (min. avail process descriptors;default 200)
 
umask=022                    ; (process file creation umask;default 022)
 
user=marcink                  ; (default is current user, required if root)
 
user=username                  ; (default is current user, required if root)
 
;identifier=supervisor       ; (supervisord identifier, default is 'supervisor')
 
;directory=/tmp              ; (default is not to cd during start)
 
;nocleanup=true              ; (don't clean up tempfiles at start;default false)
 
;childlogdir=/tmp            ; ('AUTO' child log dir, default $TEMP)
 
environment=HOME=/home/marcink       ; (key value pairs to add to environment)
 
environment=HOME=/home/username       ; (key value pairs to add to environment)
 
;strip_ansi=false            ; (strip ansi escape codes in logs; def. false)
 

	
 
; the below section must remain in the config file for RPC
 
; (supervisorctl/web interface) to work, additional interfaces may be
 
; added by defining them in separate rpcinterface: sections
 
[rpcinterface:supervisor]
 
@@ -37,15 +37,15 @@ serverurl=http://127.0.0.1:9001 ; use an
 
;username=user               ; should be same as http_username if set
 
;password=123                ; should be same as http_password if set
 
;prompt=mysupervisor         ; cmd line prompt (default "supervisor")
 
;history_file=~/.sc_history  ; use readline history if available
 

	
 

	
 
; restart with supervisorctl restart rhodecode:*
 
[program:rhodecode]
 
; restart with supervisorctl restart kallithea:*
 
[program:kallithea]
 
numprocs = 1
 
numprocs_start = 5000 # possible should match ports
 
directory=/home/marcink/rhodecode-dir
 
command = /home/marcink/v-env/bin/paster serve rc.ini
 
directory=/home/username/kallithea-dir
 
command = /home/username/v-env/bin/paster serve rc.ini
 
process_name = %(program_name)s_%(process_num)04d
 
redirect_stderr=true 
 
stdout_logfile=/%(here)s/rhodecode.log 
 
\ No newline at end of file
 
stdout_logfile=/%(here)s/kallithea.log 
 
\ No newline at end of file
0 comments (0 inline, 0 general)