mirror of
https://github.com/Crocmagnon/ansible.git
synced 2024-12-24 23:11:58 +01:00
add checkout
This commit is contained in:
parent
638574dd10
commit
ed9fe33ccb
6 changed files with 98 additions and 0 deletions
|
@ -15,6 +15,7 @@
|
|||
mode: preserve
|
||||
with_fileglob:
|
||||
- files/{{ app_name }}/*
|
||||
- files/{{ app_name }}/.*
|
||||
notify:
|
||||
- Restart service
|
||||
- name: Write templates
|
||||
|
|
61
playbooks/apps/checkout.yaml
Normal file
61
playbooks/apps/checkout.yaml
Normal file
|
@ -0,0 +1,61 @@
|
|||
---
|
||||
- name: Checkout
|
||||
hosts: servers
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: Create dir
|
||||
ansible.builtin.file:
|
||||
path: "{{ dir }}"
|
||||
state: directory
|
||||
mode: "0775"
|
||||
- name: Write files
|
||||
ansible.builtin.copy:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ dir }}/"
|
||||
mode: preserve
|
||||
with_fileglob:
|
||||
- files/{{ app_name }}/*
|
||||
- files/{{ app_name }}/.*
|
||||
notify:
|
||||
- Restart service
|
||||
- name: Write templates
|
||||
ansible.builtin.template:
|
||||
src: "{{ item }}"
|
||||
dest: "{{ dir }}/{{ item | basename | regex_replace('\\.j2$', '') }}"
|
||||
mode: preserve
|
||||
with_fileglob:
|
||||
- templates/{{ app_name }}/*.j2
|
||||
- templates/{{ app_name }}/.*.j2
|
||||
notify:
|
||||
- Restart service
|
||||
- name: Ensure service is started
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ dir }}"
|
||||
state: present
|
||||
|
||||
handlers:
|
||||
- name: Restart service
|
||||
community.docker.docker_compose_v2:
|
||||
project_src: "{{ dir }}"
|
||||
state: restarted
|
||||
|
||||
vars:
|
||||
app_name: checkout
|
||||
dir: /mnt/data/{{ app_name }}
|
||||
secret_key: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
33393761643061393863616663323863663033313865383135663939636433393730643831616231
|
||||
6661313965396164373665663063653461336230313762640a643763346132663238613362336563
|
||||
35643862643139306333346163646161323031376237623661333434326639303233666135616635
|
||||
3135333138336164380a396666363830316237643432366237626431616565376261336534346366
|
||||
64656461343037323137643235373836633766366465373335653162623564653235623362303732
|
||||
34313332316165643437613737663461656231326530356334353237643633303133306561303762
|
||||
643439313139613931313630636333626532
|
||||
mailgun_api_key: !vault |
|
||||
$ANSIBLE_VAULT;1.1;AES256
|
||||
34656232613133373865613436623261656331663632666334626664366238636564633931613534
|
||||
3137313234343739333738386664333532613066383533610a613337383462393432303235366132
|
||||
30333433353362653765343638346639333735356631633633633633663863396139646431393463
|
||||
3031346139393432390a336235363635653461303762393731313034393566333031356434386362
|
||||
37333861343838623338663062303539616331323262643031613130363766626261653130373631
|
||||
3063393236333239363366333338303665363930303031373965
|
14
playbooks/apps/files/checkout/docker-compose.yml
Normal file
14
playbooks/apps/files/checkout/docker-compose.yml
Normal file
|
@ -0,0 +1,14 @@
|
|||
services:
|
||||
django:
|
||||
image: crocmagnon/checkout:latest
|
||||
env_file:
|
||||
- .env
|
||||
volumes:
|
||||
- ./db:/app/db
|
||||
- ./media:/app/media
|
||||
ports:
|
||||
- "8002:8000"
|
||||
restart: always
|
||||
init: true
|
||||
tty: true
|
||||
mem_limit: 512m
|
6
playbooks/apps/files/checkout/generate_data
Executable file
6
playbooks/apps/files/checkout/generate_data
Executable file
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
pushd /mnt/data/checkout
|
||||
docker compose exec django python manage.py clear_all_data
|
||||
docker compose exec django python manage.py generate_dummy_baskets
|
||||
popd
|
9
playbooks/apps/files/checkout/update
Executable file
9
playbooks/apps/files/checkout/update
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/bash
|
||||
set -euxo pipefail
|
||||
pushd /mnt/data/checkout
|
||||
docker compose --ansi never pull --quiet
|
||||
docker compose --ansi never up -d
|
||||
docker compose exec django python manage.py migrate
|
||||
docker compose exec django python manage.py refresh_cache
|
||||
popd
|
||||
docker image prune -f
|
7
playbooks/apps/templates/checkout/.env.j2
Normal file
7
playbooks/apps/templates/checkout/.env.j2
Normal file
|
@ -0,0 +1,7 @@
|
|||
SECRET_KEY='{{ secret_key }}'
|
||||
DEBUG=false
|
||||
HOSTS=checkout.augendre.info
|
||||
ADMINS=Gabriel Augendre|gabriel@augendre.info
|
||||
MAILGUN_API_KEY={{ mailgun_api_key }}
|
||||
MAILGUN_SENDER_DOMAIN=mg.augendre.info
|
||||
MPLCONFIGDIR=/app/.matplotlib
|
Loading…
Reference in a new issue