X-Git-Url: https://git.mdrn.pl/fnpdjango.git/blobdiff_plain/c4ec253cd69546987dc20dec4c9be9e3867986f2..244ba8cd76ef0ea65d10b4a7c5e38ae3aae1d0be:/fnpdjango/deploy/__init__.py?ds=sidebyside diff --git a/fnpdjango/deploy/__init__.py b/fnpdjango/deploy/__init__.py index 9c7d762..e5cf30b 100644 --- a/fnpdjango/deploy/__init__.py +++ b/fnpdjango/deploy/__init__.py @@ -32,7 +32,7 @@ def setup(): run('mkdir -p %(app_path)s' % env, pty=True) run('%(virtualenv)s %(app_path)s/ve' % env, pty=True) run('mkdir -p %(app_path)s/releases %(app_path)s/packages' % env, pty=True) - run('cd %(app_path)s/releases; ln -s . current; ln -s . previous' % env, pty=True) + run('cd %(app_path)s/releases; ln -sfT . current; ln -sfT . previous' % env, pty=True) upload_samples() print "Fill out db details in localsettings.py and run deploy." @@ -107,8 +107,7 @@ class DebianGunicorn(Task): def run(self): print '>>> restart webserver using gunicorn-debian' - with path('/sbin'): - sudo('gunicorn-debian restart %s' % self.site_name, shell=False) + sudo('gunicorn-debian restart %s' % self.name, shell=False) class Apache(Task): def run(self): @@ -123,15 +122,14 @@ class Supervisord(Task): def run(self): print '>>> supervisord: restart %s' % self.name - with path('/sbin'): - sudo('supervisorctl restart %s' % self.name, shell=False) + sudo('supervisorctl restart %s' % self.name, shell=False) def check_setup(): require('app_path') try: run('[ -e %(app_path)s/ve ]' % env) except SystemExit: - print "Environment isn't ready. Run fab deploy.setup first." + print "Environment isn't ready. Run `fab setup` first." raise def upload_samples(): @@ -145,7 +143,7 @@ def upload_localsettings_sample(): require('app_path', 'project_name') template = '%(project_name)s/localsettings.py.template' if not exists(template): - template = join(dirname(abspath(__file__)), 'localsettings.py.template') + template = join(dirname(abspath(__file__)), 'templates/localsettings.py.template') env.secret_key = '' # sth random files.upload_template(template, '%(app_path)s/localsettings.py.sample' % env, env) @@ -155,7 +153,7 @@ def upload_nginx_sample(): require('app_path', 'project_name') template = '%(project_name)s/nginx.template' if not exists(template): - template = join(dirname(abspath(__file__)), 'nginx.template') + template = join(dirname(abspath(__file__)), 'templates/nginx.template') files.upload_template(template, '%(app_path)s/nginx.sample' % env, env) def upload_gunicorn_sample(): @@ -164,7 +162,7 @@ def upload_gunicorn_sample(): require('app_path', 'project_name') template = '%(project_name)s/gunicorn.template' if not exists(template): - template = join(dirname(abspath(__file__)), 'gunicorn.template') + template = join(dirname(abspath(__file__)), 'templates/gunicorn.template') files.upload_template(template, '%(app_path)s/gunicorn.sample' % env, env) def upload_tar_from_git(): @@ -209,7 +207,7 @@ def migrate(): "Update the database" print '>>> migrate' require('app_path', 'project_name') - with cd('%(app_path)s/releases/current/%(project_name)s' % env): + with cd('%(app_path)s/releases/current' % env): run('%(app_path)s/ve/bin/python manage.py syncdb --noinput' % env, pty=True) run('%(app_path)s/ve/bin/python manage.py migrate' % env, pty=True) @@ -217,5 +215,5 @@ def collectstatic(): """Collect static files""" print '>>> collectstatic' require('app_path', 'project_name') - with cd('%(app_path)s/releases/current/%(project_name)s' % env): + with cd('%(app_path)s/releases/current' % env): run('%(app_path)s/ve/bin/python manage.py collectstatic --noinput' % env, pty=True)