From 05ea69faa09fc0de2c2ecbffa71eeb328fed9858 Mon Sep 17 00:00:00 2001
From: Romain Maliach-Auguste <romain@maliach.fr>
Date: Sat, 26 Sep 2020 22:15:22 +0200
Subject: [PATCH] APIKEY.txt mounted... not overwritten by ep :/

---
 pica-etherpad/docker-compose.yml | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/pica-etherpad/docker-compose.yml b/pica-etherpad/docker-compose.yml
index 660ed472..7f83797e 100755
--- a/pica-etherpad/docker-compose.yml
+++ b/pica-etherpad/docker-compose.yml
@@ -9,6 +9,9 @@ volumes:
     name: deleted-pads-standard
   deleted-pads-week:
     name: deleted-pads-week
+  etherpad-api-key-week:
+    name: etherpad-api-key-week
+
 
 networks:
   standard:
@@ -19,6 +22,7 @@ networks:
     external: true
 
 services:
+  # STANDARD CONSERVATION
   etherpad-app:
     image: registry.picasoft.net/pica-etherpad:1.8.6
     build: .
@@ -57,6 +61,7 @@ services:
       - standard
     restart: unless-stopped
 
+  # WEEKLY CONSERVATION
   etherpad-week-app:
     image: registry.picasoft.net/pica-etherpad:1.8.6
     container_name: etherpad-week-app
@@ -65,6 +70,7 @@ services:
     volumes:
       - ./settings_week.json:/opt/etherpad-lite/settings.json
       - deleted-pads-week:/opt/etherpad-lite/deleted_pads
+      - /DATA/docker/etherpad/week/APIKEY.txt:/opt/etherpad-lite/APIKEY.txt
     labels:
       traefik.http.routers.etherpad-week-app.entrypoints: websecure
       traefik.http.routers.etherpad-week-app.rule: Host(`week.pad.picasoft.net`)
@@ -94,3 +100,18 @@ services:
     restart: unless-stopped
     networks:
       - week
+
+  # script COMPLEMENTARY to etherpad plugin ep_delete_after_delay
+  etherpad-week-delete-pad-after-delay:
+    build:
+      context: https://gitlab.utc.fr/picasoft/projets/delete-pad-after-delay.git
+    volumes:   
+      - type: bind #we can't use volume for a single file (and we don't want to put the whole /opt/ep on a volume). Make sure that /DATA/docker/... is only accesible by root! This could be improved if APIKEY was stored in a directory.
+        source: /DATA/docker/etherpad/week/APIKEY.txt
+        target: /APIKEY.txt
+        read_only: True
+    environment:
+      URL: "https://week.pad.picasoft.net"
+      DEL: 1209600 #14 days. MUST be COHERENT with settings_week.json ep_delete_after_delay{
+      DIR: "/opt/etherpad-lite/deleted_pads"
+    container_name: etherpad-week-delete-pad-after-delay
-- 
GitLab