diff --git a/pica-etherpad/docker-compose.yml b/pica-etherpad/docker-compose.yml index ebf3a3346a6bfd920f8474bc12f4dc98a3ea8136..112df4563269508ca275a29505c394a9cd30da97 100755 --- a/pica-etherpad/docker-compose.yml +++ b/pica-etherpad/docker-compose.yml @@ -1,47 +1,83 @@ version : "3.7" +#Everything in this dockerfile is duplicated: there is a "standard" instance and a "week" instance. +#Each one of them has its own 3 volumes, 2 networks and 3 containers. +#The settings.json and settings_week.json in the directory of this docker-compose are bound (mounted) to the app containers. +#It also requires the existence of "secret" files containing passwords. +#This docker-compose requires the existence of an external network, "proxy". Traefik labels have been added, so "proxy" can be a traefik reverse-proxy. + volumes: - etherpad-db: + #DATABASES + standard_db: name: etherpad-db-pg - weekpad-db: + week_db: name: weekpad-db - deleted-pads-standard: + #BACKUP OF DELETED PADS + standard_deleted-pads: name: deleted-pads-standard - deleted-pads-week: + week_deleted-pads: name: deleted-pads-week - etherpad-api-key-week: - name: etherpad-api-key-week - api-key-standard: - name: etherpad-api-key-standard - api-key-week: - name: etherpad-api-key-week + #FOR SHARING THE API KEY between app and dpad (written to a text file by app) + standard_api-key: + name: etherpad_standard_api-key + week_api-key: + name: etherpad_week_api-key networks: - standard: - name: etherpad_main - week: - name: etherpad_week + #app-db: used by the app to query its postgresql database + standard_app-db: + name: etherpad_standard_app-queries-database + week_app-db: + name: etherpad_week_app-queries-database + #dpad-app: used by the dpad script to query the app via its web API + standard_dpad-app: + name: etherpad_standard_dpad-queries-app + week_dpad-app: + name: etherpad_week-dpad-queries-app + #this network has access to the apps, exposing their web frontends proxy: external: true services: - # STANDARD CONSERVATION - etherpad-app: + + standard_db: + image: postgres:12 + container_name: etherpad_standard_db + volumes: + - standard_db:/var/lib/postgresql/data + env_file: ./secrets/etherpad-db.secrets + networks: + - standard_app-db + restart: unless-stopped + + week_db: + image: postgres:12 + container_name: etherpad_week_db + volumes: + - week_db:/var/lib/postgresql/data + env_file: ./secrets/etherpad-week-db.secrets + networks: + - week_app-db + + + standard_app: image: registry.picasoft.net/pica-etherpad:1.8.6 build: . - container_name: etherpad-app + container_name: etherpad_standard_app env_file: ./secrets/etherpad-app.secrets volumes: - ./settings.json:/opt/etherpad-lite/settings.json - - deleted-pads-standard:/opt/etherpad-lite/deleted_pads + - standard_deleted-pads:/opt/etherpad-lite/deleted_pads + - standard_api-key:/mountedAPIkey + command: ["--apikey", "/mountedAPIkey/APIKEY.txt"] labels: traefik.http.routers.etherpad-app.entrypoints: websecure traefik.http.routers.etherpad-app.rule: Host(`pad.picasoft.net`) traefik.http.services.etherpad-app.loadbalancer.server.port: 8080 traefik.enable: true environment: - DB_HOST: "etherpad-db" + DB_HOST: "standard_db" LOGLEVEL: "INFO" MINIFY: "true" PORT: 8080 @@ -51,39 +87,29 @@ services: ABIWORD: "/usr/bin/abiword" networks: - proxy - - standard + - standard_app-db + - standard_dpad-app depends_on: - - etherpad-db + - standard_db restart: unless-stopped - etherpad-db: - image: postgres:12 - container_name: etherpad-db - volumes: - - etherpad-db:/var/lib/postgresql/data - env_file: ./secrets/etherpad-db.secrets - networks: - - standard - restart: unless-stopped - - # WEEKLY CONSERVATION - etherpad-week-app: + week_app: image: registry.picasoft.net/pica-etherpad:1.8.6 - container_name: etherpad-week-app + container_name: etherpad_week_app build: . env_file: ./secrets/etherpad-week-app.secrets - command: ["--apikey", "/mountedAPIkey/APIKEY.txt"] volumes: - ./settings_week.json:/opt/etherpad-lite/settings.json - - deleted-pads-week:/opt/etherpad-lite/deleted_pads - - api-key-week:/mountedAPIkey + - week_deleted-pads:/opt/etherpad-lite/deleted_pads + - week_api-key:/mountedAPIkey + command: ["--apikey", "/mountedAPIkey/APIKEY.txt"] labels: traefik.http.routers.etherpad-week-app.entrypoints: websecure traefik.http.routers.etherpad-week-app.rule: Host(`week.pad.picasoft.net`) traefik.http.services.etherpad-week-app.loadbalancer.server.port: 8080 traefik.enable: true environment: - DB_HOST: "etherpad-week-db" + DB_HOST: "week_db" LOGLEVEL: "INFO" MINIFY: "true" PORT: 8080 @@ -92,36 +118,60 @@ services: TRUST_PROXY: "true" ABIWORD: "/usr/bin/abiword" depends_on: - - etherpad-week-db + - week_db networks: - proxy - - week + - week_app-db + - week_dpad-app restart: unless-stopped - etherpad-week-db: - image: postgres:12 - container_name: etherpad-week-db + + + + + # script COMPLEMENTARY to etherpad plugin ep_delete_after_delay + standard_delete-pad-after-delay: + build: + context: https://gitlab.utc.fr/picasoft/projets/delete-pad-after-delay.git volumes: - - weekpad-db:/var/lib/postgresql/data - env_file: ./secrets/etherpad-week-db.secrets - restart: unless-stopped + - type: volume + source: standard_api-key + target: /mountedAPIkey + read_only: true + volume: + nocopy: true + - standard_deleted-pads:/opt/etherpad-lite/deleted_pads networks: - - week + - standard_dpad-app + environment: + URL: "http://standard_app:8080" #must be coherent with etherpad-wee-app.environment.port + DEL: 71712000 #in seconds (2 years). MUST be COHERENT with settings.json ep_delete_after_delay{ + DIR: "/opt/etherpad-lite/deleted_pads" + APIKEY_PATH: "/mountedAPIkey/APIKEY.txt" + container_name: etherpad_standard_delete-pad-after-delay + depends_on: + - standard_app + # script COMPLEMENTARY to etherpad plugin ep_delete_after_delay - etherpad-week-delete-pad-after-delay: + week_delete-pad-after-delay: build: context: https://gitlab.utc.fr/picasoft/projets/delete-pad-after-delay.git volumes: - type: volume - source: api-key-week + source: week_api-key target: /mountedAPIkey read_only: true volume: nocopy: true + - week_deleted-pads:/opt/etherpad-lite/deleted_pads + networks: + - week_dpad-app environment: - URL: "https://week.pad.picasoft.net" + URL: "http://week_app:8080" #must be coherent with etherpad-wee-app.environment.port DEL: 1209600 #14 days. MUST be COHERENT with settings_week.json ep_delete_after_delay{ DIR: "/opt/etherpad-lite/deleted_pads" APIKEY_PATH: "/mountedAPIkey/APIKEY.txt" - container_name: etherpad-week-delete-pad-after-delay + container_name: etherpad_week_delete-pad-after-delay + depends_on: + - week_app