From 79d7201e674a607f74a20dec6ba75e0db0cf3934 Mon Sep 17 00:00:00 2001 From: Dorian Pula Date: Thu, 20 Nov 2014 18:05:34 -0500 Subject: [PATCH] Add configuration folder setup for uwsgi and supervisor. Add convenience task for vagrant ssh. --- deployment/supervisor.yaml | 20 ++++++++++++++++++++ deployment/supervisord.yaml | 15 --------------- deployment/uwsgi.yaml | 9 ++++++--- pre_deployment/nginx.yaml | 4 ++++ 4 files changed, 30 insertions(+), 18 deletions(-) create mode 100644 deployment/supervisor.yaml delete mode 100644 deployment/supervisord.yaml diff --git a/deployment/supervisor.yaml b/deployment/supervisor.yaml new file mode 100644 index 0000000..a94d4ef --- /dev/null +++ b/deployment/supervisor.yaml @@ -0,0 +1,20 @@ +--- +- hosts: all + vars: + web_server_home: /srv/www + web_server_group: www-data + supervisor_config: "{{ web_server_home }}/config/supervisor" + supervisor_venv: "{{ web_server_home }}/supervisor" + tasks: + + - name: PIP install supervisor into target virtualenv + pip: name=supervisor virtualenv={{ supervisor_venv }} version=3.1.3 extra_args=--pre + + - name: Setup webapp deployment configuration folder with the correct permissions + file: path={{ supervisor_config }} state=directory + owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774 + + - name: Upload rookeries supervisor configuration to web server home + copy: src=../config/supervisor/supervisor.conf dest={{ supervisor_config }} + + # TODO Control supervisor with supervisorctl + ansible - http://docs.ansible.com/supervisorctl_module.html diff --git a/deployment/supervisord.yaml b/deployment/supervisord.yaml deleted file mode 100644 index a8bd8f0..0000000 --- a/deployment/supervisord.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- hosts: all - vars: - web_server_home: /srv/www - supervisor_venv: "{{ web_server_home }}/supervisord" - tasks: - - - name: PIP install supervisor into target virtualenv - pip: name=supervisor virtualenv={{ supervisor }} version=4.0.0-dev extra_args=--pre - - - name: Upload rookeries supervisor configuration to web server home - copy: src=../config/supervisor/supervisor.conf dest={{ web_server_home }} - - # TODO Clean up configuration placement - # TODO Control supervisor with supervisorctl + ansible - http://docs.ansible.com/supervisorctl_module.html diff --git a/deployment/uwsgi.yaml b/deployment/uwsgi.yaml index 6b12034..07aa3ab 100644 --- a/deployment/uwsgi.yaml +++ b/deployment/uwsgi.yaml @@ -2,18 +2,21 @@ - hosts: all vars: web_server_home: /srv/www + web_server_group: www-data uwsgi_venv: "{{ web_server_home }}/uwsgi" + uwsgi_config: "{{ web_server_home }}/config/uwsgi" rookeries_uwsgi_ini: rookeries-uwsgi.ini tasks: - name: PIP install UWSGI server into target virtualenv pip: name=uwsgi virtualenv={{ uwsgi_venv }} version=2.0 - - name: PIP install supervisord into target virtualenv - pip: name=supervisor virtualenv={{ uwsgi_venv }} version=4.0.0-dev extra_args=--pre + - name: Setup webapp deployment configuration folder with the correct permissions + file: path={{ uwsgi_config }} state=directory + owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774 - name: Upload rookeries UWSGI configuration to web server home - copy: src=../config/uwsgi/{{ rookeries_uwsgi_ini }} dest={{ web_server_home }} + copy: src=../config/uwsgi/{{ rookeries_uwsgi_ini }} dest={{ uwsgi_config }} # TODO Clean up configuration placement diff --git a/pre_deployment/nginx.yaml b/pre_deployment/nginx.yaml index dd37ef7..f0a501a 100644 --- a/pre_deployment/nginx.yaml +++ b/pre_deployment/nginx.yaml @@ -28,5 +28,9 @@ file: path={{ web_server_home }} state=directory owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774 + - name: Setup webapp deployment configuration folder with the correct permissions + file: path={{ web_server_home }}/config state=directory + owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774 + - name: Add vagrant user to www-data user: name={{ ansible_env.SUDO_USER }} append=yes groups={{ web_server_group }}