Skip to content

Commit

Permalink
Fix refresh permission issues. (ansible#16)
Browse files Browse the repository at this point in the history
* Fix refresh permissin issues.

* Add Philippines services dev server to hosts file

- Also organize some of the hosts info

* Hotfix - remove duplicate ke services definition

* Add documentation for setting up vagrant locally

- Add minor improvements to deploy scripts

* Correct /etc/hosts file entry

* Add profiling services IP for Philippines (ansible#18)

* Update Philippines server IPs

- Assign new IPs for server API, services Production & Payments servers

* Add a role to configure cloudwatch alerts

* Add newrelic deploy role (ansible#21)

* Resolve conflicts
  • Loading branch information
kihahu committed Sep 6, 2016
1 parent b21855d commit 50ea96b
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 125 deletions.
11 changes: 8 additions & 3 deletions provisioning/group_vars/devops/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ internal_databases:

files_to_copy:
- tables
- users.sql
- user_admin_paths.sql

source_db_host: "backup-replica.ceiehgxanvdu.us-west-2.rds.amazonaws.com"
target_db_host: "internal-testing-db.ceiehgxanvdu.us-west-2.rds.amazonaws.com"
Expand All @@ -52,8 +50,15 @@ dump_tables:
- manual_payers
- message_template
- referral_reward_type
- user_admin_paths
- do_not_disturb
- error_message_template
- experiment
- loan_type
- manual_payers
- message_template
- referral_reward_type
- users
- user_admin_paths

newrelic_repo: "deb http://apt.newrelic.com/debian/ newrelic non-free"
newrelic_loglevel: info
Expand Down
20 changes: 10 additions & 10 deletions provisioning/group_vars/ph-devops/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
country_code: ph
aws_region: ap-southeast-1
database: "loans"
database_qa: "loans_ph_qa"
database_qa2: "loans_ph_qa2"
database_staging: "loans_ph_staging"
database_demo: "loans_ph_demo"
database_dev: "loans_ph_dev"
database_qa: "loans_qa"
database_qa2: "loans_qa2"
database_staging: "loans_staging"
database_demo: "loans_demo"
database_dev: "loans_dev"
internal_databases:
- loans_ph_qa
- loans_ph_qa2
- loans_ph_dev
- loans_ph_staging
- loans_ph_demo
- loans_qa
- loans_qa2
- loans_dev
- loans_staging
- loans_demo
source_db_host: "ap-singapore-replica.cwd2hhzm4zws.ap-southeast-1.rds.amazonaws.com"
target_db_host: "internal-testing-db-aps.cwd2hhzm4zws.ap-southeast-1.rds.amazonaws.com"
tables: "tables"
Expand Down
1 change: 0 additions & 1 deletion provisioning/roles/copy-prod-db/files/tables
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ auth_code_status
auth_code_type
auth_verification_question
error_message_template
experiment
loan_type
manual_payers
message_template
Expand Down
32 changes: 0 additions & 32 deletions provisioning/roles/copy-prod-db/files/user_admin_paths.sql

This file was deleted.

36 changes: 0 additions & 36 deletions provisioning/roles/copy-prod-db/files/users.sql

This file was deleted.

5 changes: 1 addition & 4 deletions provisioning/roles/copy-prod-db/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@
- country-setup-pull
- country-setup-push

- name: Copy loans db base tables
copy: src=tables dest={{ destination_folder }}/tables

- name: copy the tables file
- name: copy the base tables file
copy: src={{ item }} dest={{ destination_folder }}/{{ item }}
with_items:
- "{{ files_to_copy }}"
Expand Down
4 changes: 2 additions & 2 deletions provisioning/roles/copy-prod-db/tasks/new_country.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
- country-setup-pull

- name: Dump functional tables seeded with data
command: mysqldump -u {{ source_db_username }} -h {{ source_db_host }} -p'{{ source_db_password }}' {{ database }} {{ item }} --result-file={{ destination_folder }}/{{ item }}.sql
command: mysqldump -u {{ target_db_username }} -h {{ target_db_host }} -p'{{ target_db_password }}' {{ database_qa }} {{ item }} --result-file={{ destination_folder }}/{{ item }}.sql
with_items:
- "{{ dump_tables }}"
tags:
- country-setup-pull

- name: Pull down the db schemas
- name: Pull down the loans schemas
fetch: src={{ destination_folder }}/{{ database }}.sql dest={{ destination_folder }}/{{ database }}.sql flat=yes
tags:
- country-setup-pull
Expand Down
4 changes: 0 additions & 4 deletions provisioning/roles/copy-prod-db/templates/.my.cnf.j2

This file was deleted.

15 changes: 10 additions & 5 deletions provisioning/roles/copy-prod-db/templates/restore_loans.sh.j2
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#!/bin/bash

#Import the dumped tables into the internal mysql server
for j in {{ database_qa }} {{ database_qa2 }} {{ database_staging }} {{ database_demo }} {{ database_dev }}
do
mysql -u {{ target_db_username }} -p"{{ target_db_password }}" -h {{ target_db_host }} $j < {{ destination_folder }}/{{ database }}.sql
done
#Import the dumped loans schema with no data into the internal mysql server
new_country_import()
{
for j in {{ database_qa }} {{ database_qa2 }} {{ database_staging }} {{ database_demo }} {{ database_dev }}
do
mysql -u {{ target_db_username }} -p'{{ target_db_password }}' -h {{ target_db_host }} $j < {{ destination_folder }}/{{ database }}.sql
done
}

new_country_import
15 changes: 10 additions & 5 deletions provisioning/roles/copy-prod-db/templates/restore_tables.sh.j2
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
#!/bin/bash

#Import the dumped tables into the internal mysql server
for j in {{ database_qa }} {{ database_qa2 }} {{ database_staging }} {{ database_demo }} {{ database_dev }}
do
for i in $(cat {{ destination_folder }}/{{ tables }})
new_country_base_tables_import()
{
for j in {{ database_qa }} {{ database_qa2 }} {{ database_staging }} {{ database_demo }} {{ database_dev }}
do
mysql -u {{ target_db_username }} -p"{{ target_db_password }}" -h {{ target_db_host }} $j < {{ destination_folder }}/$i.sql
for i in $(cat {{ destination_folder }}/{{ tables }})
do
mysql -u {{ target_db_username }} -p'{{ target_db_password }}' -h {{ target_db_host }} $j < {{ destination_folder }}/$i.sql
done
done
done
}

new_country_base_tables_import
Loading

0 comments on commit 50ea96b

Please sign in to comment.