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
 
.. _upgrade:
 

	
 
=======
 
Upgrade
 
=======
 

	
 
Upgrading from PyPI (aka "Cheeseshop")
 
---------------------------------------
 

	
 
.. note::
 
   Firstly, it is recommended that you **always** perform a database and
 
   configuration backup before doing an upgrade.
 

	
 
   (These directions will use '{version}' to note that this is the version of
 
   Rhodecode that these files were used with.  If backing up your RhodeCode
 
   instance from version 1.3.6 to 1.4.0, the ``production.ini`` file would be
 
   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}
 

	
 

	
 
Ensure that you are using the Python Virtual Environment that you'd originally
 
installed Rhodecode in::
 

	
 
 pip freeze
 

	
 
will list all packages installed in the current environment.  If Rhodecode
 
isn't listed, change virtual environments to your venv location::
 

	
 
 source /opt/rhodecode-venv/bin/activate
 

	
 

	
 
Once you have verified the environment you can upgrade ``Rhodecode`` with::
 

	
 
 easy_install -U rhodecode
 

	
 
Or::
 
@@ -69,39 +69,39 @@ Read the changelog to see if there were 
 

	
 
The final step is to upgrade the database. To do this simply run::
 

	
 
 paster upgrade-db production.ini
 

	
 
This will upgrade the schema and update some of the defaults in the database,
 
and will always recheck the settings of the application, if there are no new
 
options that need to be set.
 

	
 

	
 
.. note::
 
   DB schema upgrade library has some limitations and can sometimes fail if you try to
 
   upgrade from older major releases. In such case simply run upgrades sequentially, eg.
 
   upgrading from 1.2.X to 1.5.X should be done like that: 1.2.X. > 1.3.X > 1.4.X > 1.5.X
 
   You can always specify what version of RhodeCode you want to install for example in pip
 
   `pip install RhodeCode==1.3.6`
 

	
 
You may find it helpful to clear out your log file so that new errors are
 
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::
 
   If you're using Celery, make sure you restart all instances of it after
 
   upgrade.
 

	
 
.. _virtualenv: http://pypi.python.org/pypi/virtualenv
 
.. _python: http://www.python.org/
 
.. _mercurial: http://mercurial.selenic.com/
 
.. _celery: http://celeryproject.org/
 
.. _rabbitmq: http://www.rabbitmq.com/
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
 

	
 
post-stop script
 
    rm -f $PIDFILE
 
end script
init.d/kallithea-daemon-arch
Show inline comments
 
file renamed from init.d/rhodecode-daemon4 to init.d/kallithea-daemon-arch
 
#!/bin/bash
 
###########################################
 
#### 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
 
RUN_AS="*****"
 

	
 
ARGS="serve --daemon \
 
--user=$RUN_AS \
 
--group=$RUN_AS \
 
--pid-file=$PID_FILE \
 
--log-file=$LOG_FILE \
 
$APP_PATH/$CONF_NAME"
 

	
 
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON
 

	
 
if [[ -r $PID_FILE ]]; then
 
    read -r PID < "$PID_FILE"
 
    if [[ $PID && ! -d /proc/$PID ]]; then
 
        unset PID
 
        rm_daemon $DAEMON
 
    fi
 
fi
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"
 
LOG_PATH="$APP_PATH/$APP_NAME.log"
 
 
 
PYTHON_PATH="/$APP_HOMEDIR/$APP_NAME-venv"
 
 
 
RUN_AS="root"
 
 
 
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"
 
 
 
 
 
start() {
 
  echo "Starting $APP_NAME"
 
  PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \
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 \
 
--pid-file=$PID_PATH \
 
--log-file=$LOG_PATH  $APP_PATH/$CONF_NAME"
 

	
 
#extra options
 
opts="${opts} restartdelay"
 

	
 
depend() {
 
    need nginx
 
}
 

	
 
start() {
 
    ebegin "Starting $APP_NAME"
 
    start-stop-daemon -d $APP_PATH -e PYTHON_EGG_CACHE="/tmp" \
 
        --start --quiet \
 
        --pidfile $PID_PATH \
 
        --user $RUN_AS \
 
        --exec $DAEMON -- $DAEMON_OPTS
 
    eend $?
init.d/kallithea-daemon-redhat
Show inline comments
 
file renamed from init.d/rhodecode-daemon3 to init.d/kallithea-daemon-redhat
 
#!/bin/sh
 
########################################
 
#### THIS IS A REDHAT INIT.D SCRIPT ####
 
########################################
 

	
 
##################################################
 
#
 
# RhodeCode server startup script
 
# 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
 

	
 
remove_pid () {
 
  rm -f ${PID_PATH}
 
  rmdir `dirname ${PID_PATH}`
 
}
 

	
 
ensure_pid_dir () {
 
  PID_DIR=`dirname ${PID_PATH}`
 
  if [ ! -d ${PID_DIR} ] ; then
 
    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
 
    ;;
 
esac
 

	
 
exit $RETVAL
 
\ No newline at end of file
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
 
; RhodeCode Supervisord
 
; ##########################
 
; for help see http://supervisord.org/configuration.html
 
; ##########################
 

	
 
[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]
 
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
 

	
 
[supervisorctl]
 
serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket
 
;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)