Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart marathon apps #2320

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,7 @@ provision:
publish:
cd developer-portal && make publish

.PHONY: prepare config up destroy provision publish
restart-apps:
ansible-playbook -v tabernacle/ansible/restart_marathon_apps.yml

.PHONY: prepare config up destroy provision publish restart-apps
6 changes: 6 additions & 0 deletions tabernacle/ansible/restart_marathon_apps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---

- name: Restart apps in marathon
hosts: localhost
roles:
- { role: dev/restart_marathon_apps }
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
machine_ip: "{{ lookup('env','MACHINE_IP') }}"
machine_server: "{{machine_ip}}:8080"
base_url: http://{{machine_server}}/v2/apps/

jq: "[.apps[] | [.tasksRunning, .tasksHealthy, .tasksUnhealthy, .tasksStaged]] | unique"
61 changes: 61 additions & 0 deletions tabernacle/ansible/roles/dev/restart_marathon_apps/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---

- name: Check if machine ip is empty
assert:
that:
- machine_ip != ""
msg: "No machine ip was specified"

- name: Restart Applications
uri:
url: "{{base_url}}/highlander/{{item.group}}/{{item.app}}/restart"
method: POST
with_items:
- { group: core-backend, app: isaac }
- { group: core-backend, app: middlewarehouse }
- { group: core-backend, app: phoenix }
- { group: core-backend, app: solomon }

- { group: core-consumers, app: capture-consumer }
- { group: core-consumers, app: customer-groups-consumer }
- { group: core-consumers, app: gift-card-consumer }
- { group: core-consumers, app: green-river }
- { group: core-consumers, app: shipments-consumer }

- { group: core-frontend, app: ashes }
- { group: core-frontend, app: peacock }
- { group: core-frontend, app: perfect-gourmet }
- { group: core-frontend, app: top-drawer }

- { group: core-integrations, app: geronimo }
- { group: core-integrations, app: messaging }
- { group: core-integrations, app: hyperion }

- { group: ic-backend, app: anthill }
- { group: ic-backend, app: bernardo }
- { group: ic-backend, app: eggcrate }
- { group: ic-backend, app: river-rock }

- { group: ic-consumers, app: digger-sphex-consumer }
- { group: ic-consumers, app: orders-anthill }
- { group: ic-consumers, app: orders-reviews }
- { group: ic-consumers, app: orders-sphex }
- { group: ic-consumers, app: product-activity }

- { group: ic-hooks, app: neo4j-reset }

- { group: ic-integrations, app: suggester }

- { group: ic-storage, app: henhouse }
- { group: ic-storage, app: neo4j }
when: marathon_apps[item.app]

- name: Sleep for 5 seconds
shell: sleep 5

- name: Wait for the apps to be healthy
shell: curl -sS -XGET {{base_url}} | jq -c '{{jq}}'
register: unhealthy_task
until: unhealthy_task.stdout == '[[1,1,0,0]]'
retries: "{{marathon_retries}}"
delay: "{{marathon_delay}}"
47 changes: 47 additions & 0 deletions tabernacle/ansible/roles/dev/restart_marathon_apps/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
marathon_apps:
# core-backend group
isaac: "{{ lookup('env', 'ISAAC_RESTART') | default(false) }}"
middlewarehouse: "{{ lookup('env', 'MIDDLEWAREHOUSE_RESTART') | default(false) }}"
phoenix: "{{ lookup('env', 'PHOENIX_RESTART') | default(false) }}"
solomon: "{{ lookup('env', 'SOLOMON_RESTART') | default(false) }}"

# core-consumers group
capture-consumer: "{{ lookup('env', 'CAPTURE_RESTART') | default(false) }}"
customer-groups-consumer: "{{ lookup('env', 'CG_RESTART') | default(false) }}"
gift-card-consumer: "{{ lookup('env', 'GC_RESTART') | default(false) }}"
green-river: "{{ lookup('env', 'GREEN_RIVER_RESTART') | default(false) }}"
shipments-consumer: "{{ lookup('env', 'SHIPMENTS_RESTART') | default(false) }}"

# core-frontend group
ashes: "{{ lookup('env', 'ASHES_RESTART') | default(false) }}"
peacock: "{{ lookup('env', 'PEACOCK_RESTART') | default(false) }}"
perfect-gourmet: "{{ lookup('env', 'TPG_RESTART') | default(false) }}"
top-drawer: "{{ lookup('env', 'TD_RESTART') | default(false) }}"

# core-integrations group
geronimo: "{{ lookup('env', 'GERONIMO_RESTART') | default(false) }}"
messaging: "{{ lookup('env', 'MESSAGING_RESTART') | default(false) }}"
hyperion: "{{ lookup('env', 'HYPERION_RESTART') | default(false) }}"

# ic-backend group
anthill: "{{ lookup('env', 'ANTHILL_RESTART') | default(false) }}"
bernardo: "{{ lookup('env', 'BERNARDO_RESTART') | default(false) }}"
eggcrate: "{{ lookup('env', 'EGGCRATE_RESTART') | default(false) }}"
river-rock: "{{ lookup('env', 'RIVER_ROCK_RESTART') | default(false) }}"

# ic-consumers group
digger-sphex-consumer: "{{ lookup('env', 'DIGGER_SPHEX_RESTART') | default(false) }}"
orders-anthill: "{{ lookup('env', 'ORDERS_ANTHILL_RESTART') | default(false) }}"
orders-reviews: "{{ lookup('env', 'ORDERS_REVIEWS_RESTART') | default(false) }}"
orders-sphex: "{{ lookup('env', 'ORDERS_SPHEX_RESTART') | default(false) }}"
product-activity: "{{ lookup('env', 'PRODUCT_ACTIVITY_RESTART') | default(false) }}"

# ic-hooks group
neo4j-reset: "{{ lookup('env', 'NEO4J_RESET_RESTART') | default(false) }}"

# ic-integrations group
suggester: "{{ lookup('env', 'SUGGESTER_RESTART') | default(false) }}"

# ic-storage group
henhouse: "{{ lookup('env', 'HENHOUSE_RESTART') | default(false) }}"
neo4j: "{{ lookup('env', 'NEO4J_RESTART') | default(false) }}"