diff --git a/README.md b/README.md index 35e3b22..d0eb5f8 100644 --- a/README.md +++ b/README.md @@ -53,15 +53,12 @@ Role Variables - The database username for the above specified database. - password: - 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: - - Flag whether or not to setup the MySQL database directly on the host. + - The hostname of the CouchDB database server. - Default: localhost - port: - - The port of which MySQL database directly on the host. - - Default: 3306 + - The port of the CouchDB database server. + - Default: 5984 - rookeries_app_name: - Configures the unique name of the rookeries app. - Default: rookeries diff --git a/defaults/main.yml b/defaults/main.yml index 57abd9f..59499e6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -4,11 +4,10 @@ # Database soecific inforaation rookeries_db: db_name: rookeries - username: rookeries - password: system_admin - setup_db: true + username: admin + password: password 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. @@ -17,7 +16,7 @@ rookeries_environ_type: dev # TODO Clean up and simplify the configuration. # Name of the rookeries app rookeries_app_name: rookeries -rookeries_version: 0.4.9 +rookeries_version: 0.5.0 # Rookeries deployment configuration rookeries_app_hostname: localhost @@ -40,8 +39,9 @@ rookeries_app_config: rookeries_secret_key: "development" # 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 rookeries_mail_server: "smtp.localhost.net" rookeries_mail_port: 25 diff --git a/tasks/couchdb.yaml b/tasks/couchdb.yaml new file mode 100644 index 0000000..41282de --- /dev/null +++ b/tasks/couchdb.yaml @@ -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 diff --git a/tasks/main.yml b/tasks/main.yml index 8a2473e..dfef102 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,5 +1,5 @@ --- -- include: mysql_db.yaml - include: nodejs.yaml +- include: couchdb.yaml - include: dev_email_server.yaml - include: rookeries_deployment.yaml diff --git a/tasks/mysql_db.yaml b/tasks/mysql_db.yaml deleted file mode 100644 index 3209f72..0000000 --- a/tasks/mysql_db.yaml +++ /dev/null @@ -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 diff --git a/tasks/rookeries_deployment.yaml b/tasks/rookeries_deployment.yaml index 672624a..152187e 100644 --- a/tasks/rookeries_deployment.yaml +++ b/tasks/rookeries_deployment.yaml @@ -13,14 +13,20 @@ state=directory recurse=yes when: deploy_package.stat.exists -- name: install rookeries dependencies - pip: requirements=requirements.txt virtualenv={{ rookeries_venv }} chdir={{ rookeries_deploy_dir }} +- name: install extra binary tools for jq dependency + apt: pkg={{ item }} state=present + with_items: + - autoconf + - bison + - flex + - libtool + - build-essential + - python-dev + - jq when: deploy_package.stat.exists -# TODO Remove after transition to CouchDB as a store. -- name: 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" +- name: install rookeries dependencies + pip: requirements=requirements.txt virtualenv={{ rookeries_venv }} chdir={{ rookeries_deploy_dir }} when: deploy_package.stat.exists - name: install frontend dependencies for app