Show More
@@ -1,107 +1,107 b'' | |||||
1 | .. _upgrade: |
|
1 | .. _upgrade: | |
2 |
|
2 | |||
3 | ======= |
|
3 | ======= | |
4 | Upgrade |
|
4 | Upgrade | |
5 | ======= |
|
5 | ======= | |
6 |
|
6 | |||
7 | Upgrading from PyPI (aka "Cheeseshop") |
|
7 | Upgrading from PyPI (aka "Cheeseshop") | |
8 | --------------------------------------- |
|
8 | --------------------------------------- | |
9 |
|
9 | |||
10 | .. note:: |
|
10 | .. note:: | |
11 | Firstly, it is recommended that you **always** perform a database and |
|
11 | Firstly, it is recommended that you **always** perform a database and | |
12 | configuration backup before doing an upgrade. |
|
12 | configuration backup before doing an upgrade. | |
13 |
|
13 | |||
14 | (These directions will use '{version}' to note that this is the version of |
|
14 | (These directions will use '{version}' to note that this is the version of | |
15 | Rhodecode that these files were used with. If backing up your RhodeCode |
|
15 | Rhodecode that these files were used with. If backing up your RhodeCode | |
16 | instance from version 1.3.6 to 1.4.0, the ``production.ini`` file would be |
|
16 | instance from version 1.3.6 to 1.4.0, the ``production.ini`` file would be | |
17 | backed up to ``production.ini.1-3-6``.) |
|
17 | backed up to ``production.ini.1-3-6``.) | |
18 |
|
18 | |||
19 |
|
19 | |||
20 | If using a sqlite database, stop the Rhodecode process/daemon/service, and |
|
20 | If using a sqlite database, stop the Rhodecode process/daemon/service, and | |
21 | then make a copy of the database file:: |
|
21 | then make a copy of the database file:: | |
22 |
|
22 | |||
23 |
service |
|
23 | service kallithea stop | |
24 | cp rhodecode.db rhodecode.db.{version} |
|
24 | cp rhodecode.db rhodecode.db.{version} | |
25 |
|
25 | |||
26 |
|
26 | |||
27 | Back up your configuration file:: |
|
27 | Back up your configuration file:: | |
28 |
|
28 | |||
29 | cp production.ini production.ini.{version} |
|
29 | cp production.ini production.ini.{version} | |
30 |
|
30 | |||
31 |
|
31 | |||
32 | Ensure that you are using the Python Virtual Environment that you'd originally |
|
32 | Ensure that you are using the Python Virtual Environment that you'd originally | |
33 | installed Rhodecode in:: |
|
33 | installed Rhodecode in:: | |
34 |
|
34 | |||
35 | pip freeze |
|
35 | pip freeze | |
36 |
|
36 | |||
37 | will list all packages installed in the current environment. If Rhodecode |
|
37 | will list all packages installed in the current environment. If Rhodecode | |
38 | isn't listed, change virtual environments to your venv location:: |
|
38 | isn't listed, change virtual environments to your venv location:: | |
39 |
|
39 | |||
40 | source /opt/rhodecode-venv/bin/activate |
|
40 | source /opt/rhodecode-venv/bin/activate | |
41 |
|
41 | |||
42 |
|
42 | |||
43 | Once you have verified the environment you can upgrade ``Rhodecode`` with:: |
|
43 | Once you have verified the environment you can upgrade ``Rhodecode`` with:: | |
44 |
|
44 | |||
45 | easy_install -U rhodecode |
|
45 | easy_install -U rhodecode | |
46 |
|
46 | |||
47 | Or:: |
|
47 | Or:: | |
48 |
|
48 | |||
49 | pip install --upgrade rhodecode |
|
49 | pip install --upgrade rhodecode | |
50 |
|
50 | |||
51 |
|
51 | |||
52 | Then run the following command from the installation directory:: |
|
52 | Then run the following command from the installation directory:: | |
53 |
|
53 | |||
54 | paster make-config RhodeCode production.ini |
|
54 | paster make-config RhodeCode production.ini | |
55 |
|
55 | |||
56 | This will display any changes made by the new version of RhodeCode to your |
|
56 | This will display any changes made by the new version of RhodeCode to your | |
57 | current configuration. It will try to perform an automerge. It's recommended |
|
57 | current configuration. It will try to perform an automerge. It's recommended | |
58 | that you re-check the content after the automerge. |
|
58 | that you re-check the content after the automerge. | |
59 |
|
59 | |||
60 | .. note:: |
|
60 | .. note:: | |
61 | Please always make sure your .ini files are up to date. Often errors are |
|
61 | Please always make sure your .ini files are up to date. Often errors are | |
62 | caused by missing params added in new versions. |
|
62 | caused by missing params added in new versions. | |
63 |
|
63 | |||
64 |
|
64 | |||
65 | It is also recommended that you rebuild the whoosh index after upgrading since |
|
65 | It is also recommended that you rebuild the whoosh index after upgrading since | |
66 | the new whoosh version could introduce some incompatible index changes. Please |
|
66 | the new whoosh version could introduce some incompatible index changes. Please | |
67 | Read the changelog to see if there were any changes to whoosh. |
|
67 | Read the changelog to see if there were any changes to whoosh. | |
68 |
|
68 | |||
69 |
|
69 | |||
70 | The final step is to upgrade the database. To do this simply run:: |
|
70 | The final step is to upgrade the database. To do this simply run:: | |
71 |
|
71 | |||
72 | paster upgrade-db production.ini |
|
72 | paster upgrade-db production.ini | |
73 |
|
73 | |||
74 | This will upgrade the schema and update some of the defaults in the database, |
|
74 | This will upgrade the schema and update some of the defaults in the database, | |
75 | and will always recheck the settings of the application, if there are no new |
|
75 | and will always recheck the settings of the application, if there are no new | |
76 | options that need to be set. |
|
76 | options that need to be set. | |
77 |
|
77 | |||
78 |
|
78 | |||
79 | .. note:: |
|
79 | .. note:: | |
80 | DB schema upgrade library has some limitations and can sometimes fail if you try to |
|
80 | DB schema upgrade library has some limitations and can sometimes fail if you try to | |
81 | upgrade from older major releases. In such case simply run upgrades sequentially, eg. |
|
81 | upgrade from older major releases. In such case simply run upgrades sequentially, eg. | |
82 | 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 |
|
82 | 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 | |
83 | You can always specify what version of RhodeCode you want to install for example in pip |
|
83 | You can always specify what version of RhodeCode you want to install for example in pip | |
84 | `pip install RhodeCode==1.3.6` |
|
84 | `pip install RhodeCode==1.3.6` | |
85 |
|
85 | |||
86 | You may find it helpful to clear out your log file so that new errors are |
|
86 | You may find it helpful to clear out your log file so that new errors are | |
87 | readily apparent:: |
|
87 | readily apparent:: | |
88 |
|
88 | |||
89 | echo > rhodecode.log |
|
89 | echo > rhodecode.log | |
90 |
|
90 | |||
91 | Once that is complete, you may now start your upgraded Rhodecode Instance:: |
|
91 | Once that is complete, you may now start your upgraded Rhodecode Instance:: | |
92 |
|
92 | |||
93 |
service |
|
93 | service kallithea start | |
94 |
|
94 | |||
95 | Or:: |
|
95 | Or:: | |
96 |
|
96 | |||
97 | paster serve /var/www/rhodecode/production.ini |
|
97 | paster serve /var/www/rhodecode/production.ini | |
98 |
|
98 | |||
99 | .. note:: |
|
99 | .. note:: | |
100 | If you're using Celery, make sure you restart all instances of it after |
|
100 | If you're using Celery, make sure you restart all instances of it after | |
101 | upgrade. |
|
101 | upgrade. | |
102 |
|
102 | |||
103 | .. _virtualenv: http://pypi.python.org/pypi/virtualenv |
|
103 | .. _virtualenv: http://pypi.python.org/pypi/virtualenv | |
104 | .. _python: http://www.python.org/ |
|
104 | .. _python: http://www.python.org/ | |
105 | .. _mercurial: http://mercurial.selenic.com/ |
|
105 | .. _mercurial: http://mercurial.selenic.com/ | |
106 | .. _celery: http://celeryproject.org/ |
|
106 | .. _celery: http://celeryproject.org/ | |
107 | .. _rabbitmq: http://www.rabbitmq.com/ |
|
107 | .. _rabbitmq: http://www.rabbitmq.com/ |
@@ -1,34 +1,34 b'' | |||||
1 |
# celeryd - run the celeryd daemon as an upstart job for |
|
1 | # celeryd - run the celeryd daemon as an upstart job for kallithea | |
2 | # Change variables/paths as necessary and place file /etc/init/celeryd.conf |
|
2 | # Change variables/paths as necessary and place file /etc/init/celeryd.conf | |
3 | # start/stop/restart as normal upstart job (ie: $ start celeryd) |
|
3 | # start/stop/restart as normal upstart job (ie: $ start celeryd) | |
4 |
|
4 | |||
5 | description "Celery for RhodeCode Mercurial Server" |
|
5 | description "Celery for RhodeCode Mercurial Server" | |
6 | author "Matt Zuba <matt.zuba@goodwillaz.org" |
|
6 | author "Matt Zuba <matt.zuba@goodwillaz.org" | |
7 |
|
7 | |||
8 |
start on starting |
|
8 | start on starting kallithea | |
9 |
stop on stopped |
|
9 | stop on stopped kallithea | |
10 |
|
10 | |||
11 | respawn |
|
11 | respawn | |
12 |
|
12 | |||
13 | umask 0022 |
|
13 | umask 0022 | |
14 |
|
14 | |||
15 | env PIDFILE=/tmp/celeryd.pid |
|
15 | env PIDFILE=/tmp/celeryd.pid | |
16 |
env APPINI=/var/hg/ |
|
16 | env APPINI=/var/hg/kallithea/production.ini | |
17 | env HOME=/var/hg |
|
17 | env HOME=/var/hg | |
18 | env USER=hg |
|
18 | env USER=hg | |
19 | # To use group (if different from user), you must edit sudoers file and change |
|
19 | # To use group (if different from user), you must edit sudoers file and change | |
20 | # root's entry from (ALL) to (ALL:ALL) |
|
20 | # root's entry from (ALL) to (ALL:ALL) | |
21 | # env GROUP=hg |
|
21 | # env GROUP=hg | |
22 |
|
22 | |||
23 | script |
|
23 | script | |
24 |
COMMAND="/var/hg/.virtualenvs/ |
|
24 | COMMAND="/var/hg/.virtualenvs/kallithea/bin/paster celeryd $APPINI --pidfile=$PIDFILE" | |
25 | if [ -z "$GROUP" ]; then |
|
25 | if [ -z "$GROUP" ]; then | |
26 | exec sudo -u $USER $COMMAND |
|
26 | exec sudo -u $USER $COMMAND | |
27 | else |
|
27 | else | |
28 | exec sudo -u $USER -g $GROUP $COMMAND |
|
28 | exec sudo -u $USER -g $GROUP $COMMAND | |
29 | fi |
|
29 | fi | |
30 | end script |
|
30 | end script | |
31 |
|
31 | |||
32 | post-stop script |
|
32 | post-stop script | |
33 | rm -f $PIDFILE |
|
33 | rm -f $PIDFILE | |
34 | end script |
|
34 | end script |
@@ -1,70 +1,70 b'' | |||||
1 | #!/bin/bash |
|
1 | #!/bin/bash | |
2 | ########################################### |
|
2 | ########################################### | |
3 | #### THIS IS AN ARCH LINUX RC.D SCRIPT #### |
|
3 | #### THIS IS AN ARCH LINUX RC.D SCRIPT #### | |
4 | ########################################### |
|
4 | ########################################### | |
5 |
|
5 | |||
6 | . /etc/rc.conf |
|
6 | . /etc/rc.conf | |
7 | . /etc/rc.d/functions |
|
7 | . /etc/rc.d/functions | |
8 |
|
8 | |||
9 | DAEMON=rhodecode |
|
9 | DAEMON=kallithea | |
10 | APP_HOMEDIR="/srv" |
|
10 | APP_HOMEDIR="/srv" | |
11 | APP_PATH="$APP_HOMEDIR/$DAEMON" |
|
11 | APP_PATH="$APP_HOMEDIR/$DAEMON" | |
12 | CONF_NAME="production.ini" |
|
12 | CONF_NAME="production.ini" | |
13 | LOG_FILE="/var/log/$DAEMON.log" |
|
13 | LOG_FILE="/var/log/$DAEMON.log" | |
14 | PID_FILE="/run/daemons/$DAEMON" |
|
14 | PID_FILE="/run/daemons/$DAEMON" | |
15 | APPL=/usr/bin/paster |
|
15 | APPL=/usr/bin/paster | |
16 | RUN_AS="*****" |
|
16 | RUN_AS="*****" | |
17 |
|
17 | |||
18 | ARGS="serve --daemon \ |
|
18 | ARGS="serve --daemon \ | |
19 | --user=$RUN_AS \ |
|
19 | --user=$RUN_AS \ | |
20 | --group=$RUN_AS \ |
|
20 | --group=$RUN_AS \ | |
21 | --pid-file=$PID_FILE \ |
|
21 | --pid-file=$PID_FILE \ | |
22 | --log-file=$LOG_FILE \ |
|
22 | --log-file=$LOG_FILE \ | |
23 | $APP_PATH/$CONF_NAME" |
|
23 | $APP_PATH/$CONF_NAME" | |
24 |
|
24 | |||
25 | [ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON |
|
25 | [ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON | |
26 |
|
26 | |||
27 | if [[ -r $PID_FILE ]]; then |
|
27 | if [[ -r $PID_FILE ]]; then | |
28 | read -r PID < "$PID_FILE" |
|
28 | read -r PID < "$PID_FILE" | |
29 | if [[ $PID && ! -d /proc/$PID ]]; then |
|
29 | if [[ $PID && ! -d /proc/$PID ]]; then | |
30 | unset PID |
|
30 | unset PID | |
31 | rm_daemon $DAEMON |
|
31 | rm_daemon $DAEMON | |
32 | fi |
|
32 | fi | |
33 | fi |
|
33 | fi | |
34 |
|
34 | |||
35 | case "$1" in |
|
35 | case "$1" in | |
36 | start) |
|
36 | start) | |
37 | stat_busy "Starting $DAEMON" |
|
37 | stat_busy "Starting $DAEMON" | |
38 | export HOME=$APP_PATH |
|
38 | export HOME=$APP_PATH | |
39 | [ -z "$PID" ] && $APPL $ARGS &>/dev/null |
|
39 | [ -z "$PID" ] && $APPL $ARGS &>/dev/null | |
40 | if [ $? = 0 ]; then |
|
40 | if [ $? = 0 ]; then | |
41 | add_daemon $DAEMON |
|
41 | add_daemon $DAEMON | |
42 | stat_done |
|
42 | stat_done | |
43 | else |
|
43 | else | |
44 | stat_fail |
|
44 | stat_fail | |
45 | exit 1 |
|
45 | exit 1 | |
46 | fi |
|
46 | fi | |
47 | ;; |
|
47 | ;; | |
48 | stop) |
|
48 | stop) | |
49 | stat_busy "Stopping $DAEMON" |
|
49 | stat_busy "Stopping $DAEMON" | |
50 | [ -n "$PID" ] && kill $PID &>/dev/null |
|
50 | [ -n "$PID" ] && kill $PID &>/dev/null | |
51 | if [ $? = 0 ]; then |
|
51 | if [ $? = 0 ]; then | |
52 | rm_daemon $DAEMON |
|
52 | rm_daemon $DAEMON | |
53 | stat_done |
|
53 | stat_done | |
54 | else |
|
54 | else | |
55 | stat_fail |
|
55 | stat_fail | |
56 | exit 1 |
|
56 | exit 1 | |
57 | fi |
|
57 | fi | |
58 | ;; |
|
58 | ;; | |
59 | restart) |
|
59 | restart) | |
60 | $0 stop |
|
60 | $0 stop | |
61 | sleep 1 |
|
61 | sleep 1 | |
62 | $0 start |
|
62 | $0 start | |
63 | ;; |
|
63 | ;; | |
64 | status) |
|
64 | status) | |
65 | stat_busy "Checking $name status"; |
|
65 | stat_busy "Checking $name status"; | |
66 | ck_status $name |
|
66 | ck_status $name | |
67 | ;; |
|
67 | ;; | |
68 | *) |
|
68 | *) | |
69 | echo "usage: $0 {start|stop|restart|status}" |
|
69 | echo "usage: $0 {start|stop|restart|status}" | |
70 | esac No newline at end of file |
|
70 | esac |
@@ -1,90 +1,90 b'' | |||||
1 | #!/bin/sh -e |
|
1 | #!/bin/sh -e | |
2 | ######################################## |
|
2 | ######################################## | |
3 | #### THIS IS A DEBIAN INIT.D SCRIPT #### |
|
3 | #### THIS IS A DEBIAN INIT.D SCRIPT #### | |
4 | ######################################## |
|
4 | ######################################## | |
5 |
|
5 | |||
6 | ### BEGIN INIT INFO |
|
6 | ### BEGIN INIT INFO | |
7 |
# Provides: |
|
7 | # Provides: kallithea | |
8 | # Required-Start: $all |
|
8 | # Required-Start: $all | |
9 | # Required-Stop: $all |
|
9 | # Required-Stop: $all | |
10 | # Default-Start: 2 3 4 5 |
|
10 | # Default-Start: 2 3 4 5 | |
11 | # Default-Stop: 0 1 6 |
|
11 | # Default-Stop: 0 1 6 | |
12 |
# Short-Description: starts instance of |
|
12 | # Short-Description: starts instance of kallithea | |
13 |
# Description: starts instance of |
|
13 | # Description: starts instance of kallithea using start-stop-daemon | |
14 | ### END INIT INFO |
|
14 | ### END INIT INFO | |
15 |
|
15 | |||
16 |
APP_NAME=" |
|
16 | APP_NAME="kallithea" | |
17 | APP_HOMEDIR="opt" |
|
17 | APP_HOMEDIR="opt" | |
18 | APP_PATH="/$APP_HOMEDIR/$APP_NAME" |
|
18 | APP_PATH="/$APP_HOMEDIR/$APP_NAME" | |
19 |
|
19 | |||
20 | CONF_NAME="production.ini" |
|
20 | CONF_NAME="production.ini" | |
21 |
|
21 | |||
22 | PID_PATH="$APP_PATH/$APP_NAME.pid" |
|
22 | PID_PATH="$APP_PATH/$APP_NAME.pid" | |
23 | LOG_PATH="$APP_PATH/$APP_NAME.log" |
|
23 | LOG_PATH="$APP_PATH/$APP_NAME.log" | |
24 |
|
24 | |||
25 | PYTHON_PATH="/$APP_HOMEDIR/$APP_NAME-venv" |
|
25 | PYTHON_PATH="/$APP_HOMEDIR/$APP_NAME-venv" | |
26 |
|
26 | |||
27 | RUN_AS="root" |
|
27 | RUN_AS="root" | |
28 |
|
28 | |||
29 | DAEMON="$PYTHON_PATH/bin/paster" |
|
29 | DAEMON="$PYTHON_PATH/bin/paster" | |
30 |
|
30 | |||
31 | DAEMON_OPTS="serve --daemon \ |
|
31 | DAEMON_OPTS="serve --daemon \ | |
32 | --user=$RUN_AS \ |
|
32 | --user=$RUN_AS \ | |
33 | --group=$RUN_AS \ |
|
33 | --group=$RUN_AS \ | |
34 | --pid-file=$PID_PATH \ |
|
34 | --pid-file=$PID_PATH \ | |
35 | --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" |
|
35 | --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" | |
36 |
|
36 | |||
37 |
|
37 | |||
38 | start() { |
|
38 | start() { | |
39 | echo "Starting $APP_NAME" |
|
39 | echo "Starting $APP_NAME" | |
40 | PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \ |
|
40 | PYTHON_EGG_CACHE="/tmp" start-stop-daemon -d $APP_PATH \ | |
41 | --start --quiet \ |
|
41 | --start --quiet \ | |
42 | --pidfile $PID_PATH \ |
|
42 | --pidfile $PID_PATH \ | |
43 | --user $RUN_AS \ |
|
43 | --user $RUN_AS \ | |
44 | --exec $DAEMON -- $DAEMON_OPTS |
|
44 | --exec $DAEMON -- $DAEMON_OPTS | |
45 | } |
|
45 | } | |
46 |
|
46 | |||
47 | stop() { |
|
47 | stop() { | |
48 | echo "Stopping $APP_NAME" |
|
48 | echo "Stopping $APP_NAME" | |
49 | start-stop-daemon -d $APP_PATH \ |
|
49 | start-stop-daemon -d $APP_PATH \ | |
50 | --stop --quiet \ |
|
50 | --stop --quiet \ | |
51 | --pidfile $PID_PATH || echo "$APP_NAME - Not running!" |
|
51 | --pidfile $PID_PATH || echo "$APP_NAME - Not running!" | |
52 |
|
52 | |||
53 | if [ -f $PID_PATH ]; then |
|
53 | if [ -f $PID_PATH ]; then | |
54 | rm $PID_PATH |
|
54 | rm $PID_PATH | |
55 | fi |
|
55 | fi | |
56 | } |
|
56 | } | |
57 |
|
57 | |||
58 | status() { |
|
58 | status() { | |
59 | echo -n "Checking status of $APP_NAME ... " |
|
59 | echo -n "Checking status of $APP_NAME ... " | |
60 | pid=`cat $PID_PATH` |
|
60 | pid=`cat $PID_PATH` | |
61 | status=`ps ax | grep $pid | grep -ve grep` |
|
61 | status=`ps ax | grep $pid | grep -ve grep` | |
62 | if [ "$?" -eq 0 ]; then |
|
62 | if [ "$?" -eq 0 ]; then | |
63 | echo "running" |
|
63 | echo "running" | |
64 | else |
|
64 | else | |
65 | echo "NOT running" |
|
65 | echo "NOT running" | |
66 | fi |
|
66 | fi | |
67 | } |
|
67 | } | |
68 |
|
68 | |||
69 | case "$1" in |
|
69 | case "$1" in | |
70 | status) |
|
70 | status) | |
71 | status |
|
71 | status | |
72 | ;; |
|
72 | ;; | |
73 | start) |
|
73 | start) | |
74 | start |
|
74 | start | |
75 | ;; |
|
75 | ;; | |
76 | stop) |
|
76 | stop) | |
77 | stop |
|
77 | stop | |
78 | ;; |
|
78 | ;; | |
79 | restart) |
|
79 | restart) | |
80 | echo "Restarting $APP_NAME" |
|
80 | echo "Restarting $APP_NAME" | |
81 | ### stop ### |
|
81 | ### stop ### | |
82 | stop |
|
82 | stop | |
83 | wait |
|
83 | wait | |
84 | ### start ### |
|
84 | ### start ### | |
85 | start |
|
85 | start | |
86 | ;; |
|
86 | ;; | |
87 | *) |
|
87 | *) | |
88 | echo "Usage: $0 {start|stop|restart}" |
|
88 | echo "Usage: $0 {start|stop|restart}" | |
89 | exit 1 |
|
89 | exit 1 | |
90 | esac No newline at end of file |
|
90 | esac |
@@ -1,61 +1,61 b'' | |||||
1 | #!/sbin/runscript |
|
1 | #!/sbin/runscript | |
2 | ######################################## |
|
2 | ######################################## | |
3 | #### THIS IS AN GENTOO INIT.D SCRIPT#### |
|
3 | #### THIS IS AN GENTOO INIT.D SCRIPT#### | |
4 | ######################################## |
|
4 | ######################################## | |
5 |
|
5 | |||
6 |
APP_NAME=" |
|
6 | APP_NAME="kallithea" | |
7 |
APP_HOMEDIR=" |
|
7 | APP_HOMEDIR="username/python_workspace" | |
8 | APP_PATH="/home/$APP_HOMEDIR/$APP_NAME" |
|
8 | APP_PATH="/home/$APP_HOMEDIR/$APP_NAME" | |
9 |
|
9 | |||
10 | CONF_NAME="production.ini" |
|
10 | CONF_NAME="production.ini" | |
11 |
|
11 | |||
12 | PID_PATH="$APP_PATH/$APP_NAME.pid" |
|
12 | PID_PATH="$APP_PATH/$APP_NAME.pid" | |
13 | LOG_PATH="$APP_PATH/$APP_NAME.log" |
|
13 | LOG_PATH="$APP_PATH/$APP_NAME.log" | |
14 |
|
14 | |||
15 | PYTHON_PATH="/home/$APP_HOMEDIR/v-env" |
|
15 | PYTHON_PATH="/home/$APP_HOMEDIR/v-env" | |
16 |
|
16 | |||
17 |
RUN_AS=" |
|
17 | RUN_AS="username" | |
18 |
|
18 | |||
19 | DAEMON="$PYTHON_PATH/bin/paster" |
|
19 | DAEMON="$PYTHON_PATH/bin/paster" | |
20 |
|
20 | |||
21 | DAEMON_OPTS="serve --daemon \ |
|
21 | DAEMON_OPTS="serve --daemon \ | |
22 | --user=$RUN_AS \ |
|
22 | --user=$RUN_AS \ | |
23 | --group=$RUN_AS \ |
|
23 | --group=$RUN_AS \ | |
24 | --pid-file=$PID_PATH \ |
|
24 | --pid-file=$PID_PATH \ | |
25 | --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" |
|
25 | --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" | |
26 |
|
26 | |||
27 | #extra options |
|
27 | #extra options | |
28 | opts="${opts} restartdelay" |
|
28 | opts="${opts} restartdelay" | |
29 |
|
29 | |||
30 | depend() { |
|
30 | depend() { | |
31 | need nginx |
|
31 | need nginx | |
32 | } |
|
32 | } | |
33 |
|
33 | |||
34 | start() { |
|
34 | start() { | |
35 | ebegin "Starting $APP_NAME" |
|
35 | ebegin "Starting $APP_NAME" | |
36 | start-stop-daemon -d $APP_PATH -e PYTHON_EGG_CACHE="/tmp" \ |
|
36 | start-stop-daemon -d $APP_PATH -e PYTHON_EGG_CACHE="/tmp" \ | |
37 | --start --quiet \ |
|
37 | --start --quiet \ | |
38 | --pidfile $PID_PATH \ |
|
38 | --pidfile $PID_PATH \ | |
39 | --user $RUN_AS \ |
|
39 | --user $RUN_AS \ | |
40 | --exec $DAEMON -- $DAEMON_OPTS |
|
40 | --exec $DAEMON -- $DAEMON_OPTS | |
41 | eend $? |
|
41 | eend $? | |
42 | } |
|
42 | } | |
43 |
|
43 | |||
44 | stop() { |
|
44 | stop() { | |
45 | ebegin "Stopping $APP_NAME" |
|
45 | ebegin "Stopping $APP_NAME" | |
46 | start-stop-daemon -d $APP_PATH \ |
|
46 | start-stop-daemon -d $APP_PATH \ | |
47 | --stop --quiet \ |
|
47 | --stop --quiet \ | |
48 | --pidfile $PID_PATH || echo "$APP_NAME - Not running!" |
|
48 | --pidfile $PID_PATH || echo "$APP_NAME - Not running!" | |
49 | if [ -f $PID_PATH ]; then |
|
49 | if [ -f $PID_PATH ]; then | |
50 | rm $PID_PATH |
|
50 | rm $PID_PATH | |
51 | fi |
|
51 | fi | |
52 | eend $? |
|
52 | eend $? | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | restartdelay() { |
|
55 | restartdelay() { | |
56 | #stop() |
|
56 | #stop() | |
57 | echo "sleep3" |
|
57 | echo "sleep3" | |
58 | sleep 3 |
|
58 | sleep 3 | |
59 |
|
59 | |||
60 | #start() |
|
60 | #start() | |
61 | } |
|
61 | } |
@@ -1,132 +1,132 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 | ######################################## |
|
2 | ######################################## | |
3 | #### THIS IS A REDHAT INIT.D SCRIPT #### |
|
3 | #### THIS IS A REDHAT INIT.D SCRIPT #### | |
4 | ######################################## |
|
4 | ######################################## | |
5 |
|
5 | |||
6 | ################################################## |
|
6 | ################################################## | |
7 | # |
|
7 | # | |
8 | # RhodeCode server startup script |
|
8 | # RhodeCode server startup script | |
9 | # Recommended default-startup: 2 3 4 5 |
|
9 | # Recommended default-startup: 2 3 4 5 | |
10 | # Recommended default-stop: 0 1 6 |
|
10 | # Recommended default-stop: 0 1 6 | |
11 | # |
|
11 | # | |
12 | ################################################## |
|
12 | ################################################## | |
13 |
|
13 | |||
14 |
|
14 | |||
15 |
APP_NAME=" |
|
15 | APP_NAME="kallithea" | |
16 | # the location of your app |
|
16 | # the location of your app | |
17 | # since this is a web app, it should go in /var/www |
|
17 | # since this is a web app, it should go in /var/www | |
18 | APP_PATH="/var/www/$APP_NAME" |
|
18 | APP_PATH="/var/www/$APP_NAME" | |
19 |
|
19 | |||
20 | CONF_NAME="production.ini" |
|
20 | CONF_NAME="production.ini" | |
21 |
|
21 | |||
22 | # write to wherever the PID should be stored, just ensure |
|
22 | # write to wherever the PID should be stored, just ensure | |
23 | # that the user you run paster as has the appropriate permissions |
|
23 | # that the user you run paster as has the appropriate permissions | |
24 | # same goes for the log file |
|
24 | # same goes for the log file | |
25 |
PID_PATH="/var/run/ |
|
25 | PID_PATH="/var/run/kallithea/pid" | |
26 |
LOG_PATH="/var/log/ |
|
26 | LOG_PATH="/var/log/kallithea/kallithea.log" | |
27 |
|
27 | |||
28 | # replace this with the path to the virtual environment you |
|
28 | # replace this with the path to the virtual environment you | |
29 | # made for RhodeCode |
|
29 | # made for RhodeCode | |
30 |
PYTHON_PATH="/opt/python_virtualenvironments/ |
|
30 | PYTHON_PATH="/opt/python_virtualenvironments/kallithea-venv" | |
31 |
|
31 | |||
32 |
RUN_AS=" |
|
32 | RUN_AS="kallithea" | |
33 |
|
33 | |||
34 | DAEMON="$PYTHON_PATH/bin/paster" |
|
34 | DAEMON="$PYTHON_PATH/bin/paster" | |
35 |
|
35 | |||
36 | DAEMON_OPTS="serve --daemon \ |
|
36 | DAEMON_OPTS="serve --daemon \ | |
37 | --user=$RUN_AS \ |
|
37 | --user=$RUN_AS \ | |
38 | --group=$RUN_AS \ |
|
38 | --group=$RUN_AS \ | |
39 | --pid-file=$PID_PATH \ |
|
39 | --pid-file=$PID_PATH \ | |
40 | --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" |
|
40 | --log-file=$LOG_PATH $APP_PATH/$CONF_NAME" | |
41 |
|
41 | |||
42 |
DESC=" |
|
42 | DESC="kallithea-server" | |
43 | LOCK_FILE="/var/lock/subsys/$APP_NAME" |
|
43 | LOCK_FILE="/var/lock/subsys/$APP_NAME" | |
44 |
|
44 | |||
45 | # source CentOS init functions |
|
45 | # source CentOS init functions | |
46 | . /etc/init.d/functions |
|
46 | . /etc/init.d/functions | |
47 |
|
47 | |||
48 | RETVAL=0 |
|
48 | RETVAL=0 | |
49 |
|
49 | |||
50 | remove_pid () { |
|
50 | remove_pid () { | |
51 | rm -f ${PID_PATH} |
|
51 | rm -f ${PID_PATH} | |
52 | rmdir `dirname ${PID_PATH}` |
|
52 | rmdir `dirname ${PID_PATH}` | |
53 | } |
|
53 | } | |
54 |
|
54 | |||
55 | ensure_pid_dir () { |
|
55 | ensure_pid_dir () { | |
56 | PID_DIR=`dirname ${PID_PATH}` |
|
56 | PID_DIR=`dirname ${PID_PATH}` | |
57 | if [ ! -d ${PID_DIR} ] ; then |
|
57 | if [ ! -d ${PID_DIR} ] ; then | |
58 | mkdir -p ${PID_DIR} |
|
58 | mkdir -p ${PID_DIR} | |
59 | chown -R ${RUN_AS}:${RUN_AS} ${PID_DIR} |
|
59 | chown -R ${RUN_AS}:${RUN_AS} ${PID_DIR} | |
60 | chmod 755 ${PID_DIR} |
|
60 | chmod 755 ${PID_DIR} | |
61 | fi |
|
61 | fi | |
62 | } |
|
62 | } | |
63 |
|
63 | |||
64 |
start_ |
|
64 | start_kallithea () { | |
65 | ensure_pid_dir |
|
65 | ensure_pid_dir | |
66 | PYTHON_EGG_CACHE="/tmp" daemon --pidfile $PID_PATH \ |
|
66 | PYTHON_EGG_CACHE="/tmp" daemon --pidfile $PID_PATH \ | |
67 | --user $RUN_AS "$DAEMON $DAEMON_OPTS" |
|
67 | --user $RUN_AS "$DAEMON $DAEMON_OPTS" | |
68 | RETVAL=$? |
|
68 | RETVAL=$? | |
69 | [ $RETVAL -eq 0 ] && touch $LOCK_FILE |
|
69 | [ $RETVAL -eq 0 ] && touch $LOCK_FILE | |
70 | return $RETVAL |
|
70 | return $RETVAL | |
71 | } |
|
71 | } | |
72 |
|
72 | |||
73 |
stop_ |
|
73 | stop_kallithea () { | |
74 | if [ -e $LOCK_FILE ]; then |
|
74 | if [ -e $LOCK_FILE ]; then | |
75 | killproc -p $PID_PATH |
|
75 | killproc -p $PID_PATH | |
76 | RETVAL=$? |
|
76 | RETVAL=$? | |
77 | rm -f $LOCK_FILE |
|
77 | rm -f $LOCK_FILE | |
78 | rm -f $PID_PATH |
|
78 | rm -f $PID_PATH | |
79 | else |
|
79 | else | |
80 | RETVAL=1 |
|
80 | RETVAL=1 | |
81 | fi |
|
81 | fi | |
82 | return $RETVAL |
|
82 | return $RETVAL | |
83 | } |
|
83 | } | |
84 |
|
84 | |||
85 |
status_ |
|
85 | status_kallithea() { | |
86 | if [ -e $LOCK_FILE ]; then |
|
86 | if [ -e $LOCK_FILE ]; then | |
87 | # exit with non-zero to indicate failure |
|
87 | # exit with non-zero to indicate failure | |
88 | RETVAL=1 |
|
88 | RETVAL=1 | |
89 | else |
|
89 | else | |
90 | RETVAL=0 |
|
90 | RETVAL=0 | |
91 | fi |
|
91 | fi | |
92 | return $RETVAL |
|
92 | return $RETVAL | |
93 | } |
|
93 | } | |
94 |
|
94 | |||
95 |
restart_ |
|
95 | restart_kallithea () { | |
96 |
stop_ |
|
96 | stop_kallithea | |
97 |
start_ |
|
97 | start_kallithea | |
98 | RETVAL=$? |
|
98 | RETVAL=$? | |
99 | } |
|
99 | } | |
100 |
|
100 | |||
101 | case "$1" in |
|
101 | case "$1" in | |
102 | start) |
|
102 | start) | |
103 | echo -n $"Starting $DESC: " |
|
103 | echo -n $"Starting $DESC: " | |
104 |
start_ |
|
104 | start_kallithea | |
105 | echo |
|
105 | echo | |
106 | ;; |
|
106 | ;; | |
107 | stop) |
|
107 | stop) | |
108 | echo -n $"Stopping $DESC: " |
|
108 | echo -n $"Stopping $DESC: " | |
109 |
stop_ |
|
109 | stop_kallithea | |
110 | echo |
|
110 | echo | |
111 | ;; |
|
111 | ;; | |
112 | status) |
|
112 | status) | |
113 |
status_ |
|
113 | status_kallithea | |
114 | RETVAL=$? |
|
114 | RETVAL=$? | |
115 | if [ ! $RETVAL -eq 0 ]; then |
|
115 | if [ ! $RETVAL -eq 0 ]; then | |
116 | echo "RhodeCode server is running..." |
|
116 | echo "RhodeCode server is running..." | |
117 | else |
|
117 | else | |
118 | echo "RhodeCode server is stopped." |
|
118 | echo "RhodeCode server is stopped." | |
119 | fi |
|
119 | fi | |
120 | ;; |
|
120 | ;; | |
121 | restart) |
|
121 | restart) | |
122 | echo -n $"Restarting $DESC: " |
|
122 | echo -n $"Restarting $DESC: " | |
123 |
restart_ |
|
123 | restart_kallithea | |
124 | echo |
|
124 | echo | |
125 | ;; |
|
125 | ;; | |
126 | *) |
|
126 | *) | |
127 | echo $"Usage: $0 {start|stop|restart|status}" |
|
127 | echo $"Usage: $0 {start|stop|restart|status}" | |
128 | RETVAL=1 |
|
128 | RETVAL=1 | |
129 | ;; |
|
129 | ;; | |
130 | esac |
|
130 | esac | |
131 |
|
131 | |||
132 | exit $RETVAL No newline at end of file |
|
132 | exit $RETVAL |
@@ -1,26 +1,26 b'' | |||||
1 |
# |
|
1 | # kallithea - run the kallithea daemon as an upstart job | |
2 |
# Change variables/paths as necessary and place file /etc/init/ |
|
2 | # Change variables/paths as necessary and place file /etc/init/kallithea.conf | |
3 |
# start/stop/restart as normal upstart job (ie: $ start |
|
3 | # start/stop/restart as normal upstart job (ie: $ start kallithea) | |
4 |
|
4 | |||
5 | description "RhodeCode Mercurial Server" |
|
5 | description "RhodeCode Mercurial Server" | |
6 | author "Matt Zuba <matt.zuba@goodwillaz.org" |
|
6 | author "Matt Zuba <matt.zuba@goodwillaz.org" | |
7 |
|
7 | |||
8 | start on (local-filesystems and runlevel [2345]) |
|
8 | start on (local-filesystems and runlevel [2345]) | |
9 | stop on runlevel [!2345] |
|
9 | stop on runlevel [!2345] | |
10 |
|
10 | |||
11 | respawn |
|
11 | respawn | |
12 |
|
12 | |||
13 | umask 0022 |
|
13 | umask 0022 | |
14 |
|
14 | |||
15 |
env PIDFILE=/var/hg/ |
|
15 | env PIDFILE=/var/hg/kallithea/kallithea.pid | |
16 |
env LOGFILE=/var/hg/ |
|
16 | env LOGFILE=/var/hg/kallithea/log/kallithea.log | |
17 |
env APPINI=/var/hg/ |
|
17 | env APPINI=/var/hg/kallithea/production.ini | |
18 | env HOME=/var/hg |
|
18 | env HOME=/var/hg | |
19 | env USER=hg |
|
19 | env USER=hg | |
20 | env GROUP=hg |
|
20 | env GROUP=hg | |
21 |
|
21 | |||
22 |
exec /var/hg/.virtualenvs/ |
|
22 | exec /var/hg/.virtualenvs/kallithea/bin/paster serve --user=$USER --group=$GROUP --pid-file=$PIDFILE --log-file=$LOGFILE $APPINI | |
23 |
|
23 | |||
24 | post-stop script |
|
24 | post-stop script | |
25 | rm -f $PIDFILE |
|
25 | rm -f $PIDFILE | |
26 | end script |
|
26 | end script |
@@ -1,51 +1,51 b'' | |||||
1 | ; RhodeCode Supervisord |
|
1 | ; RhodeCode Supervisord | |
2 | ; ########################## |
|
2 | ; ########################## | |
3 | ; for help see http://supervisord.org/configuration.html |
|
3 | ; for help see http://supervisord.org/configuration.html | |
4 | ; ########################## |
|
4 | ; ########################## | |
5 |
|
5 | |||
6 | [inet_http_server] ; inet (TCP) server disabled by default |
|
6 | [inet_http_server] ; inet (TCP) server disabled by default | |
7 | port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) |
|
7 | port=127.0.0.1:9001 ; (ip_address:port specifier, *:port for all iface) | |
8 | ;username=user ; (default is no username (open server)) |
|
8 | ;username=user ; (default is no username (open server)) | |
9 | ;password=123 ; (default is no password (open server)) |
|
9 | ;password=123 ; (default is no password (open server)) | |
10 |
|
10 | |||
11 | [supervisord] |
|
11 | [supervisord] | |
12 |
logfile=/%(here)s/supervisord_ |
|
12 | logfile=/%(here)s/supervisord_kallithea.log ; (main log file;default $CWD/supervisord.log) | |
13 | logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) |
|
13 | logfile_maxbytes=50MB ; (max main logfile bytes b4 rotation;default 50MB) | |
14 | logfile_backups=10 ; (num of main logfile rotation backups;default 10) |
|
14 | logfile_backups=10 ; (num of main logfile rotation backups;default 10) | |
15 | loglevel=info ; (log level;default info; others: debug,warn,trace) |
|
15 | loglevel=info ; (log level;default info; others: debug,warn,trace) | |
16 |
pidfile=/%(here)s/supervisord_ |
|
16 | pidfile=/%(here)s/supervisord_kallithea.pid ; (supervisord pidfile;default supervisord.pid) | |
17 | nodaemon=true ; (start in foreground if true;default false) |
|
17 | nodaemon=true ; (start in foreground if true;default false) | |
18 | minfds=1024 ; (min. avail startup file descriptors;default 1024) |
|
18 | minfds=1024 ; (min. avail startup file descriptors;default 1024) | |
19 | minprocs=200 ; (min. avail process descriptors;default 200) |
|
19 | minprocs=200 ; (min. avail process descriptors;default 200) | |
20 | umask=022 ; (process file creation umask;default 022) |
|
20 | umask=022 ; (process file creation umask;default 022) | |
21 |
user= |
|
21 | user=username ; (default is current user, required if root) | |
22 | ;identifier=supervisor ; (supervisord identifier, default is 'supervisor') |
|
22 | ;identifier=supervisor ; (supervisord identifier, default is 'supervisor') | |
23 | ;directory=/tmp ; (default is not to cd during start) |
|
23 | ;directory=/tmp ; (default is not to cd during start) | |
24 | ;nocleanup=true ; (don't clean up tempfiles at start;default false) |
|
24 | ;nocleanup=true ; (don't clean up tempfiles at start;default false) | |
25 | ;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) |
|
25 | ;childlogdir=/tmp ; ('AUTO' child log dir, default $TEMP) | |
26 |
environment=HOME=/home/ |
|
26 | environment=HOME=/home/username ; (key value pairs to add to environment) | |
27 | ;strip_ansi=false ; (strip ansi escape codes in logs; def. false) |
|
27 | ;strip_ansi=false ; (strip ansi escape codes in logs; def. false) | |
28 |
|
28 | |||
29 | ; the below section must remain in the config file for RPC |
|
29 | ; the below section must remain in the config file for RPC | |
30 | ; (supervisorctl/web interface) to work, additional interfaces may be |
|
30 | ; (supervisorctl/web interface) to work, additional interfaces may be | |
31 | ; added by defining them in separate rpcinterface: sections |
|
31 | ; added by defining them in separate rpcinterface: sections | |
32 | [rpcinterface:supervisor] |
|
32 | [rpcinterface:supervisor] | |
33 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface |
|
33 | supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface | |
34 |
|
34 | |||
35 | [supervisorctl] |
|
35 | [supervisorctl] | |
36 | serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket |
|
36 | serverurl=http://127.0.0.1:9001 ; use an http:// url to specify an inet socket | |
37 | ;username=user ; should be same as http_username if set |
|
37 | ;username=user ; should be same as http_username if set | |
38 | ;password=123 ; should be same as http_password if set |
|
38 | ;password=123 ; should be same as http_password if set | |
39 | ;prompt=mysupervisor ; cmd line prompt (default "supervisor") |
|
39 | ;prompt=mysupervisor ; cmd line prompt (default "supervisor") | |
40 | ;history_file=~/.sc_history ; use readline history if available |
|
40 | ;history_file=~/.sc_history ; use readline history if available | |
41 |
|
41 | |||
42 |
|
42 | |||
43 |
; restart with supervisorctl restart |
|
43 | ; restart with supervisorctl restart kallithea:* | |
44 |
[program: |
|
44 | [program:kallithea] | |
45 | numprocs = 1 |
|
45 | numprocs = 1 | |
46 | numprocs_start = 5000 # possible should match ports |
|
46 | numprocs_start = 5000 # possible should match ports | |
47 |
directory=/home/ |
|
47 | directory=/home/username/kallithea-dir | |
48 |
command = /home/ |
|
48 | command = /home/username/v-env/bin/paster serve rc.ini | |
49 | process_name = %(program_name)s_%(process_num)04d |
|
49 | process_name = %(program_name)s_%(process_num)04d | |
50 | redirect_stderr=true |
|
50 | redirect_stderr=true | |
51 |
stdout_logfile=/%(here)s/ |
|
51 | stdout_logfile=/%(here)s/kallithea.log No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now