From 556fa6613c8852411be4f09f63d8863671a92016 Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Sat, 12 Oct 2024 12:59:33 +0200 Subject: [PATCH] add shortener --- playbooks/apps/all.yaml | 1 + .../apps/files/shortener/docker-compose.yaml | 10 ++++++++++ playbooks/apps/files/shortener/update | 7 +++++++ playbooks/apps/shortener.yaml | 20 +++++++++++++++++++ .../apps/templates/shortener/shortener.env.j2 | 5 +++++ 5 files changed, 43 insertions(+) create mode 100644 playbooks/apps/files/shortener/docker-compose.yaml create mode 100755 playbooks/apps/files/shortener/update create mode 100644 playbooks/apps/shortener.yaml create mode 100644 playbooks/apps/templates/shortener/shortener.env.j2 diff --git a/playbooks/apps/all.yaml b/playbooks/apps/all.yaml index b191e99..b29fa9d 100644 --- a/playbooks/apps/all.yaml +++ b/playbooks/apps/all.yaml @@ -16,5 +16,6 @@ - import_playbook: miniflux.yaml # noqa: name[play] - import_playbook: portainer.yaml # noqa: name[play] - import_playbook: privatebin.yaml # noqa: name[play] +- import_playbook: shortener.yaml # noqa: name[play] - import_playbook: test_headers.yaml # noqa: name[play] - import_playbook: wallabag.yaml # noqa: name[play] diff --git a/playbooks/apps/files/shortener/docker-compose.yaml b/playbooks/apps/files/shortener/docker-compose.yaml new file mode 100644 index 0000000..818e207 --- /dev/null +++ b/playbooks/apps/files/shortener/docker-compose.yaml @@ -0,0 +1,10 @@ +services: + django: + image: rg.fr-par.scw.cloud/crocmagnon/shortener + env_file: shortener.env + restart: always + volumes: + - ./shortener_data:/db + mem_limit: 300m + ports: + - "8011:8000" diff --git a/playbooks/apps/files/shortener/update b/playbooks/apps/files/shortener/update new file mode 100755 index 0000000..4ac92a3 --- /dev/null +++ b/playbooks/apps/files/shortener/update @@ -0,0 +1,7 @@ +#!/bin/bash +set -euxo pipefail +pushd /mnt/data/shortener +docker compose --ansi never pull +docker compose --ansi never up -d +popd +docker image prune -f diff --git a/playbooks/apps/shortener.yaml b/playbooks/apps/shortener.yaml new file mode 100644 index 0000000..ec87892 --- /dev/null +++ b/playbooks/apps/shortener.yaml @@ -0,0 +1,20 @@ +--- +- name: Shortener + hosts: servers + gather_facts: false + tasks: + - name: Docker + ansible.builtin.include_role: + name: docker + + vars: + docker_app_name: shortener + secret_key: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 37353266666433343332313765343531623930613733393865363131616666653532343130316163 + 3965326235653239373561373361643239326665636166610a303461626433306636653638313435 + 61393338643738363765323630623765323238373964306532346664656666623663306330373838 + 3633366163636265660a366465656539383539383665323639623430656265346234303136303937 + 64376439386232663733363539616232656266626465316364323331386633346530373165376231 + 65363935643965356237396235666337343739653164366263386537366338373036393734343565 + 653032643966636463316633616137646235 diff --git a/playbooks/apps/templates/shortener/shortener.env.j2 b/playbooks/apps/templates/shortener/shortener.env.j2 new file mode 100644 index 0000000..8dd356a --- /dev/null +++ b/playbooks/apps/templates/shortener/shortener.env.j2 @@ -0,0 +1,5 @@ +DEBUG=false +SECRET_KEY={{ secret_key }} +DATABASE_URL=sqlite:////db/db.sqlite3 +ALLOWED_HOSTS=localhost,g4b.ovh +CSRF_TRUSTED_ORIGINS=https://g4b.ovh