ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Restart ChiliProject

Version 6 (Holger Just, 2011-02-23 10:31 am)

1 1
h1. Restart ChiliProject
2 1
3 1
4 1
5 1
Sometimes you need to restart or reload your ChiliProject application server. Most of the time this is required because
6 1
* you updated the ChiliProject code,
7 1
* you changed some basic configuration like database or email settings,
8 1
* you installed or updated a [[Plugins|plugin]],
9 1
* you installed a new [[Themes|theme]]
10 1
11 1
The procedure you need to follow depends mostly on the application server you use to actually run ChiliProject. Just find out which server you are actually using and then follow its procedure to restart the server.
12 1
13 1
These procedures work for common configurations of the mentioned application servers. The don't necessarily work for you when you have configured your system in unusual way. Please also consult the documentation of your application server to learn more about how to handle it.
14 1
15 1
h2. Which application server am I using?
16 1
17 1
Most of the time you know very well which application server software you are running, just because you have set it up originally. But sometimes it's not that clear anymore what is actually used, because this thing just ran for ages. This section helps you to identify which application server software you are running. Unfortunately, a running ChiliProject can not tell with 100% certainty what is used, so you might have to dig a bit yourself.
18 1
19 2 Holger Just
{{html_comment(TODO: This only applies once was merged)}}
20 2 Holger Just
21 1
The first step is to either go to *Administration* -> *Information* or to run the following command:
22 2 Holger Just
23 2 Holger Just
<pre>cd /path/to/chiliproject # Replace the path with your actual ChiliProject installation root
24 2 Holger Just
RAILS_ENV=production ruby script/about</pre>
25 2 Holger Just
26 1
Look for the "Application Server" column. If only one server is listed, just go to its section. If multiple app servers are listed, ChiliProject couldn't fully determine which software is used. You'll need to check further.
27 1
28 1
If you are on Linux, open a console and run the following command. Be sure to adapt the path to your installation.
29 2 Holger Just
30 1
<pre>ps axu | grep /path/to/chiliproject | grep -v grep</pre>
31 1
32 2 Holger Just
It will output a number of lines containing information about running processes on your server. This process list is filtered for processes containing your ChiliProject installation path in its parameters. Of interest in this output is the last column. Search for certain keywords here which identify the application server.
33 2 Holger Just
34 2 Holger Just
35 1
|_. Keyword |_. Application Server |
36 3 Holger Just
| Rails:    |/2. [[Restart_ChiliProject#Passenger|Passenger]] |
37 1
| Passenger |
38 4 Holger Just
| mongrel   |    [[Restart_ChiliProject#Mongrel-Mongrel-Cluster|Mongrel]] |
39 3 Holger Just
| thin      |    [[Restart_ChiliProject#Thin|Thin]] |
40 3 Holger Just
| unicorn   |    [[Restart_ChiliProject#Unicorn|Unicorn]] |
41 1
42 1
h2. Passenger
43 1
44 1
Passenger can be restarted in two ways:
45 1
46 2 Holger Just
* The easiest way to restart your application is to run the following commands: <pre>cd /path/to/chiliproject
47 2 Holger Just
touch tmp/restart.txt</pre> The next HTTP request to ChiliProject will restart it.
48 6 Holger Just
* Another possibility is to reload the web server that passenger is embedded into. That could be either nginx or Apache2. Depending on what you use issue one of the following commands:<pre>sudo /etc/init.d/apache2 reload</pre>or<pre>sudo /etc/init.d/nginx reload</pre>
49 1
50 1
h2. Mongrel / Mongrel Cluster
51 1
52 6 Holger Just
A typical deployment of mongrels are in a cluster of multiple processes with a loadbalancer (like Apache) in front. The @mysql_cluster@ gem is used to manage the actual mongrel processes. To restart all of them issue the following commands:<pre>sudo /etc/init.d/mongrel_cluster stop
53 6 Holger Just
sudo /etc/init.d/mongrel_cluster start</pre>
54 1
55 1
p(smallcaution). @mongrel_cluster@ can be configured to handle multiple Rails applications. The @start@ / @stop@ / @restart@ commands affect all of these. See the "documentation": for more information.
56 1
57 6 Holger Just
p(smallnote). Although an @/etc/init.d/mongrel_cluster restart@ command is also available, it will sometimes fail because of a race condition. So you are better of with first completely stopping and then again starting your cluster.
58 6 Holger Just
59 6 Holger Just
If you have deployed multiple Rails applications with mongrel cluster and just want to restart a single one (e.g. your ChiliProject) you can do the following:
60 6 Holger Just
61 6 Holger Just
62 6 Holger Just
cd /path/to/chiliproject
63 6 Holger Just
sudo mongrel_rails cluster::stop
64 6 Holger Just
sudo mongrel_rails cluster::start
65 6 Holger Just
66 6 Holger Just
67 1
h2. Thin
68 1
69 1
<pre>cd /path/to/chiliproject
70 6 Holger Just
sudo thin restart</pre>
71 1
72 1
h2. Unicorn
73 1
74 1
Unicorn uses "UNIX Signals": for most of its actions. Most of the time, these are encapsulated by an init script. But as this script is custom, we are going to send the restart signal directly to the running Unicorn instances.
75 1
76 1
<pre>cd /path/to/chiliproject
77 6 Holger Just
sudo kill -USR2 `cat tmp/pids/`</pre>
78 1
79 1
p(smallnote). This command handles only the most common configration. As setting up Unicorn involves some customizations, these setups tend to be rather special. You are strongly advised to read more about how "Unicorn": works and how it is setup at your server before continuing.
80 1
81 1
h2. Webrick (@script/server@)
82 1
83 1
If you don't have a real application server installed but use the included Webrick server which can be started using @script/server@ in chiliprojects root directory, you can just @kill@ the process and start a new one.
84 1
85 6 Holger Just
At first get the process id (PID) of the running Webrick <pre>ps axu | grep /path/to/chiliproject | grep -v grep</pre> Select the process and remember the process id. It is in the second column of the output.
86 1
87 6 Holger Just
The first column denotes the username the process is running under. If this differs from your current username, you have to switch to that user first. Use the following command for that. Remember to substitute the username with the user you want to switch to.
88 6 Holger Just
89 6 Holger Just
<pre>sudo -u USERNAME -i</pre>
90 6 Holger Just
91 6 Holger Just
Now kill the process and start a new one.
92 6 Holger Just
93 1
<pre>cd /path/to/chiliproject
94 1
kill PID # remember to substitute the PID
95 1
96 1
97 1
p(smallnote). Webrick is not suitable for production use. It is not recommended to use Webrick for anything other than development or testing. Use one of the many other guides in this wiki to setup ChiliProject with a real application server like "Phusion Passenger (mod_rails) ": or "Thin": instead.