#6: Endpoint do pobierania elementów galerii (wstępna wersja)
[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 @task
28 def production():
29     env.hosts = ['giewont.icm.edu.pl']
30     env.user = 'lektury'
31     env.app_path = '/srv/wolnelektury.pl'
32     env.django_root_path = 'src'
33     env.requirements_file = 'requirements/requirements.txt'
34     env.pre_collectstatic = [
35         update_counters,
36         compile_messages,
37     ]
38     env.services = [
39         Supervisord('wolnelektury'),
40         Supervisord('wolnelektury.celery'),
41     ]
42
43
44 @task
45 def beta():
46     env.hosts = ['giewont.icm.edu.pl']
47     env.user = 'lektury'
48     env.app_path = '/srv/wolnelektury.pl/beta'
49     env.ve = '/srv/wolnelektury.pl/ve'
50     env.django_root_path = 'src'
51     env.requirements_file = 'requirements/requirements.txt'
52     env.pre_collectstatic = [
53         update_counters,
54         compile_messages,
55     ]
56     env.services = [
57         Supervisord('beta'),
58     ]
59
60
61 @task
62 def staging():
63     env.hosts = ['san.nowoczesnapolska.org.pl:2223']
64     env.user = 'staging'
65     env.app_path = '/home/staging/wolnelektury.pl'
66     env.services = [
67         DebianGunicorn('wolnelektury'),
68     ]