Stop Bodhi's pods when there are migrations to run during upgrade.
Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
This commit is contained in:
parent
6715f6ce19
commit
26e8e02922
3 changed files with 34 additions and 9 deletions
|
@ -23,6 +23,9 @@ wsgi_fedmsg_service: bodhi
|
||||||
wsgi_procs: 4
|
wsgi_procs: 4
|
||||||
wsgi_threads: 15
|
wsgi_threads: 15
|
||||||
|
|
||||||
|
# How many openshift pods do we want?
|
||||||
|
openshift_pods: 2
|
||||||
|
|
||||||
tcp_ports: [ 80 ]
|
tcp_ports: [ 80 ]
|
||||||
|
|
||||||
# Neeed for rsync from log01 for logs.
|
# Neeed for rsync from log01 for logs.
|
||||||
|
|
|
@ -21,6 +21,9 @@ wsgi_fedmsg_service: bodhi
|
||||||
wsgi_procs: 2
|
wsgi_procs: 2
|
||||||
wsgi_threads: 2
|
wsgi_threads: 2
|
||||||
|
|
||||||
|
# How many openshift pods do we want?
|
||||||
|
openshift_pods: 1
|
||||||
|
|
||||||
tcp_ports: [ 80 ]
|
tcp_ports: [ 80 ]
|
||||||
|
|
||||||
# Neeed for rsync from log01 for logs.
|
# Neeed for rsync from log01 for logs.
|
||||||
|
|
|
@ -45,8 +45,24 @@
|
||||||
- python2-fedmsg-atomic-composer
|
- python2-fedmsg-atomic-composer
|
||||||
when: testing
|
when: testing
|
||||||
|
|
||||||
- name: verify the frontend and stop it
|
- name: find out if there are migrations to run
|
||||||
hosts: bodhi2:bodhi2-stg
|
hosts: bodhi-backend:bodhi-backend-stg
|
||||||
|
user: root
|
||||||
|
vars_files:
|
||||||
|
- /srv/web/infra/ansible/vars/global.yml
|
||||||
|
- "/srv/private/ansible/vars.yml"
|
||||||
|
- /srv/web/infra/ansible/vars/{{ ansible_distribution }}.yml
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Find out what the current migration version is
|
||||||
|
command: /usr/bin/python2 /usr/bin/alembic -c /etc/bodhi/alembic.ini current
|
||||||
|
register: current_migration_version
|
||||||
|
- name: Find out what the latest available migration version is
|
||||||
|
command: /usr/bin/python2 /usr/bin/alembic -c /etc/bodhi/alembic.ini heads
|
||||||
|
register: latest_migration_version
|
||||||
|
|
||||||
|
- name: Stop the front end if there are migrations to run
|
||||||
|
hosts: os-master01.stg.phx2.fedoraproject.org:os-master01.phx2.fedoraproject.org
|
||||||
user: root
|
user: root
|
||||||
vars_files:
|
vars_files:
|
||||||
- /srv/web/infra/ansible/vars/global.yml
|
- /srv/web/infra/ansible/vars/global.yml
|
||||||
|
@ -61,11 +77,12 @@
|
||||||
delegate_to: noc01.phx2.fedoraproject.org
|
delegate_to: noc01.phx2.fedoraproject.org
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
roles:
|
tasks:
|
||||||
- bodhi2/base
|
- set_fact:
|
||||||
|
migrations: hostvars['bodhi-backend01{{ env_suffix }}.phx2.fedoraproject.org']['current_migration_version'].stdout + ' (head)' != hostvars['bodhi-backend01{{ env_suffix }}.phx2.fedoraproject.org']['latest_migration_version'].stdout
|
||||||
post_tasks:
|
- name: Scale down to 0 pods
|
||||||
- service: name="httpd" state=stopped
|
command: oc -n bodhi scale dc/bodhi-web --replicas=0
|
||||||
|
when: migrations
|
||||||
|
|
||||||
- name: verify the backends, stop them, and then upgrade the db
|
- name: verify the backends, stop them, and then upgrade the db
|
||||||
hosts: bodhi-backend:bodhi-backend-stg
|
hosts: bodhi-backend:bodhi-backend-stg
|
||||||
|
@ -106,7 +123,7 @@
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
|
||||||
- name: restart the frontend
|
- name: restart the frontend
|
||||||
hosts: bodhi2:bodhi2-stg
|
hosts: os-master01.stg.phx2.fedoraproject.org:os-master01.phx2.fedoraproject.org
|
||||||
user: root
|
user: root
|
||||||
vars_files:
|
vars_files:
|
||||||
- /srv/web/infra/ansible/vars/global.yml
|
- /srv/web/infra/ansible/vars/global.yml
|
||||||
|
@ -116,7 +133,9 @@
|
||||||
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
- import_tasks: "{{ handlers_path }}/restart_services.yml"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- service: name="httpd" state=started
|
- name: Scale up pods
|
||||||
|
command: oc -n bodhi scale dc/bodhi-web --replicas={{ openshift_pods }}
|
||||||
|
when: migrations
|
||||||
|
|
||||||
post_tasks:
|
post_tasks:
|
||||||
- name: tell nagios to unshush w.r.t. the frontend
|
- name: tell nagios to unshush w.r.t. the frontend
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue