Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Running palette-server using gunicorn and init.d

This assumes a Unix/Linux system. The following instructions do not apply for OS X or Windows.

First create local copies of the sample config file (for gunicorn) and shell scripts (for init.d)

$> cd init.d      
$> cp palette-server.cfg.example palette-server.cfg
$> cp


You will need to update palette-server.cfg with the relevant paths and other configurations specific to your setup. This is what the sample config file looks like:


import os
import multiprocessing

workers = multiprocessing.cpu_count() * 2 + 1
worker_class = "egg:gunicorn#gevent"

# These are things you might need to change, in particular `images` and `chdir`
# which are where to look for images and where to look for the server code (to
# be run by gunicorn) respectively.

bind = ''
chdir = '/usr/local/palette-server/flask'
user = 'www-data'
images = '/where/to/look/for/images'

os.environ['PALETTE_SERVER_IMAGE_ROOT'] = images

You will need to update to point to the correct path for your config file that you've just edited. The relevant bit is:



Link your init.d shell script in to /etc/init.d and tell the operating system to make sure it runs when the machine starts up:

$> sudo ln -s /usr/local/palette-server/init.d/ /etc/init.d/
$> sudo update-rc.d defaults

You can run the server in debug-mode like:

$> sudo /etc/init.d/ debug

Otherwise all the usual /etc/init.d conventions apply:

$> sudo /etc/init.d/ start
$> sudo /etc/init.d/ stop