File tree 9 files changed +85
-271
lines changed
9 files changed +85
-271
lines changed Original file line number Diff line number Diff line change @@ -14,16 +14,16 @@ auto-checkout = *
14
14
eggs =
15
15
pillow
16
16
django
17
+ eventlet
17
18
gunicorn
18
- # Enable flup if you want to use fastcgi instead of gunicorn
19
- # flup
20
19
21
20
21
+ # The versions below are as example only, please change these to use
22
+ # latest versions of packages you require
22
23
[versions]
23
24
pillow = 1.7.5
24
25
django = 1.4.3
25
26
gunicorn = 0.16.1
26
- # flup = 1.0.2
27
27
28
28
29
29
[sources]
@@ -34,6 +34,7 @@ gunicorn = 0.16.1
34
34
access_log = ${buildout:directory}/log/access.log
35
35
instance_log = ${buildout:directory}/log/instance.log
36
36
error_log = ${buildout:directory}/log/error.log
37
+ supervisor_log = ${buildout:directory/log/supervisor.log
37
38
38
39
39
40
[python]
@@ -50,20 +51,11 @@ settings = settings
50
51
# The name of the wrapped manage.py, which will be placed in bin
51
52
control-script =
52
53
# The path to your project, this should be where your original manage.py is
53
- # located
54
- extra-paths = ${buildout:directory}/{{ PROJECT_DIR_NAME }} /
54
+ # located.
55
+ extra-paths = ${buildout:directory}/<INSERT_PROJECT_DIR_NAME> /
55
56
eggs = ${buildout:eggs}
56
57
57
58
58
- # Add to parts if you want to use fabric
59
- [fabric-script]
60
- recipe = collective.recipe.template
61
- input = templates/fabtemplate.py
62
- output = ${buildout:directory}/fabfile.py
63
- staging-root =
64
- production-root =
65
-
66
-
67
59
# Add to parts if you want to use compass
68
60
[compass-config]
69
61
recipe = collective.recipe.template
Load Diff This file was deleted.
Original file line number Diff line number Diff line change
1
+ import production
2
+
Original file line number Diff line number Diff line change
1
+ import os
2
+ from fabric .api import *
3
+ from fabric .contrib .console import confirm
4
+
5
+
6
+ # Set up the production environment vars
7
+ env .hosts = []
8
+ env .user = ''
9
+
10
+ # Set some helpful global vars
11
+ SCRIPT_NAME = '' # This should be the same as you bin script name
12
+ PROJECT_ROOT = "" # Root folder on the server
13
+ projectroot = lambda * p : os .path .join (PROJECT_ROOT , * p )
14
+
15
+
16
+ @task
17
+ def make_archive (version = "HEAD" ):
18
+ filename = "%s-%s.tar.gz" % (SCRIPT_NAME , version )
19
+ local ('git archive --format=tar %s | gzip >%s' % (version , filename ))
20
+ return filename
21
+
22
+
23
+ @task
24
+ def buildout ():
25
+ with cd (PROJECT_ROOT ):
26
+ run ('./bin/buildout -c production.cfg' )
27
+
28
+
29
+ @task
30
+ def deploy (version = "HEAD" ):
31
+ if confirm ("Deploy %s?" % version ):
32
+ archive = make_archive (version )
33
+ put (archive , PROJECT_ROOT )
34
+ with cd (PROJECT_ROOT ):
35
+ run ('tar zxvf %s' % archive )
36
+ else :
37
+ abort ("Aborting at user request" )
38
+
Original file line number Diff line number Diff line change 1
1
[buildout]
2
2
extends = buildout.cfg
3
- parts += gunicorn nginx launcher
3
+ parts += nginx supervisor-conf
4
4
5
5
6
6
[opts]
7
7
control-script = ${django:control-script}
8
- username =
8
+ user =
9
+ server_domain =
9
10
server_name =
10
11
listen_port =
11
- app_host =
12
- app_port =
13
- media_dir = ${buildout:directory}/media/
14
- workers = 2
15
- # FastCGI options
16
- pidfile = ${buildout:directory}/bin/${opts:control-script}.pid
12
+ media_dir = ${buildout:directory}/cdn/
13
+ workers = 4
17
14
socketfile = ${buildout:directory}/bin/${opts:control-script}.sock
18
15
19
16
20
- [gunicorn]
21
- recipe = zc.recipe.egg:scripts
22
- dependent-scripts = true
23
- eggs =
24
- ${buildout:eggs}
25
- eventlet
26
- gunicorn
27
-
28
-
29
17
[nginx]
30
18
recipe = collective.recipe.template
31
19
input = templates/nginx.conf
32
20
output = ${buildout:directory}/nginx/${opts:control-script}.conf
33
21
34
22
35
- [launcher ]
23
+ [supervisor-conf ]
36
24
recipe = collective.recipe.template
37
- input = templates/launcher.sh
38
- output = ${buildout:directory}/bin /${opts:control-script}.sh
25
+ input = templates/supervisor.conf
26
+ output = ${buildout:directory}/supervisor /${opts:control-script}.conf
39
27
mode = 755
40
28
Load Diff This file was deleted.
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments