From 50138230b4ff843682473e624ff2fbdaf7572f7e Mon Sep 17 00:00:00 2001 From: Phil Date: Mon, 23 Sep 2024 12:19:14 -0600 Subject: [PATCH] Added stirling pdf to stack --- roles/docker/files/Caddyfile | 15 +++++++++++++++ roles/docker/tasks/main.yml | 6 +++++- roles/docker/tasks/stirlingpdf.yml | 19 +++++++++++++++++++ .../docker/templates/stirling-compose.yml.j2 | 18 ++++++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 roles/docker/tasks/stirlingpdf.yml create mode 100644 roles/docker/templates/stirling-compose.yml.j2 diff --git a/roles/docker/files/Caddyfile b/roles/docker/files/Caddyfile index 925be72..5490637 100644 --- a/roles/docker/files/Caddyfile +++ b/roles/docker/files/Caddyfile @@ -40,3 +40,18 @@ home.thesatelliteoflove.com:80 { respond "Access denied" 403 } } + +pdftools.thesatelliteoflove.com:80 { + @allowed { + remote_ip 100.64.0.0/10 + } + + handle @allowed { + reverse_proxy stirling-stirlingpdf-1:8080 + } + + handle { + respond "Access denied" 403 + } +} + diff --git a/roles/docker/tasks/main.yml b/roles/docker/tasks/main.yml index f9ee660..9280ef7 100644 --- a/roles/docker/tasks/main.yml +++ b/roles/docker/tasks/main.yml @@ -92,4 +92,8 @@ - name: Install glance import_tasks: glance.yml - tags: glance \ No newline at end of file + tags: glance + +- name: Install stirlingpdf + import_tasks: stirlingpdf.yml + tags: stirlingpdf \ No newline at end of file diff --git a/roles/docker/tasks/stirlingpdf.yml b/roles/docker/tasks/stirlingpdf.yml new file mode 100644 index 0000000..4528b3e --- /dev/null +++ b/roles/docker/tasks/stirlingpdf.yml @@ -0,0 +1,19 @@ +- name: make stirling directories + ansible.builtin.file: + path: "{{ item}}" + state: directory + loop: + - /opt/stacks/stirling + +- name: Template out the compose file + ansible.builtin.template: + src: stirling-compose.yml.j2 + dest: /opt/stacks/stirling/compose.yml + owner: root + mode: 644 + +- name: deploy stirling stack + community.docker.docker_compose_v2: + project_src: /opt/stacks/stirling + files: + - compose.yml \ No newline at end of file diff --git a/roles/docker/templates/stirling-compose.yml.j2 b/roles/docker/templates/stirling-compose.yml.j2 new file mode 100644 index 0000000..a903680 --- /dev/null +++ b/roles/docker/templates/stirling-compose.yml.j2 @@ -0,0 +1,18 @@ +version: '3.3' +services: + stirlingpdf: + image: frooodle/s-pdf:latest + volumes: + - ./trainingData:/usr/share/tessdata #Required for extra OCR languages + - ./extraConfigs:/configs +# - ./customFiles:/customFiles/ +# - ./logs:/logs/ + environment: + - DOCKER_ENABLE_SECURITY=false + - INSTALL_BOOK_AND_ADVANCED_HTML_OPS=false + - LANGS=en_GB + +networks: + default: + external: true + name: lava