Skip to content
Jeffrey Honig edited this page May 12, 2024 · 4 revisions

Welcome to the docker-mmonit wiki!

Some notes about this container.

Major version upgrades

When the major version is bumped, M/Monit interactively prompt for a new license (see https://github.com/jchonig/docker-mmonit/issues/12).

The current work-around is to install your new license in the old config directory before upgrading, then restore the file when you are done.

Switching from sqlite3 to mysql (or postgresql)

It is possible to switch to mysql or postgresql from sqlite after the container is running w/o losing your configuration and syntax.

  1. Change your docker (compose) configuration to bring up the new container, but do not update MMONIT_DATABASE_URL. Run the following commands in the mmonit container. Here is a docker compose example
docker compose exec mmonit /bin/bash
cd /config/mmonit-${MMONIT_VERSION}
  1. Set up the new database This installs the tools and applies the schema to the database.
apk add -Uq mariadb-client sqlite
mysql -u ${MYSQL_USER} --password=${MYSQL_PASSWORD} -h ${DATABASE_CONTAINER_NAME} ${MYSQL_DATABASE} < ./db/mmonit-schema.mysql
  1. Run the migrate script to generate data to populate the new database engine. Do this as two steps in case you have to run the second step multiple times. You will loose data from the time you run the this step until you restart the containers with MMONIT_DATABASE_URL set. See db/migrate_db.sh for more information.
db/migrate_db.sh -t mysql > migrate
  1. Populate the new database with the old data
mysql -u ${MYSQL_USER} --password=${MYSQL_PASSWORD} -h ${DATABASE_CONTAINER_NAME} ${MYSQL_DATABASE} < ./migrate
  1. Update MMONIT_DATABASE_URL to point the the database container and restart the mmonit container or full stack.

Note that to go back to sqlite3 you will need to copy /opt/mmonit-${MMONIT_VERSION/conf/server.xml to /config/mmonit-${MMONIT_VERSION}/conf/server.xml to restore the database configuration.

Eventually, you should delete /config/mmonit-${MMONIT_VERSION/db/mmonit.db