Migrate deployment to use Ansible playbooks.

Remove unneeded Fabric tasks + configurations.
This commit is contained in:
Dorian 2014-11-19 19:20:27 -05:00
parent d2db632bb8
commit 9fa6c8cc44
7 changed files with 45 additions and 27 deletions

View File

@ -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

View File

@ -2,4 +2,5 @@
socket = :8001 socket = :8001
log = /tmp/rookeries-uwsgi.log log = /tmp/rookeries-uwsgi.log
master = true master = true
module = rookeries:app module = rookeries:make_rookeries_app()
virtualenv = /srv/www/rookeries

View File

@ -1,8 +1,13 @@
--- ---
- hosts: all - hosts: all
sudo: yes sudo: yes
vars:
web_server_home: /srv/www
email_server_venv: "{{ web_server_home }}/mail_server"
tasks: tasks:
# TODO PIP install mailsink into a virtualenv somewhere - name: PIP install mailsink test server into target virtualenv
# - name: Install fake SMTP server for email development. pip: name=mailsink virtualenv={{ email_server_venv }} version=0.0.2
# pip: name=mailsink use_mirrors=no
# - name: Launches the fake SMTP email daemon
# command: "{{ email_server_venv }}/bin/mailsinkd -w {{ email_web_server_port }} -s {{ email_server_port }}"

View File

@ -1,9 +1,20 @@
--- ---
- hosts: all - 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: tasks:
# TODO Step 1 - Setup virtualenv in target - name: Upload rookeries package to web server home
# TODO Step 2 - Copy over package to target system copy: src=../../../dist/{{ rookeries_package }} dest={{ web_server_home }}
# TODO Step 3 - PIP install into virtualenv
- 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. # TODO Step 4 - Setup environment variables on target system related to config.

View File

@ -1,7 +1,16 @@
--- ---
- hosts: all - hosts: all
sudo: yes vars:
web_server_home: /srv/www
uwsgi_venv: "{{ web_server_home }}/uwsgi"
rookeries_uwsgi_ini: rookeries-uwsgi.ini
tasks: tasks:
# TODO Step 1 - PIP install uwsgi into virtualenv - name: PIP install mailsink test server into target virtualenv
# TODO Step 2 - Start uwsgi with the given configs. 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 }}"

View File

@ -3,6 +3,8 @@
sudo: yes sudo: yes
vars: vars:
rookeries_nginx_conf: rookeries-uwsgi.conf rookeries_nginx_conf: rookeries-uwsgi.conf
web_server_group: www-data
web_server_home: /srv/www
tasks: tasks:
- name: Setup nginx webserver - name: Setup nginx webserver
@ -22,9 +24,9 @@
- name: Run nginx service - name: Run nginx service
command: service nginx restart command: service nginx restart
# TODO Verify if still required for pip package deployment - name: Setup webapp deployment folder with the correct permissions
# - name: Setup webapp deployment folder with the correct permissions file: path={{ web_server_home }} state=directory
# file: path=/var/www state=directory owner=vagrant group=www-data mode=0774 owner={{ ansible_env.SUDO_USER }} group={{ web_server_group }} mode=0774
#
# - name: Add vagrant user to www-data - name: Add vagrant user to www-data
# user: name=vagrant append=yes groups=www-data user: name={{ ansible_env.SUDO_USER }} append=yes groups={{ web_server_group }}

View File

@ -16,7 +16,3 @@
pip: name={{ item }} use_mirrors=no pip: name={{ item }} use_mirrors=no
with_items: with_items:
- virtualenv - virtualenv
- virtualenvwrapper
- name: Add virtualenvwrapper to bashrc
lineinfile: dest=/home/vagrant/.bashrc line="source virtualenvwrapper.sh"