Add pricing v1, locked dependencies, and Ansible deployment files
seat-back-trivia/pipeline/head This commit looks good
seat-back-trivia/pipeline/head This commit looks good
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
40288eade8
commit
88ae7f9158
@@ -0,0 +1,62 @@
|
||||
- name: Deploy a selected immutable pricing release
|
||||
hosts: delivery
|
||||
become: true
|
||||
vars:
|
||||
project_dir: "/opt/startup/pricing-{{ target_env }}"
|
||||
tasks:
|
||||
- name: Validate release selection
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- target_env in ['staging', 'production']
|
||||
- "'@sha256:' in release_image"
|
||||
- expected_version in ['v1', 'v2']
|
||||
- expected_total | int > 0
|
||||
- public_url.startswith('https://')
|
||||
- proxy_network | length > 0
|
||||
- name: Create deployment directory
|
||||
ansible.builtin.file:
|
||||
path: "{{ project_dir }}"
|
||||
state: directory
|
||||
mode: '0750'
|
||||
- name: Render selected Compose configuration
|
||||
ansible.builtin.template:
|
||||
src: compose.yaml.j2
|
||||
dest: "{{ project_dir }}/compose.yaml"
|
||||
mode: '0640'
|
||||
- name: Converge application without rebuilding
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ project_dir }}"
|
||||
project_name: "pricing-{{ target_env }}"
|
||||
state: present
|
||||
build: never
|
||||
pull: missing
|
||||
wait: true
|
||||
wait_timeout: 90
|
||||
- name: Verify health through public TLS endpoint
|
||||
ansible.builtin.uri:
|
||||
url: "{{ public_url }}/health"
|
||||
return_content: true
|
||||
validate_certs: true
|
||||
register: health
|
||||
until: health.status == 200 and health.json.status == 'ok'
|
||||
retries: 12
|
||||
delay: 5
|
||||
changed_when: false
|
||||
- name: Read release identity
|
||||
ansible.builtin.uri:
|
||||
url: "{{ public_url }}/"
|
||||
return_content: true
|
||||
register: identity
|
||||
changed_when: false
|
||||
- name: Exercise business behavior
|
||||
ansible.builtin.uri:
|
||||
url: "{{ public_url }}/price?quantity=3"
|
||||
return_content: true
|
||||
register: price
|
||||
changed_when: false
|
||||
- name: Check release identity and calculation
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- identity.json.version == expected_version
|
||||
- identity.json.commit == expected_commit
|
||||
- price.json.total | int == expected_total | int
|
||||
@@ -0,0 +1,3 @@
|
||||
[delivery]
|
||||
# 172.18.0.1 is the droplet host as seen from the delivery agent on gitea_gitea-net.
|
||||
startup ansible_host=172.18.0.1 ansible_user=deploy ansible_ssh_common_args='-o UserKnownHostsFile=ansible/known_hosts -o StrictHostKeyChecking=yes'
|
||||
@@ -0,0 +1 @@
|
||||
172.18.0.1 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPvkyH0+3FOyLD81nBpbyYomdRhwEUhEnrRLfp7/UQPV
|
||||
@@ -0,0 +1,8 @@
|
||||
# Copy to a release-specific file and replace EVERY placeholder.
|
||||
target_env: staging
|
||||
release_image: git.pollefeys.dev/seatbacktrivia/pricing@sha256:REPLACE_DIGEST
|
||||
expected_version: v1
|
||||
expected_commit: REPLACE_FULL_GIT_COMMIT
|
||||
expected_total: 30
|
||||
public_url: https://staging.pollefeys.dev
|
||||
proxy_network: gitea_gitea-net
|
||||
@@ -0,0 +1,3 @@
|
||||
collections:
|
||||
- name: community.docker
|
||||
version: ">=4.8.0,<6.0.0"
|
||||
@@ -0,0 +1,19 @@
|
||||
services:
|
||||
app:
|
||||
image: "{{ release_image }}"
|
||||
restart: unless-stopped
|
||||
read_only: true
|
||||
tmpfs:
|
||||
- /tmp
|
||||
cap_drop:
|
||||
- ALL
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
networks:
|
||||
edge:
|
||||
aliases:
|
||||
- "pricing-{{ target_env }}"
|
||||
networks:
|
||||
edge:
|
||||
external: true
|
||||
name: "{{ proxy_network }}"
|
||||
Reference in New Issue
Block a user