add charasheet

This commit is contained in:
Gabriel Augendre 2024-10-11 17:18:53 +02:00
parent 624fb2492a
commit 12eaa03650
7 changed files with 94 additions and 0 deletions

View file

@ -3,5 +3,6 @@ profile: production
strict: true
exclude_paths:
- "**/*docker-compose.yaml"
- "**/*docker-compose.yml"
- .github/
- .pre-commit-config.yaml

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
vault.pass
.idea
.cache_ggshield

View file

@ -1,6 +1,7 @@
---
- import_playbook: bin.yaml # noqa: name[play]
- import_playbook: caddy.yaml # noqa: name[play]
- import_playbook: charasheet.yaml # noqa: name[play]
- import_playbook: ghost-update.yaml # noqa: name[play]
- import_playbook: gitea.yaml # noqa: name[play]
- import_playbook: goatcounter.yaml # noqa: name[play]

View file

@ -0,0 +1,61 @@
---
- name: Charasheet
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 }}/*
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: charasheet
dir: /mnt/data/{{ app_name }}
secret_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
35666131616231643064336266303061326534356131666364633932373330663637343836353837
3438356431373434613435613165313631333133396133360a363335326135613537633132306530
33623239356433393361393737386461626230613561326632623736303038303130396530353538
3561613065623130620a306631393062613161333335366261386534623539646361663736306432
30636239663263623938383137363034633061343163393665363932376662663063336634316261
63363166656462343763343263373535353763303939316430613335653033303036313864616234
313763346663393432323132386536326636
mailgun_api_key: !vault |
$ANSIBLE_VAULT;1.1;AES256
38613137366132646234316137646431373839343530316536326230643035643635643431663064
6531316662373736656230336361353261633862323939310a353637366466643334333436373464
34616564303465396333326333393462343339643636653231623536613431623135373836626261
6632633330383265350a316632303961643363393332636635313333643561653031313038396535
37666334346634306263613063383061393264366163633939373165616461383831383364353364
33383366326138373862323166653531363233643861363132336363306137363737356633643235
393863373065633639656232373732383632

View file

@ -0,0 +1,15 @@
services:
django:
image: crocmagnon/charasheet:latest
env_file:
- .env
volumes:
- ./db:/app/db
- ./data:/app/data
ports:
- "8001:8000"
user: 1000:1000
restart: always
init: true
tty: true
mem_limit: 512m

View file

@ -0,0 +1,8 @@
#!/bin/bash
set -euxo pipefail
pushd /mnt/data/charasheet
docker compose --ansi never pull --quiet
docker compose --ansi never up -d
docker compose exec django python manage.py migrate
popd
docker image prune -f

View file

@ -0,0 +1,7 @@
SECRET_KEY='{{ secret_key }}'
DEBUG=false
ALLOWED_HOSTS=charasheet.augendre.info,localhost
MAILGUN_API_KEY={{ mailgun_api_key }}
MAILGUN_SENDER_DOMAIN=mg.augendre.info
REGISTRATION_OPEN=true
CSRF_TRUSTED_ORIGINS=https://charasheet.augendre.info