Font fix
[wolnelektury.git] / fabfile.py
1 # -*- coding: utf-8 -*-
2 from fnpdeploy import *
3
4 try:
5     from fabfile_local import *
6 except ImportError:
7     pass
8
9
10 env.project_name = 'wolnelektury'
11
12
13 def update_counters():
14     print '>>> updating counters'
15     require('app_path', 'project_name')
16     with cd(get_django_root_path('current')):
17         run('%(ve)s/bin/python manage.py update_counters' % env, pty=True)
18
19
20 def compile_messages():
21     print '>>> compiling messages'
22     require('app_path', 'project_name')
23     with cd(get_django_root_path('current')):
24         run('source %(ve)s/bin/activate && python manage.py localepack -c' % env, pty=True)
25
26
27 class Memcached(Service):
28     def run(self):
29         print '>>> memcached: restart'
30         sudo('service memcached restart', shell=False)
31
32
33 @task
34 def production():
35     env.hosts = ['giewont.icm.edu.pl']
36     env.user = 'lektury'
37     env.app_path = '/srv/wolnelektury.pl'
38     env.django_root_path = 'src'
39     env.requirements_file = 'requirements/requirements.txt'
40     env.pre_collectstatic = [
41         update_counters,
42         compile_messages,
43     ]
44     env.services = [
45         Supervisord('wolnelektury'),
46         Supervisord('wolnelektury.celery'),
47         Memcached(),
48     ]
49
50
51 @task
52 def beta():
53     env.hosts = ['giewont.icm.edu.pl']
54     env.user = 'lektury'
55     env.app_path = '/srv/wolnelektury.pl/beta'
56     env.ve = '/srv/wolnelektury.pl/ve'
57     env.django_root_path = 'src'
58     env.requirements_file = 'requirements/requirements.txt'
59     env.pre_collectstatic = [
60         update_counters,
61         compile_messages,
62     ]
63     env.services = [
64         Supervisord('beta'),
65     ]
66
67
68 @task
69 def staging():
70     env.hosts = ['san.nowoczesnapolska.org.pl:2223']
71     env.user = 'staging'
72     env.app_path = '/home/staging/wolnelektury.pl'
73     env.services = [
74         DebianGunicorn('wolnelektury'),
75     ]