Add stop.sh (compose down) and disable print_forge.
Sync runner checkout / sync (pull_request) Successful in 6s
Sync runner checkout / sync (pull_request) Successful in 6s
Closes #33. Deploy skips host_apps.enabled: false so CI cannot resurrect a stopped app.
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
---
|
||||
# Stop one app+env. CI/manual must pass: app=<name> app_env=<beta|prod>
|
||||
#
|
||||
# Matches host_apps including enabled: false. Hosts without that row skip.
|
||||
# Django/compose → docker compose down (no -v). Node-static → message only.
|
||||
|
||||
- name: Fail unless app and app_env extra-vars set
|
||||
ansible.builtin.fail:
|
||||
msg: "stop-apps.yml requires -e app=<name> -e app_env=<beta|prod>"
|
||||
when: app is not defined or app_env is not defined
|
||||
|
||||
- name: Classify catalog by type
|
||||
ansible.builtin.set_fact:
|
||||
django_names: "{{ app_catalog | dict2items | selectattr('value.type', 'equalto', 'django') | map(attribute='key') | list }}"
|
||||
node_names: "{{ app_catalog | dict2items | selectattr('value.type', 'equalto', 'node-static') | map(attribute='key') | list }}"
|
||||
|
||||
- name: Fail when requested app missing from app_catalog
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
app={{ app }} is not in app_catalog. Known: {{ app_catalog.keys() | list }}.
|
||||
when: app not in app_catalog
|
||||
|
||||
- name: Resolve stop targets for {{ inventory_hostname }}
|
||||
ansible.builtin.set_fact:
|
||||
stop_targets: "{{ host_apps | default([]) | selectattr('name', 'equalto', app) | selectattr('env', 'equalto', app_env) | list }}"
|
||||
|
||||
- name: Skip {{ inventory_hostname }} — no host_apps row for {{ app }}/{{ app_env }}
|
||||
ansible.builtin.debug:
|
||||
msg: "skip {{ inventory_hostname }}: no host_apps entry for app={{ app }} env={{ app_env }}"
|
||||
when: stop_targets | length == 0
|
||||
|
||||
- name: Skip node-static {{ app }}/{{ app_env }} (no compose project)
|
||||
ansible.builtin.debug:
|
||||
msg: >-
|
||||
{{ app }} is node-static. stop.sh only compose-downs Django apps.
|
||||
Drop the host_apps row (or set enabled: false) and re-run deploy.sh
|
||||
so web-static regenerates nginx without that vhost.
|
||||
when:
|
||||
- stop_targets | length > 0
|
||||
- app in node_names
|
||||
|
||||
- name: Stop Django (docker compose) apps
|
||||
ansible.builtin.include_tasks: stop_django.yml
|
||||
loop: "{{ stop_targets | selectattr('name', 'in', django_names) | list }}"
|
||||
loop_control:
|
||||
loop_var: app_item
|
||||
label: "{{ app_item.name }}/{{ app_item.env }}"
|
||||
Reference in New Issue
Block a user