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

Contents
Sometimes you need to restart or reload your ChiliProject application server. Most of the time this is required because
  • you updated the ChiliProject code,
  • you changed some basic configuration like database or email settings,
  • you installed or updated a plugin,
  • you installed a new theme

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.

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.

Which application server am I using?

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.

The first step is to either go to Administration -> Information or to run the following command:

cd /path/to/chiliproject # Replace the path with your actual ChiliProject installation root
RAILS_ENV=production ruby script/about

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.

If you are on Linux, open a console and run the following command. Be sure to adapt the path to your installation.

ps axu | grep /path/to/chiliproject | grep -v grep

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.

Keyword Application Server
Rails: Passenger
Passenger
mongrel Mongrel
thin Thin
unicorn Unicorn
server Webrick (script/server) (only if no other keyword is present)

Passenger

Passenger can be restarted in two ways:

  • The easiest way to restart your application is to run the following commands:
    cd /path/to/chiliproject
    touch tmp/restart.txt
    The next HTTP request to ChiliProject will restart it.
  • 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:
    sudo /etc/init.d/apache2 reload
    or
    sudo /etc/init.d/nginx reload

Mongrel / Mongrel Cluster

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:

sudo /etc/init.d/mongrel_cluster stop
sudo /etc/init.d/mongrel_cluster start

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.

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.

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:

cd /path/to/chiliproject
sudo mongrel_rails cluster::stop
sudo mongrel_rails cluster::start

Thin

cd /path/to/chiliproject
sudo thin restart

Unicorn

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.

cd /path/to/chiliproject
sudo kill -USR2 `cat tmp/pids/unicorn.pid`

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.

Webrick (script/server)

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.

At first get the process id (PID) of the running Webrick

ps axu | grep /path/to/chiliproject | grep -v grep
Select the process and remember the process id. It is in the second column of the output.

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.

sudo -u USERNAME -i

Now kill the process and start a new one.

cd /path/to/chiliproject
kill PID # remember to substitute the PID
script/server

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.