working with login and building inventory
This commit is contained in:
33
playbook.yml
33
playbook.yml
@@ -5,9 +5,15 @@
|
||||
vars:
|
||||
backend_image: sc-inventory-backend
|
||||
frontend_image: sc-inventory-frontend
|
||||
postgres_image: docker.io/library/postgres:16-alpine
|
||||
image_tag: latest
|
||||
network_name: sc-inventory
|
||||
frontend_port: "8080:80"
|
||||
postgres_volume: sc-inventory-data
|
||||
postgres_password: "{{ lookup('env', 'POSTGRES_PASSWORD') | default('sc_inventory_dev', true) }}"
|
||||
database_url: "postgresql+psycopg://sc_inventory:{{ postgres_password }}@db:5432/sc_inventory"
|
||||
# Set to true once the site is served over TLS.
|
||||
cookie_secure: "false"
|
||||
# Set to true to force image rebuilds even when the images already exist
|
||||
force_rebuild: false
|
||||
|
||||
@@ -70,6 +76,27 @@
|
||||
name: "{{ network_name }}"
|
||||
state: present
|
||||
|
||||
- name: Create PostgreSQL data volume
|
||||
containers.podman.podman_volume:
|
||||
name: "{{ postgres_volume }}"
|
||||
state: present
|
||||
|
||||
- name: Run PostgreSQL container (internal only)
|
||||
containers.podman.podman_container:
|
||||
name: sc-inventory-db
|
||||
image: "{{ postgres_image }}"
|
||||
state: started
|
||||
network: "{{ network_name }}"
|
||||
network_aliases:
|
||||
- db
|
||||
env:
|
||||
POSTGRES_USER: sc_inventory
|
||||
POSTGRES_PASSWORD: "{{ postgres_password }}"
|
||||
POSTGRES_DB: sc_inventory
|
||||
volumes:
|
||||
- "{{ postgres_volume }}:/var/lib/postgresql/data:Z"
|
||||
restart_policy: unless-stopped
|
||||
|
||||
- name: Run backend container (internal only)
|
||||
containers.podman.podman_container:
|
||||
name: sc-inventory-backend
|
||||
@@ -80,6 +107,10 @@
|
||||
# nginx upstream (http://backend:8000) resolves in both deployments.
|
||||
network_aliases:
|
||||
- backend
|
||||
env:
|
||||
DATABASE_URL: "{{ database_url }}"
|
||||
DB_WAIT_SECONDS: "60"
|
||||
COOKIE_SECURE: "{{ cookie_secure }}"
|
||||
restart_policy: unless-stopped
|
||||
|
||||
- name: Run frontend container (published port)
|
||||
@@ -98,5 +129,5 @@
|
||||
status_code: 200
|
||||
register: health_result
|
||||
until: health_result.status == 200
|
||||
retries: 5
|
||||
retries: 8
|
||||
delay: 10
|
||||
|
||||
Reference in New Issue
Block a user