From b8159e2da19317be1eff2856cfa38f8495592e0b Mon Sep 17 00:00:00 2001
From: Quentin Duchemin <quentinduchemin@tuta.io>
Date: Fri, 7 Aug 2020 17:54:38 +0200
Subject: [PATCH] [MISC] Add build instructions in Compose

---
 pica-db-backup-rotation/docker-compose.yml |  4 ++--
 pica-db-backup/docker-compose.yml          |  1 +
 pica-etherpad-db/CHANGELOG.md              | 17 --------------
 pica-etherpad-db/Dockerfile                | 18 ---------------
 pica-etherpad-db/README.md                 |  3 ---
 pica-etherpad-db/config/binary_log.cnf     | 27 ----------------------
 pica-etherpad-db/config/myisam_perf.cnf    |  9 --------
 pica-lufi/README.md                        |  5 ++++
 pica-lufi/docker-compose.yml               |  3 ++-
 pica-mattermost/docker-compose.yml         |  1 +
 pica-metrics-bot/docker-compose.yml        |  1 +
 pica-mumble-web/docker-compose.yml         |  1 +
 pica-nextcloud/docker-compose-cet.yml      |  1 +
 13 files changed, 14 insertions(+), 77 deletions(-)
 delete mode 100644 pica-etherpad-db/CHANGELOG.md
 delete mode 100644 pica-etherpad-db/Dockerfile
 delete mode 100644 pica-etherpad-db/README.md
 delete mode 100644 pica-etherpad-db/config/binary_log.cnf
 delete mode 100644 pica-etherpad-db/config/myisam_perf.cnf
 create mode 100644 pica-lufi/README.md

diff --git a/pica-db-backup-rotation/docker-compose.yml b/pica-db-backup-rotation/docker-compose.yml
index f08f62d1..6452e8ef 100644
--- a/pica-db-backup-rotation/docker-compose.yml
+++ b/pica-db-backup-rotation/docker-compose.yml
@@ -3,9 +3,9 @@ version: "3.7"
 services:
   db-backup-rotation:
     image: registry.picasoft.net/pica-db-backup-rotation:1.4
+    build: .
     container_name: db-backup-rotation
     volumes:
       - /DATA/BACKUP/:/backup/
       - ./config:/config
-    restart: always
-#
+    restart: unless-stopped
diff --git a/pica-db-backup/docker-compose.yml b/pica-db-backup/docker-compose.yml
index 08d1ec88..a60e9273 100644
--- a/pica-db-backup/docker-compose.yml
+++ b/pica-db-backup/docker-compose.yml
@@ -14,6 +14,7 @@ networks:
 services:
   db-backup:
     image: registry.picasoft.net/pica-db-backup:1.3
+    build: .
     container_name: db-backup
     volumes:
       - /DATA/BACKUP/:/backup/
diff --git a/pica-etherpad-db/CHANGELOG.md b/pica-etherpad-db/CHANGELOG.md
deleted file mode 100644
index c3cfa816..00000000
--- a/pica-etherpad-db/CHANGELOG.md
+++ /dev/null
@@ -1,17 +0,0 @@
-## mysql8.picapatch2
-
-Try to improve performance of MySQL
-
-* Increase [key_buffer_size](https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_key_buffer_size) given that the index file is way too big for the default value
-* Also increase `read_buffer_size` to a [recommended value](https://dba.stackexchange.com/a/136409) of 256K
-* More precise base image tag
-
-## mysql8.picapatch1
-
-* Limit the [mysql binary log](https://dev.mysql.com/doc/refman/8.0/en/binary-log.html) to 30 hours and some other custom configs in [config/binary_log.cnf](config/binary_log.cnf)
-* Remove unnecessary tools (mainly, libsqlite3-0 and gpg)
-
-## Image size and vulnerabilities
-
-* `pica-etherpad-db:mysql8.picapatch1`: 548MB, [54 vulnerabilities](https://gitlab.utc.fr/picasoft/projets/dockerfiles/-/jobs/886295)
-* Base image: `mysql:8.0.19` (2020-03-31): 547MB, [65 vulnerabilities](https://gitlab.utc.fr/picasoft/projets/dockerfiles/-/jobs/884250)
diff --git a/pica-etherpad-db/Dockerfile b/pica-etherpad-db/Dockerfile
deleted file mode 100644
index 2e09a075..00000000
--- a/pica-etherpad-db/Dockerfile
+++ /dev/null
@@ -1,18 +0,0 @@
-FROM mysql:8.0.20
-
-COPY config/binary_log.cnf /etc/mysql/conf.d/binary_log.cnf
-COPY config/myisam_perf.cnf /etc/mysql/conf.d/myisam_perf.cnf
-
-# By default, COPY uses permissions `-rw-rw-rw-` for the file inside
-# the container. But mysql refuses to use config files that are world-
-# writable, so we have to change those permissions:
-RUN chmod 644 /etc/mysql/conf.d/binary_log.cnf
-RUN chmod 644 /etc/mysql/conf.d/myisam_perf.cnf
-
-# Remove unnecessary tools
-# This removes the following packages:
-#   gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client
-#   gpg-wks-server gpgsm libsqlite3-0 pinentry-curses
-# GPG is probably used by mysql to encrypt logs, but this isn't used in
-# our case
-RUN apt remove -y --autoremove libsqlite3-0
diff --git a/pica-etherpad-db/README.md b/pica-etherpad-db/README.md
deleted file mode 100644
index 26750256..00000000
--- a/pica-etherpad-db/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-**Doit être fusionné avec le dossier `pica-etherpad` (deux Dockerfiles, un Docker Compose)**.
-
-This image limits the [mysql binary log](https://dev.mysql.com/doc/refman/8.0/en/binary-log.html) to 30 hours (=108000 seconds) via the [binlog_expire_logs_seconds](https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_expire_logs_seconds) variable.
diff --git a/pica-etherpad-db/config/binary_log.cnf b/pica-etherpad-db/config/binary_log.cnf
deleted file mode 100644
index 91eef3fb..00000000
--- a/pica-etherpad-db/config/binary_log.cnf
+++ /dev/null
@@ -1,27 +0,0 @@
-# Official documentation: https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html
-#
-# The main purpose of this config file is to retain binary logs (enabled
-# by default) «just in case», for a short period of time. We dont do
-# replication, so anyway we shouldn't need the binary logs.
-#
-# Some settings also try to improve performance (experimental)
-
-
-[mysqld]
-# Limit the binlog retention to 30 hours
-binlog_expire_logs_seconds = 108000
-
-
-# Cache limits
-# Increase binlog_cache_size and binlog_stmt_cache_size
-# (default: 32 KiB) to 128 KiB
-binlog_cache_size = 131072
-binlog_stmt_cache_size = 131072
-# Decrease max_binlog_cache_size and max_binlog_stmt_cache_size
-# (default: 16 EiB) to 10 MiB.
-# (If we have transactions greater than 10 MiB there's a big problem)
-max_binlog_cache_size = 10485760
-max_binlog_stmt_cache_size = 10485760
-
-# Ignore errors
-binlog_error_action = IGNORE_ERROR
diff --git a/pica-etherpad-db/config/myisam_perf.cnf b/pica-etherpad-db/config/myisam_perf.cnf
deleted file mode 100644
index 11a134a2..00000000
--- a/pica-etherpad-db/config/myisam_perf.cnf
+++ /dev/null
@@ -1,9 +0,0 @@
-[mysqld]
-# The default value is 8Mo.
-# Given this documentation : https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_key_buffer_size,
-# we see that the  Key_reads/Key_read_requests ratio should normally be less than 0.01.
-# At the moment (04/2020), the ratio is more than 0.05, which indicates that the index is far larger than
-# the cache. The index is 300M. Right now with this setting, we will "waste" 700M of RAM,
-# which we can afford, and foresee further increase.
-key_buffer_size=1G
-read_buffer_size=256K
diff --git a/pica-lufi/README.md b/pica-lufi/README.md
new file mode 100644
index 00000000..ab5b4a63
--- /dev/null
+++ b/pica-lufi/README.md
@@ -0,0 +1,5 @@
+## Lufi
+
+Ce dossier comprend un travail en cours pour créer une instance de Lufi, un service libre de partage de fichier chiffrés.
+
+À mettre à jour.
diff --git a/pica-lufi/docker-compose.yml b/pica-lufi/docker-compose.yml
index fd51118a..ee0b3921 100644
--- a/pica-lufi/docker-compose.yml
+++ b/pica-lufi/docker-compose.yml
@@ -8,6 +8,7 @@ volumes:
 services:
   lufi:
     image: registry.picasoft.net/lufi:0.04.6
+    build: .
     container_name: lufi
     init: true
     depends_on:
@@ -24,7 +25,7 @@ services:
       - "traefik.backend=lufi"
       - "traefik.port=8081"
       - "traefik.enable=true"
-      
+
   lufidb:
     image: postgres:12
     container_name: lufidb
diff --git a/pica-mattermost/docker-compose.yml b/pica-mattermost/docker-compose.yml
index 2cc82873..5f66f8f3 100644
--- a/pica-mattermost/docker-compose.yml
+++ b/pica-mattermost/docker-compose.yml
@@ -17,6 +17,7 @@ volumes:
 services:
   mattermost:
     image: registry.picasoft.net/pica-mattermost:5.23.0
+    build: .
     container_name: mattermost-app
     links:
       - mattermost-db:mattermost-db
diff --git a/pica-metrics-bot/docker-compose.yml b/pica-metrics-bot/docker-compose.yml
index 33a13cd0..9755a65c 100644
--- a/pica-metrics-bot/docker-compose.yml
+++ b/pica-metrics-bot/docker-compose.yml
@@ -12,6 +12,7 @@ networks:
 services:
   metrics-bot:
     image: registry.picasoft.net/pica-metrics-bot:v1.0.2
+    build: .
     container_name: pica-metrics-services
     volumes:
       - ./config.json:/config.json
diff --git a/pica-mumble-web/docker-compose.yml b/pica-mumble-web/docker-compose.yml
index 145e0ba3..13e2bf90 100644
--- a/pica-mumble-web/docker-compose.yml
+++ b/pica-mumble-web/docker-compose.yml
@@ -7,6 +7,7 @@ networks:
 services:
   mumble-web:
     image: registry.picasoft.net/pica-mumble-web:1.3.0
+    build: .
     container_name: mumble-web
     environment:
       MUMBLE_SERVER: "voice.picasoft.net:64738"
diff --git a/pica-nextcloud/docker-compose-cet.yml b/pica-nextcloud/docker-compose-cet.yml
index 6edc5ee9..a778a777 100644
--- a/pica-nextcloud/docker-compose-cet.yml
+++ b/pica-nextcloud/docker-compose-cet.yml
@@ -9,6 +9,7 @@ networks:
 services:
   cloudcet:
     build:
+      context: ./15.0
       dockerfile: ./15.0/Dockerfile
     container_name: cloudcet
     image: registry.picasoft.net/nextcloud:15.0
-- 
GitLab