1
# Copyright 2008-2015 Canonical
2
# Copyright 2015 Chicharreros (https://launchpad.net/~chicharreros)
4
# This program is free software: you can redistribute it and/or modify
5
# it under the terms of the GNU Affero General Public License as
6
# published by the Free Software Foundation, either version 3 of the
7
# License, or (at your option) any later version.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU Affero General Public License for more details.
14
# You should have received a copy of the GNU Affero General Public License
15
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
# For further info, check http://launchpad.net/magicicada-server
19
"""Templates to generate supervisor config."""
22
'[program:%(instance_name)s]\n'
23
'command=%(basepath)s/dev-scripts/set_rlimits.sh -d %(fs_memory_limit)s '
24
'-m %(fs_memory_limit)s -v %(fs_memory_limit)s -n %(open_fds)s '
25
'%(basepath)s/.env/bin/twistd --pidfile %(pid_folder)s/fsync_slave_%(instance)s.pid '
26
'-n -y %(basepath)s/magicicada/server/server.tac '
28
'environment=DJANGO_SETTINGS_MODULE="magicicada.settings",'
29
'PYTHONPATH="%(basepath)s/lib",'
30
'FSYNC_INSTANCE_ID=%(instance)03d,'
31
'CONFIG="%(basepath)s/configs/%(config)s"%(environment_vars)s\n'
33
'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
37
SSL_PROXY_TEMPLATE = (
38
'[program:%(instance_name)s]\n'
39
'command=%(basepath)s/dev-scripts/set_rlimits.sh -d %(ssl_memory_limit)s '
40
'-m %(ssl_memory_limit)s -v %(ssl_memory_limit)s -n %(open_fds)s '
41
'%(basepath)s/.env/bin/twistd '
42
'--pidfile %(pid_folder)s/ssl-proxy-%(instance)s.pid '
43
'-n -y %(basepath)s/magicicada/server/ssl_proxy.tac '
45
'environment=DJANGO_SETTINGS_MODULE="magicicada.settings",'
46
'PYTHONPATH="%(basepath)s/lib",'
47
'FSYNC_INSTANCE_ID=%(instance)03d,'
48
'CONFIG="%(basepath)s/configs/%(config)s",'
49
'FSYNC_SERVICE_NAME="ssl-proxy"%(environment_vars)s\n'
51
'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
58
'name': "filesync-worker-%(instance)d",
59
'config': FILESYNC_TEMPLATE,
62
'name': "ssl-proxy-%(instance)d",
63
'config': SSL_PROXY_TEMPLATE,