diff --git a/config/requirements.txt b/config/requirements.txt deleted file mode 100644 index 479a26c..0000000 --- a/config/requirements.txt +++ /dev/null @@ -1,6 +0,0 @@ ---allow-external mysql-connector-python ---allow-unverified mysql-connector-python - -mysql-connector-python==1.1.6 -uwsgi==2.0 -mailsink==0.0.2 diff --git a/config/uwsgi/rookeries-uwsgi.ini b/config/uwsgi/rookeries-uwsgi.ini index db60a2b..1debb10 100644 --- a/config/uwsgi/rookeries-uwsgi.ini +++ b/config/uwsgi/rookeries-uwsgi.ini @@ -2,4 +2,5 @@ socket = :8001 log = /tmp/rookeries-uwsgi.log master = true -module = rookeries:app +module = rookeries:make_rookeries_app() +virtualenv = /srv/www/rookeries diff --git a/deployment/email_server.yaml b/deployment/email_server.yaml index 45dbcd5..68cbf36 100644 --- a/deployment/email_server.yaml +++ b/deployment/email_server.yaml @@ -1,8 +1,13 @@ --- - hosts: all sudo: yes + vars: + web_server_home: /srv/www + email_server_venv: "{{ web_server_home }}/mail_server" tasks: - # TODO PIP install mailsink into a virtualenv somewhere -# - name: Install fake SMTP server for email development. -# pip: name=mailsink use_mirrors=no + - name: PIP install mailsink test server into target virtualenv + pip: name=mailsink virtualenv={{ email_server_venv }} version=0.0.2 + +# - name: Launches the fake SMTP email daemon +# command: "{{ email_server_venv }}/bin/mailsinkd -w {{ email_web_server_port }} -s {{ email_server_port }}" diff --git a/deployment/rookeries_install.yaml b/deployment/rookeries_install.yaml index 608dbed..4a874a3 100644 --- a/deployment/rookeries_install.yaml +++ b/deployment/rookeries_install.yaml @@ -1,9 +1,20 @@ --- - hosts: all - sudo: yes + vars: + web_server_home: /srv/www + rookeries_venv: "{{ web_server_home }}/rookeries" + rookeries_package: rookeries-0.4.0.tar.bz2 + rookeries_uwsgi_ini: rookeries-uwsgi.ini tasks: - # TODO Step 1 - Setup virtualenv in target - # TODO Step 2 - Copy over package to target system - # TODO Step 3 - PIP install into virtualenv + - name: Upload rookeries package to web server home + copy: src=../../../dist/{{ rookeries_package }} dest={{ web_server_home }} + + - name: PIP install rookeries package into target virtualenv + pip: name={{ rookeries_package }} virtualenv={{ rookeries_venv }} chdir={{ web_server_home }} + + - name: PIP install extra MySQL python connector dependency + pip: name=mysql-connector-python virtualenv={{ rookeries_venv }} version=1.1.6 + extra_args='--allow-external mysql-connector-python --allow-unverified mysql-connector-python' + # TODO Step 4 - Setup environment variables on target system related to config. diff --git a/deployment/uwsgi.yaml b/deployment/uwsgi.yaml index e9155db..df5d1b8 100644 --- a/deployment/uwsgi.yaml +++ b/deployment/uwsgi.yaml @@ -1,7 +1,16 @@ --- - hosts: all - sudo: yes + vars: + web_server_home: /srv/www + uwsgi_venv: "{{ web_server_home }}/uwsgi" + rookeries_uwsgi_ini: rookeries-uwsgi.ini tasks: - # TODO Step 1 - PIP install uwsgi into virtualenv - # TODO Step 2 - Start uwsgi with the given configs. + - name: PIP install mailsink test server into target virtualenv + pip: name=uwsgi virtualenv={{ uwsgi_venv }} version=2.0 + + - name: Upload rookeries UWSGI configuration to web server home + copy: src=../config/uwsgi/{{ rookeries_uwsgi_ini }} dest={{ web_server_home }} + +# - name: Launches the UWSGI daemon +# command: "{{ uwsgi_venv }}/bin/uwsgi --ini {{ web_server_home }}/{{ rookeries_uwsgi_ini }}" diff --git a/pre_deployment/nginx.yaml b/pre_deployment/nginx.yaml index 1d6b4d9..e4c478e 100644 --- a/pre_deployment/nginx.yaml +++ b/pre_deployment/nginx.yaml @@ -3,6 +3,8 @@ sudo: yes vars: rookeries_nginx_conf: rookeries-uwsgi.conf + web_server_group: www-data + web_server_home: /srv/www tasks: - name: Setup nginx webserver @@ -22,9 +24,9 @@ - name: Run nginx service command: service nginx restart - # TODO Verify if still required for pip package deployment -# - name: Setup webapp deployment folder with the correct permissions -# file: path=/var/www state=directory owner=vagrant group=www-data mode=0774 -# -# - name: Add vagrant user to www-data -# user: name=vagrant append=yes groups=www-data + - name: Setup webapp deployment folder with the correct permissions + file: path={{ web_server_home }} 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 }} diff --git a/pre_deployment/python.yaml b/pre_deployment/python.yaml index 948c7c4..72706a4 100644 --- a/pre_deployment/python.yaml +++ b/pre_deployment/python.yaml @@ -16,7 +16,3 @@ pip: name={{ item }} use_mirrors=no with_items: - virtualenv - - virtualenvwrapper - - - name: Add virtualenvwrapper to bashrc - lineinfile: dest=/home/vagrant/.bashrc line="source virtualenvwrapper.sh"