The wkhtmltopdf library does not work with the latest version of alpine. To workaround this, a known working image based on an older alpine image is pulled in and relevant libraries copied to the target image. The `snappy` package required a few updates to support this, including setting the wkhtmltopdf binary path explicitly and to enable access to local files (disabled by default).
Image Notes
The base images used have a few issues that should be addressed, specifically:
- the
linux/arm64variant 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
streamlinedatabase only (binlog-do-db=streamline) - remove binary log size limit (
max_binlog_size)
- limit binary logging to the
- modify
/var/www/html/.docker/mysql/mysql-init.sh- remove binary log configuration from
mysqldcommands, usingmy.cnfas the sole configuration source (--log-basename=bin --log-bin=/var/lib/mysql/logs/bin)
- remove binary log configuration from
- 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