Add new symlink based deployment setup for Rookeries.

This commit is contained in:
Dorian 2015-07-17 08:23:27 -04:00
parent 3a1cad7105
commit 9c99d02544
5 changed files with 37 additions and 13 deletions

View File

@ -18,9 +18,16 @@ rookeries_environ_type: dev
# Name of the rookeries app # Name of the rookeries app
rookeries_app_name: rookeries rookeries_app_name: rookeries
rookeries_version: 0.4.9 rookeries_version: 0.4.9
# Rookeries deployment configuration
rookeries_app_hostname: localhost rookeries_app_hostname: localhost
rookeries_local_uwsgi_port: 8001 rookeries_local_uwsgi_port: 8001
# TODO Clean up and factor out once better developed.
rookeries_deploy_source: "{{ rookeries_app_name }}-{{ rookeries_version }}-{{ rookeries_app_hostname }}"
rookeries_deploy_target: "{{ rookeries_app_name }}_{{ rookeries_app_hostname }}"
# The default configuration for running rookeries # The default configuration for running rookeries
rookeries_app_config: rookeries_app_config:

View File

@ -13,9 +13,10 @@ galaxy_info:
- development - development
- web - web
dependencies: dependencies:
- { role: dorianpula.nginx-uwsgi-supervisor, - role: dorianpula.nginx-uwsgi-supervisor
app_name: "{{ rookeries_app_name }}", app_name: "{{ rookeries_app_name }}"
app_nginx_hostname: "{{ rookeries_app_hostname }}", app_root_path: "{{ rookeries_app_symlink }}"
app_uwsgi_port: "{{ rookeries_local_uwsgi_port }}", app_nginx_hostname: "{{ rookeries_app_hostname }}"
app_uwsgi_executable: "rookeries:make_rookeries_app()", app_uwsgi_port: "{{ rookeries_local_uwsgi_port }}"
app_uwsgi_envs: "{{ rookeries_app_config }}"} app_uwsgi_executable: "rookeries:make_rookeries_app()"
app_uwsgi_envs: "{{ rookeries_app_config }}"

View File

@ -12,6 +12,7 @@
when: rookeries_db.setup_db when: rookeries_db.setup_db
- name: add MySQL database users for rookeries. - name: add MySQL database users for rookeries.
mysql_user: name={{ rookeries_db.username }} password={{ rookeries_db.password }} priv={{ rookeries_db.db_name }}:ALL mysql_user: name={{ rookeries_db.username }} password={{ rookeries_db.password }}
priv={{ rookeries_db.db_name }}.*:ALL
login_host={{ rookeries_db.host }} login_port={{ rookeries_db.port }} login_host={{ rookeries_db.host }} login_port={{ rookeries_db.port }}
when: rookeries_db.setup_db when: rookeries_db.setup_db

View File

@ -10,7 +10,7 @@
when: deploy_package.stat.exists when: deploy_package.stat.exists
- name: install rookeries dependencies - name: install rookeries dependencies
pip: requirements=requirements.txt virtualenv={{ rookeries_venv }} chdir={{ app_root_path }} pip: requirements=requirements.txt virtualenv={{ rookeries_venv }} chdir={{ rookeries_deploy_dir }}
when: deploy_package.stat.exists when: deploy_package.stat.exists
# TODO Remove after transition to CouchDB as a store. # TODO Remove after transition to CouchDB as a store.
@ -19,13 +19,23 @@
extra_args="--allow-external mysql-connector-python --allow-unverified mysql-connector-python" extra_args="--allow-external mysql-connector-python --allow-unverified mysql-connector-python"
when: deploy_package.stat.exists when: deploy_package.stat.exists
- name: install frontend dependencies for app
npm: path={{ rookeries_deploy_dir }} state=present registry=http://registry.npmjs.org/
when: deploy_package.stat.exists
- name: fix permissions on extracted web app - name: fix permissions on extracted web app
file: path={{ app_root_path }} owner={{ web_server_group }} group={{ web_server_group }} file: path={{ rookeries_deploy_dir }} owner={{ web_server_group }} group={{ web_server_group }}
state=directory recurse=yes state=directory recurse=yes
when: deploy_package.stat.exists when: deploy_package.stat.exists
- name: install frontend dependencies for app - name: add in symlink to deployed package.
npm: path={{ app_root_path }} state=present registry=http://registry.npmjs.org/ file: state=link src={{ rookeries_deploy_dir }} path={{ rookeries_app_symlink }}
owner={{ web_server_group }} group={{ web_server_group }}
when: deploy_package.stat.exists
- name: add in symlink to deployed virtualenv.
file: state=link src={{ rookeries_venv }} path={{ rookeries_venv_symlink }}
owner={{ web_server_group }} group={{ web_server_group }}
notify: notify:
- restart uwsgi app - restart uwsgi app
when: deploy_package.stat.exists when: deploy_package.stat.exists

View File

@ -3,9 +3,14 @@
app_name: "{{ rookeries_app_name }}" app_name: "{{ rookeries_app_name }}"
# Introduced from deployment playbook # Introduced from deployment playbook
rookeries_venv: "{{ virtualenv_root_path }}/{{ rookeries_app_name }}"
rookeries_package: "{{ rookeries_app_name }}-{{ rookeries_version }}.tar.bz2"
rookeries_package: "{{ rookeries_deploy_source }}.tar.bz2"
rookeries_deploy_dir: "{{ web_root_path }}/{{ rookeries_deploy_source }}"
rookeries_venv: "{{ virtualenv_root_path }}/{{ rookeries_deploy_source }}"
rookeries_app_symlink: "{{ web_root_path }}/{{ rookeries_deploy_target }}"
rookeries_venv_symlink: "{{ virtualenv_root_path }}/{{ rookeries_deploy_target }}"
rookeries_package_path: "{{ rookeries_package }}" rookeries_package_path: "{{ rookeries_package }}"
# Extra virtualenv if working in a dev environment to provide the mailsink testing server # Extra virtualenv if working in a dev environment to provide the mailsink testing server