~nataliabidart/magicicada-server/use-venv-dependencies

« back to all changes in this revision

Viewing changes to dev-scripts/supervisor_templates.py

  • Committer: Natalia
  • Date: 2018-04-05 20:49:42 UTC
  • Revision ID: natalia.bidart@ubuntu.com-20180405204942-wlf2cwb8k6lh4rl5
Finally all tests passing. Update copyright notices.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2008-2015 Canonical
2
 
# Copyright 2015 Chicharreros (https://launchpad.net/~chicharreros)
3
 
#
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.
8
 
#
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.
13
 
#
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/>.
16
 
#
17
 
# For further info, check  http://launchpad.net/magicicada-server
18
 
 
19
 
"""Templates to generate supervisor config."""
20
 
 
21
 
FILESYNC_TEMPLATE = (
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 '
27
 
    '--reactor=epoll\n'
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'
32
 
    'autostart=false\n'
33
 
    'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
34
 
    'stopsignal=INT\n'
35
 
)
36
 
 
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 '
44
 
    '--reactor=epoll\n'
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'
50
 
    'autostart=false\n'
51
 
    'stdout_capture_maxbytes=%(stdout_capture_maxbytes)s\n'
52
 
    'stopsignal=INT\n'
53
 
)
54
 
 
55
 
 
56
 
TEMPLATES = {
57
 
    'filesync': {
58
 
        'name': "filesync-worker-%(instance)d",
59
 
        'config': FILESYNC_TEMPLATE,
60
 
    },
61
 
    'ssl-proxy': {
62
 
        'name': "ssl-proxy-%(instance)d",
63
 
        'config': SSL_PROXY_TEMPLATE,
64
 
    },
65
 
}