Files
streamline-emr/docker
alec.turner 4a89356390 Import latest app updates from streamline
An updated set of source files and initialization was provided by streamline to
address issues observed during initial testing. These files have been updated in
order to generate a new set of app images.
2024-04-11 11:16:51 -07:00
..
2024-03-14 16:27:56 -07:00
2024-03-10 16:17:50 -07:00

Image Notes

The base images used have a few issues that should be addressed, specifically:

  • the linux/arm64 variant does not work (appears to built for a different platform)
  • quite a few files seem to be unused, taking up space unnecessarily and making it difficult to follow
  • services should ideally be run in separate docker containers - this looks to have been at least partially implemented, but is not currently used
  • mysql configuration is managed in several places, in particular with respect to binary logging
  • binary logging needs to be configured slightly differently to work reliably with Signalytic tools (in their current state)

Changes

Required Changes

A minimal set of required changes includes:

  • modify /etc/mysql/my.cnf
    • limit binary logging to the streamline database only (binlog-do-db=streamline)
    • remove binary log size limit (max_binlog_size)
  • modify /var/www/html/.docker/mysql/mysql-init.sh
    • remove binary log configuration from mysqld commands, using my.cnf as the sole configuration source (--log-basename=bin --log-bin=/var/lib/mysql/logs/bin)
  • replace the arm64 base image with a known working image

Reasoning

The reason for these changes is that the Signalytic database sync tools currently work with only a single database at a time. When using MariaDB, several system databases are generated automatically, generating additional binary logs that we are not interested in. When attempting to later apply the binary logs to a database server, conflicts may arise. An alternative approach would be to drop all databases instead, this is worth investigating in the future.

Additional Changes

A temporary solution to the failing arm64 image, is to rebuild the image based on the files already available within the official images. Some additional changes are made here to further reduce the image size. Changes include:

  • remove unused dockerfiles from the image
  • remove duplicate initialization data
  • remove unused git files

Background

Streamline Startup Process

-- /var/www/html/start_up.sh (entrypoint, called with /bin/sh)
   |-- set env vars (app, db, user, pass, root, rootpass)
   |-- .docker/mysql/mysql-init.sh
   |   |-- exec scripts from /scripts/pre-init.d/ (none)
   |   |-- create binlogs folder if needed: /var/lib/mysql/logs/
   |   |-- create other mysql folders if needed
   |   |-- if no /var/lib/mysql yet, create then:
   |   |   |-- install db with "mysql_install_db ..."
   |   |   |-- generate db init script: create db, set permissions, etc
   |   |   |-- run mysqld with init script as input (binlogs set in options)
   |   |   `-- if /docker-entrypoint-initdb.d/ exists:
   |   |       |-- start mysqld (same options)
   |   |       |-- apply all *.sql[.gz] files in dir
   |   |       `-- stop mysqld
   |   |-- exec scripts from /scripts/post-init.d/ (none)
   |   `-- start mysqld in background
   |-- mysql query: "use streamline" ("streamline" hardcoded)
   |-- mysql query: "create database streamline" (uses db name variable)
   |-- mysql: ./.docker/mysql/scripts/streamline_initial.sql
   `- start php app