Fixes on deploy.sh

This commit is contained in:
Marc Aymerich 2015-05-05 20:55:54 +00:00
parent 037146b8ff
commit 85be59976e
3 changed files with 14 additions and 7 deletions

View file

@ -380,3 +380,5 @@ try: import uwsgi to know its running uwsgi
# LOCK beat lockfile # LOCK beat lockfile
# Deprecate restart/start/stop services (do touch wsgi.py and fuck celery)

View file

@ -18,7 +18,7 @@ class Command(BaseCommand):
help='Nginx SSL certificate, one will be created by default.'), help='Nginx SSL certificate, one will be created by default.'),
make_option('--cert-key', dest='cert_key', default='', make_option('--cert-key', dest='cert_key', default='',
help='Nginx SSL certificate key.'), help='Nginx SSL certificate key.'),
make_option('--cert-path', dest='cert_path', default='/etc/nginx/ssl/orchestra.crt', make_option('--cert-path', dest='cert_path', default='/etc/nginx/ssl/orchestra.crt',
help='Nginx SSL certificate, one will be created by default.'), help='Nginx SSL certificate, one will be created by default.'),
make_option('--cert-key-path', dest='cert_key_path', default='/etc/nginx/ssl/orchestra.key', make_option('--cert-key-path', dest='cert_key_path', default='/etc/nginx/ssl/orchestra.key',
@ -40,7 +40,7 @@ class Command(BaseCommand):
help='Certificate Distinguished Name Email Address.'), help='Certificate Distinguished Name Email Address.'),
make_option('--cert-common_name', dest='cert_common_name', default=None, make_option('--cert-common_name', dest='cert_common_name', default=None,
help='Certificate Distinguished Name Common Name.'), help='Certificate Distinguished Name Common Name.'),
make_option('--server-name', dest='server_name', default='', make_option('--server-name', dest='server_name', default='',
help='Nginx SSL certificate key.'), help='Nginx SSL certificate key.'),
make_option('--user', dest='user', default='', make_option('--user', dest='user', default='',
@ -132,7 +132,6 @@ class Command(BaseCommand):
self.stdout.write('writing new cert to \'%s\'' % cert_path) self.stdout.write('writing new cert to \'%s\'' % cert_path)
self.stdout.write('writing new cert key to \'%s\'' % key_path) self.stdout.write('writing new cert key to \'%s\'' % key_path)
run('openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout %(key_path)s -out %(cert_path)s -subj "%(subject)s"' % context, display=True) run('openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout %(key_path)s -out %(cert_path)s -subj "%(subject)s"' % context, display=True)
return cert_path, key_path return cert_path, key_path
@check_root @check_root
@ -204,7 +203,7 @@ class Command(BaseCommand):
""" """
) % context ) % context
nginx_file = '/etc/nginx/conf.d/%(project_name)s.conf' % context nginx_file = '/etc/nginx/sites-available/%(project_name)s.conf' % context
if server_name: if server_name:
context['server_name'] = server_name context['server_name'] = server_name
nginx_file = '/etc/nginx/sites-available/%(server_name)s.conf' % context nginx_file = '/etc/nginx/sites-available/%(server_name)s.conf' % context
@ -242,8 +241,14 @@ class Command(BaseCommand):
"The old version has been placed at %(file)s.save\033[m" % context) "The old version has been placed at %(file)s.save\033[m" % context)
if server_name: if server_name:
run('ln -s /etc/nginx/sites-available/%(server_name)s.conf /etc/nginx/sites-enabled/' % context, error_codes=[0,1], display=True) run('ln -s /etc/nginx/sites-available/%(server_name)s.conf /etc/nginx/sites-enabled/' % context,
run('ln -s /etc/uwsgi/apps-available/%(project_name)s.ini /etc/uwsgi/apps-enabled/' % context, error_codes=[0,1], display=True) error_codes=[0,1], display=True)
else:
run('rm /etc/nginx/sites-enabled/default')
run('ln -s /etc/nginx/sites-available/%(project_name)s.conf /etc/nginx/sites-enabled/' % context,
error_codes=[0,1], display=True)
run('ln -s /etc/uwsgi/apps-available/%(project_name)s.ini /etc/uwsgi/apps-enabled/' % context,
error_codes=[0,1], display=True)
rotate = textwrap.dedent("""\ rotate = textwrap.dedent("""\
/var/log/nginx/*.log { /var/log/nginx/*.log {

View file

@ -117,7 +117,7 @@ run "$PYTHON_BIN $MANAGE setupnginx --user $USER --noinput"
run "service nginx start" run "service nginx start"
# Apply changes on related services # Apply changes on related services
run "$PYTHON_BIN $MANAGE restartservices" run "$PYTHON_BIN $MANAGE restartservices" || true
# Create orchestra superuser # Create orchestra superuser
cat <<- EOF | $PYTHON_BIN $MANAGE shell cat <<- EOF | $PYTHON_BIN $MANAGE shell