diff --git a/pica-db-backup/config/backup_config.json b/pica-db-backup/config/backup_config.json index 4fa15ad59fab56eb797a21a0b78f0eac18051c55..daa635830228895b59dc881ab49bfc4e045af090 100644 --- a/pica-db-backup/config/backup_config.json +++ b/pica-db-backup/config/backup_config.json @@ -12,14 +12,13 @@ }, "etherpad": { "Host": "etherpad-db", - "Port": "3306", + "Port": "5432", "User": "ETHERPAD_DB_USER", "Password": "ETHERPAD_DB_PASSWORD", - "Database": "--all-databases", - "Type": "mysql", + "Database": "etherpad", + "Type": "postgres", "Folder": "etherpad", "Cron": "0 */6 * * *", - "Options": "--single-transaction --quick --lock-tables=false", "Init-Backup": "1" }, "etherpad-week": { diff --git a/pica-etherpad-db/CHANGELOG.md b/pica-etherpad-db/CHANGELOG.md deleted file mode 100644 index c3cfa8169bbb8a4c12529969af47b8f6a046ea6b..0000000000000000000000000000000000000000 --- 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 2e09a075caf1afa669d981a6c0cf384511e5af53..0000000000000000000000000000000000000000 --- 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 26924f2314171a923ce385d8b029c0c9801d00ed..0000000000000000000000000000000000000000 --- a/pica-etherpad-db/README.md +++ /dev/null @@ -1 +0,0 @@ -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/clair-whitelist.yml b/pica-etherpad-db/clair-whitelist.yml deleted file mode 100644 index a9d6ed5bdae04856ade1de9572cbdfee041aa4b9..0000000000000000000000000000000000000000 --- a/pica-etherpad-db/clair-whitelist.yml +++ /dev/null @@ -1 +0,0 @@ -generalwhitelist: diff --git a/pica-etherpad-db/config/binary_log.cnf b/pica-etherpad-db/config/binary_log.cnf deleted file mode 100644 index 91eef3fbe51ce43c4a9198fe44d36e8696a7894e..0000000000000000000000000000000000000000 --- 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 11a134a226a21e765a295c730d68fa51c2218872..0000000000000000000000000000000000000000 --- 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-etherpad-db/docker-compose.yml b/pica-etherpad-db/docker-compose.yml deleted file mode 100644 index 9f5a107cbd4b3987656809c733397cf8a1ba59de..0000000000000000000000000000000000000000 --- a/pica-etherpad-db/docker-compose.yml +++ /dev/null @@ -1,7 +0,0 @@ -version : "2.4" - -# THIS IS A DUMMY docker-compose.yml USED ONLY BY THE CI - -services: - etherpad-db: - image: registry.picasoft.net/pica-etherpad-db:mysql8.picapatch2 diff --git a/pica-etherpad/Dockerfile b/pica-etherpad/Dockerfile index 1332f168444444c4f057bcf8380d0ed33c3c09f7..140fc9b5a730a88216b0311cece706c8d8be364e 100644 --- a/pica-etherpad/Dockerfile +++ b/pica-etherpad/Dockerfile @@ -60,7 +60,7 @@ RUN useradd --uid ${UID} --create-home etherpad COPY --from=downloader --chown=etherpad /opt/etherpad-lite /opt/etherpad-lite/ RUN apt-get update && \ - apt-get install -y curl nano default-mysql-client postgresql-client && \ + apt-get install -y curl nano postgresql-client && \ chmod +x /opt/etherpad-lite/entrypoint.sh && \ usermod -d /opt/etherpad-lite etherpad && \ chown -R etherpad /opt/etherpad-lite && \ diff --git a/pica-etherpad/docker-compose.yml b/pica-etherpad/docker-compose.yml index c270dcf6ff19e2e09adf1f5ba3b8592acabe183c..6df32940f472c58a0d98058cffdfb07f29f1f0c0 100755 --- a/pica-etherpad/docker-compose.yml +++ b/pica-etherpad/docker-compose.yml @@ -2,7 +2,7 @@ version : "2.4" volumes: etherpad-db: - name: etherpad-db + name: etherpad-db-pg weekpad-db: name: weekpad-db deleted-pads-standard: @@ -52,7 +52,7 @@ services: - standard etherpad-db: - image: registry.picasoft.net/pica-etherpad-db:mysql8.picapatch2 + image: postgres:12 container_name: etherpad-db security_opt: - no-new-privileges @@ -60,11 +60,9 @@ services: cpus: "0.40" pids_limit: 1024 volumes: - - etherpad-db:/var/lib/mysql + - etherpad-db:/var/lib/postgresql/data env_file: ./secrets/etherpad-db.secrets restart: unless-stopped - # See https://stackoverflow.com/questions/41134785/how-to-solve-mysql-warning-innodb-page-cleaner-1000ms-intended-loop-took-xxx - command: --innodb_lru_scan_depth=128 --default-authentication-plugin=mysql_native_password networks: - standard diff --git a/pica-etherpad/entrypoint.sh b/pica-etherpad/entrypoint.sh index b2772009bf9f5c5e2c96ffc0a547119c079060d9..fe9e82a6a00c34f83c1aa914954176497e3fc3fd 100644 --- a/pica-etherpad/entrypoint.sh +++ b/pica-etherpad/entrypoint.sh @@ -22,7 +22,7 @@ if [ -z "${DB_HOST}" ]; then exit 1 fi -while ! { mysqladmin ping -u"${DB_USER}" -p"${DB_PASSWORD}" -h"${DB_HOST}" &>/dev/null || PGPASSWORD="${DB_PASSWORD}" psql -h"${DB_HOST}" -U"${DB_USER}" -d"${DB_NAME}" -c "SELECT 1" &>/dev/null; }; do +while ! PGPASSWORD="${DB_PASSWORD}" psql -h"${DB_HOST}" -U"${DB_USER}" -d"${DB_NAME}" -c "SELECT 1" &>/dev/null; do echo "Database server not ready yet, re-trying in 5 seconds..." sleep 5 done diff --git a/pica-etherpad/secrets/etherpad-db.secrets.example b/pica-etherpad/secrets/etherpad-db.secrets.example index f09b3b8950153cdd45c5f1bd0ffa924afe5af4fa..1e5c0227e45354ea4f1e2f2e27a287bf250a30e4 100644 --- a/pica-etherpad/secrets/etherpad-db.secrets.example +++ b/pica-etherpad/secrets/etherpad-db.secrets.example @@ -1,4 +1,3 @@ -MYSQL_ROOT_PASSWORD=password -MYSQL_DATABASE=etherpad-lite -MYSQL_USER=etherpad -MYSQL_PASSWORD=password +POSTGRES_PASSWORD=password +POSTGRES_USER=etherpad +POSTGRES_DB=etherpad diff --git a/pica-etherpad/settings.json b/pica-etherpad/settings.json index 2cd86168d2ac29fba3422c992882446f6bfbc352..fbc3eec224b444acd5dedda9aac62e84ad657670 100644 --- a/pica-etherpad/settings.json +++ b/pica-etherpad/settings.json @@ -6,10 +6,10 @@ "ip": "${IP:0.0.0.0}", "port": "${PORT:8080}", "showSettingsInAdminPage": "${SHOW_SETTINGS_IN_ADMIN_PAGE:true}", - "dbType": "${DB_TYPE:mysql}", + "dbType": "${DB_TYPE:postgres}", "dbSettings": { "host": "${DB_HOST}", - "port": "${DB_PORT:3306}", + "port": "${DB_PORT:5432}", "database": "${DB_NAME}", "user": "${DB_USER}", "password": "${DB_PASSWORD}",