Add support for CouchDB installation and setup.

This commit is contained in:
Dorian 2015-08-22 13:49:25 -04:00
parent 125d6e5ca8
commit 52efed7d59
6 changed files with 55 additions and 38 deletions

View File

@ -53,15 +53,12 @@ Role Variables
- The database username for the above specified database. - The database username for the above specified database.
- password: - password:
- The database username for the above specified database. - The database username for the above specified database.
- setup_db:
- Flag whether or not to setup the MySQL database directly on the host.
- Default: true
- host: - host:
- Flag whether or not to setup the MySQL database directly on the host. - The hostname of the CouchDB database server.
- Default: localhost - Default: localhost
- port: - port:
- The port of which MySQL database directly on the host. - The port of the CouchDB database server.
- Default: 3306 - Default: 5984
- rookeries_app_name: - rookeries_app_name:
- Configures the unique name of the rookeries app. - Configures the unique name of the rookeries app.
- Default: rookeries - Default: rookeries

View File

@ -4,11 +4,10 @@
# Database soecific inforaation # Database soecific inforaation
rookeries_db: rookeries_db:
db_name: rookeries db_name: rookeries
username: rookeries username: admin
password: system_admin password: password
setup_db: true
host: localhost host: localhost
port: 3306 port: 5984
# The mode of the setup. Setting to "dev" enables the use of a SMTP fake server to help with development. # The mode of the setup. Setting to "dev" enables the use of a SMTP fake server to help with development.
@ -17,7 +16,7 @@ rookeries_environ_type: dev
# TODO Clean up and simplify the configuration. # TODO Clean up and simplify the configuration.
# 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.5.0
# Rookeries deployment configuration # Rookeries deployment configuration
rookeries_app_hostname: localhost rookeries_app_hostname: localhost
@ -40,7 +39,8 @@ rookeries_app_config:
rookeries_secret_key: "development" rookeries_secret_key: "development"
# Database # Database
rookeries_database_uri: "mysql+mysqlconnector://{{ rookeries_db. username}}:{{ rookeries_db.password }}@{{ rookeries_db.host }}:{{ rookeries_db.port }}/{{ rookeries_db.db_name }}?charset=utf8" rookeries_couchdb_database_uri: "http://{{ rookeries_db.username }}:{{ rookeries_db.password }}@{{ rookeries_db.host }}:{{ rookeries_db.port }}/"
rookeries_couchdb_database: "{{ rookeries_db.db_name }}"
# Mail server configuration # Mail server configuration
rookeries_mail_server: "smtp.localhost.net" rookeries_mail_server: "smtp.localhost.net"

32
tasks/couchdb.yaml Normal file
View File

@ -0,0 +1,32 @@
---
- name: install systems to help setup couchdb from a ppa
apt: pkg=python-apt state=present
- name: add the couchdb ppa repository
apt_repository: repo="ppa:couchdb/stable" state=present
- name: install couchdb
apt: pkg=couchdb state=present
with_items:
- couchdb
- couchdb-bin
- couchdb-common
# TODO Add in installation and configuration of py-couchdb views?
# Configure CouchDB
- name: add admin user and password
ini_file: dest=/etc/couchdb/local.ini backup=yes state=present
section=admins option={{ rookeries_db.username }} value={{ rookeries_db.password }}
- name: force couchdb to authenticate users
ini_file: dest=/etc/couchdb/local.ini backup=yes state=present
section=couch_httpd_auth option=require_valid_user value=true
- name: allow couchdb to respond back across network
ini_file: dest=/etc/couchdb/local.ini backup=yes state=present
section=httpd option=bind_address value=0.0.0.0
# Restart couchdb. Should be using the upstart start and stop commands rather than service.
- name: stop couchdb server
service: name=couchdb state=restarted

View File

@ -1,5 +1,5 @@
--- ---
- include: mysql_db.yaml
- include: nodejs.yaml - include: nodejs.yaml
- include: couchdb.yaml
- include: dev_email_server.yaml - include: dev_email_server.yaml
- include: rookeries_deployment.yaml - include: rookeries_deployment.yaml

View File

@ -1,18 +0,0 @@
---
- name: setup MySQL server + Python dependencies
apt: pkg={{ item }} state=present
with_items:
- mysql-server
- python-mysqldb
when: rookeries_db.setup_db
- name: setup MySQL databases for rookeries.
mysql_db: name={{ rookeries_db.db_name }} state=present login_host={{ rookeries_db.host }}
login_port={{ rookeries_db.port }}
when: rookeries_db.setup_db
- name: add MySQL database users for rookeries.
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 }}
when: rookeries_db.setup_db

View File

@ -13,14 +13,20 @@
state=directory recurse=yes state=directory recurse=yes
when: deploy_package.stat.exists when: deploy_package.stat.exists
- name: install rookeries dependencies - name: install extra binary tools for jq dependency
pip: requirements=requirements.txt virtualenv={{ rookeries_venv }} chdir={{ rookeries_deploy_dir }} apt: pkg={{ item }} state=present
with_items:
- autoconf
- bison
- flex
- libtool
- build-essential
- python-dev
- jq
when: deploy_package.stat.exists when: deploy_package.stat.exists
# TODO Remove after transition to CouchDB as a store. - name: install rookeries dependencies
- name: install extra MySQL python connector dependency pip: requirements=requirements.txt virtualenv={{ rookeries_venv }} chdir={{ rookeries_deploy_dir }}
pip: name=mysql-connector-python virtualenv={{ rookeries_venv }} version=1.1.6
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 - name: install frontend dependencies for app