Skip to content

A systemd enabled ubuntu image with mysql installed to test ansible replication/switching

License

Notifications You must be signed in to change notification settings

docker-ThoTeam/molecule_test_mysql_replication

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

molecule_test_mysql_replication

Table of contents

Description

A systemd enabled ubuntu image with mysql installed to test ansible role/collection for replication/switching using molecule

Disclaimer

TL;DR: /!\ Do not run this image on production /!\ (you've been warned)

This image has systemd enabled (requiring a few specific volumes) and contains a mysql server with a dummy root password. As such it is only intended for automated tests (with original focus on ansible molecule tests) and must not be run on production environments (you've been warned twice).

Mysql root password

The password set for root mysql user at install time is test. This can be overidden building the image locally by passing --build-arg MYSQL_ROOT_PASSWORD=mypassword to the docker build command

See building the image

Automated build

This image can be built on dockerhub and will take advantage of the dockerhub build hook to adapt the image content based on the target tag (5 or 8)

Building the image

Requirements

  • A functional and fairly recent docker engine
  • Buildkit enabled for docker builds

Build arguments (aka --build-arg)

Variable Default Desription
MYSQL_ROOT_PASSWORD test Initial mysql root password for the installed db server
mysql_version 8 Mysql version to install. Allowed values: 5 -> latest 5.7 version, 8 -> latest 8.0 version
mysql_apt_config_version 0.8.12-1_all Version of the mysql-apt-config package to install
download_dir /tmp Path to the internal image directoy where to download mysql-apt-config package
download_base_url https://dev.mysql.com/get/ Base url where to download the mysql-apt-config package

Example build commands

export DOCKER_BUILDKIT=1
export mysql_version=5
docker build --build-arg mysql_version="${mysql_version}" -t "my_local_img:${mysql_version}" .

Running a container

This image has systemd enabled and requires running in privileged mode with a number of default mounts

Example run command:

export mysql_version=8
docker run -d --name "test_molecule_mysql${mysql_version}" --privileged \
  -v /sys/fs/cgroup:/sys/fs/cgroup:ro
  --tmpfs /tmp --tmpfs /run --tmpfs /run/lock
  "my_local_img:${mysql_version}"

Contributing

If you intend to contribute to this git repository, make sure you install the distributed local hooks for git and the required dependencies. At time of this writting there is a single pre-commit hook which will run basic checks and update the README.md toc if needed

Dependencies

  • github markdonw toc. This is used to automatically generate the README.md table of content whenever its content is changed.

Installing the git hooks

right after cloning the repo, run

git config core.hooksPath .githooks

Licence

MIT: see LICENSE

About

A systemd enabled ubuntu image with mysql installed to test ansible replication/switching

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published