├── Dockerfile ├── README.md └── onbuild └── Dockerfile /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | MAINTAINER Andrea Sosso 3 | 4 | ENV MAXSCALE_VERSION 2.2.5 5 | ENV MAXSCALE_URL https://downloads.mariadb.com/MaxScale/${MAXSCALE_VERSION}/rhel/7/x86_64/maxscale-${MAXSCALE_VERSION}-1.rhel.7.x86_64.rpm 6 | 7 | RUN curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --skip-server --skip-tools \ 8 | && yum -y update \ 9 | && yum deplist maxscale | grep provider | awk '{print $2}' | sort | uniq | grep -v maxscale | sed ':a;N;$!ba;s/\n/ /g' | xargs yum -y install \ 10 | && rpm -Uvh ${MAXSCALE_URL} \ 11 | && yum clean all \ 12 | && rm -rf /tmp/* 13 | 14 | # Move configuration file in directory for exports and enable maxadmin cli 15 | RUN mkdir -p /etc/maxscale.d \ 16 | && cp /etc/maxscale.cnf.template /etc/maxscale.d/maxscale.cnf \ 17 | && ln -sf /etc/maxscale.d/maxscale.cnf /etc/maxscale.cnf \ 18 | && chown root:maxscale /etc/maxscale.d/maxscale.cnf \ 19 | && chmod g+w /etc/maxscale.d/maxscale.cnf \ 20 | && echo '[{"name": "root", "account": "admin", "password": ""}, {"name": "maxscale", "account": "admin", "password": ""}]' > /var/lib/maxscale/maxadmin-users 21 | 22 | # VOLUME for custom configuration 23 | VOLUME ["/etc/maxscale.d"] 24 | 25 | USER maxscale 26 | 27 | # EXPOSE the MaxScale default ports 28 | 29 | ## RW Split Listener 30 | EXPOSE 4006 31 | 32 | ## Read Connection Listener 33 | EXPOSE 4008 34 | 35 | ## Debug Listener 36 | EXPOSE 4442 37 | 38 | ## CLI Listener 39 | EXPOSE 6603 40 | 41 | # Running MaxScale 42 | ENTRYPOINT ["/usr/bin/maxscale", "-d"] 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | maxscale-docker 2 | =============== 3 | 4 | This project is a Docker container for MaxScale. 5 | 6 | [![](https://imagelayers.io/badge/asosso/maxscale:latest.svg)](https://imagelayers.io/?images=asosso/maxscale:latest 'ImageLayers') [![Docker Repository on Quay](https://quay.io/repository/asosso/maxscale/status "Docker Repository on Quay")](https://quay.io/repository/asosso/maxscale) 7 | 8 | Base [docker image](http://www.docker.io) to run a [MaxScale](https://mariadb.com/products/mariadb-maxscale) server 9 | 10 | MariaDB MaxScale is an open-source, database-centric proxy that works with MariaDB Enterprise, MariaDB Enterprise Cluster, MariaDB 5.5, MariaDB 10 and Oracle MySQL®. 11 | It’s pluggable architecture is designed to increase flexibility and aid customization. Built upon a lightweight, high-speed networking core designed to facilitate throughput. 12 | MariaDB MaxScale runs between the client application and the database cluster offering connection and statement-based load balancing. 13 | MariaDB MaxScale allows scaling of an organization's database infrastructure while keeping the needs of DBAs, Developers and Data Architects in mind. 14 | 15 | ## Getting the container 16 | 17 | The container is very small and available on the Docker Index: 18 | 19 | docker pull asosso/maxscale 20 | 21 | ## Using the container 22 | 23 | Just trying out MaxScale. 24 | 25 | If you just want to run a single instance of MaxScale server to try out its functionality: 26 | 27 | docker run -d asosso/maxscale 28 | 29 | ## Build the container 30 | 31 | To create the image `asosso/maxscale`, execute the following command on the maxscale-docker folder: 32 | 33 | docker build -t asosso/maxscale . 34 | 35 | ## Thanks 36 | 37 | * [MaxScale](https://github.com/mariadb-corporation/MaxScale) - for its MySQL Proxy 38 | * [@MassimilianoPinto](https://github.com/MassimilianoPinto) - for his collaboration 39 | 40 | ## Contribute 41 | 42 | Contributions are welcome. 43 | 44 | 1. Fork it 45 | 2. Create your feature branch (`git checkout -b my-new-feature`) 46 | 3. Commit your changes (`git commit -am 'Add some feature'`) 47 | 4. Push to the branch (`git push origin my-new-feature`) 48 | 5. Create new Pull Request 49 | 50 | ## License 51 | 52 | Copyright 2015 Andrea Sosso 53 | Licensed under the MIT License -------------------------------------------------------------------------------- /onbuild/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM centos:7 2 | MAINTAINER Andrea Sosso 3 | 4 | ENV MAXSCALE_VERSION 2.2.5 5 | ENV MAXSCALE_URL https://downloads.mariadb.com/MaxScale/${MAXSCALE_VERSION}/rhel/7/x86_64/maxscale-${MAXSCALE_VERSION}-1.rhel.7.x86_64.rpm 6 | 7 | ONBUILD ENV MAXSCALE_VERSION $MAXSCALE_VERSION 8 | ONBUILD ENV MAXSCALE_URL $MAXSCALE_URL 9 | 10 | ONBUILD RUN curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash -s -- --skip-server --skip-tools \ 11 | && yum -y update \ 12 | && yum deplist maxscale | grep provider | awk '{print $2}' | sort | uniq | grep -v maxscale | sed ':a;N;$!ba;s/\n/ /g' | xargs yum -y install \ 13 | && rpm -Uvh ${MAXSCALE_URL} \ 14 | && yum clean all \ 15 | && rm -rf /tmp/* 16 | 17 | # Move configuration file in directory for exports and enable maxadmin cli 18 | ONBUILD RUN mkdir -p /etc/maxscale.d \ 19 | && cp /etc/maxscale.cnf.template /etc/maxscale.d/maxscale.cnf \ 20 | && ln -sf /etc/maxscale.d/maxscale.cnf /etc/maxscale.cnf \ 21 | && chown root:maxscale /etc/maxscale.d/maxscale.cnf \ 22 | && chmod g+w /etc/maxscale.d/maxscale.cnf \ 23 | && echo '[{"name": "root", "account": "admin", "password": ""}, {"name": "maxscale", "account": "admin", "password": ""}]' > /var/lib/maxscale/maxadmin-users 24 | 25 | # VOLUME for custom configuration 26 | VOLUME ["/etc/maxscale.d"] 27 | 28 | USER maxscale 29 | 30 | # EXPOSE the MaxScale default ports 31 | 32 | ## RW Split Listener 33 | EXPOSE 4006 34 | 35 | ## Read Connection Listener 36 | EXPOSE 4008 37 | 38 | ## Debug Listener 39 | EXPOSE 4442 40 | 41 | ## CLI Listener 42 | EXPOSE 6603 43 | 44 | # Running MaxScale 45 | ENTRYPOINT ["/usr/bin/maxscale", "-d"] 46 | --------------------------------------------------------------------------------