Add staging Compose baseline and controlled port failure configuration
startup-product-gitea-ci/pipeline/pr-main This commit looks good

This commit is contained in:
2026-11-26 03:16:02 -05:00
parent 1e6842e83c
commit 3174db92a2
3 changed files with 168 additions and 0 deletions
@@ -0,0 +1,83 @@
---
- name: Prepare protected staging Compose configuration
hosts: all
gather_facts: false
any_errors_fatal: true
serial: 1
vars:
staging_directory: /opt/secure-delivery/chapter6-staging
staging_container: startup-pricing-staging
expected_original_id: "8686354a1be5c1d181bcfbf64c610caf286e4a82b475021394f13a7abb4db49b"
tasks:
- name: Inspect original staging container
ansible.builtin.command:
argv:
- docker
- inspect
- "{{ staging_container }}"
register: staging_inspect
changed_when: false
check_mode: false
- name: Verify original staging identity
ansible.builtin.assert:
that:
- (staging_inspect.stdout | from_json)[0].Id == expected_original_id
- (staging_inspect.stdout | from_json)[0].State.Running
- name: Create protected staging directory
ansible.builtin.file:
path: "{{ staging_directory }}"
state: directory
owner: root
group: root
mode: "0700"
- name: Install healthy Compose configuration
ansible.builtin.copy:
src: ../recovery/staging/compose.yml
dest: "{{ staging_directory }}/compose.yml"
owner: root
group: root
mode: "0600"
backup: true
- name: Validate Compose configuration
ansible.builtin.command:
argv:
- docker
- compose
- -p
- chapter6-staging
- -f
- "{{ staging_directory }}/compose.yml"
- config
- --quiet
changed_when: false
when: not ansible_check_mode
- name: Verify existing staging health
ansible.builtin.uri:
url: http://127.0.0.1:5062/health
return_content: true
status_code: 200
register: staging_health
check_mode: false
- name: Verify production HTTPS health
ansible.builtin.uri:
url: https://pricing.nageshwaran.dev/health
return_content: true
status_code: 200
register: production_health
check_mode: false
- name: Confirm both environments remain healthy
ansible.builtin.assert:
that:
- staging_health.json.status == "healthy"
- staging_health.json.version == "v2"
- production_health.json.status == "healthy"
- production_health.json.version == "v2"