GithubHelp home page GithubHelp logo

docker-mysql-replication's Introduction

Docker Web Application Demo

This demo is a lightweight bash script to bring together several Docker Containers to create a tiered web application like you would deploy to Amazon.

It is as simple as running ./run_demo and takes about 5 seconds to build the whole stack, 4 seconds of which are are artificial sleeps to allow mysql to keep up.

An environment like this is perfect for testing major version changes, database schema changes, etc very quickly and easily during the development process.

See the following Repos for the Docker buildfiles

Architecture


                      | :80
                      |
                -------------- 
                |  HAProxy   |
                --------------
                   |      |
              :80 /        \ :80
                 /          \
       --------------     --------------  
       |  Apache/WP |     |  Apache/WP |   
       --------------     --------------
                 \           /
            :3306 \         / :3306
                -------------- 
                |  HAProxy   |
                --------------
                   |      |
            :3306 /        \ :3306
                 /          \
       --------------     --------------  
       |  MySQL01   |     |  MySQL02   |   
       --------------     --------------
              ^              ^
              |______________|

              Master <-> Master
                 Replication

Requirements

  • Docker
  • Internet

Launch the Demo

you may want to preload the docker containers

docker pull paulczar/mysql
docker pull paulczar/apache2-wordpress
docker pull paulczar/haproxy-mysql
docker pull paulczar/haproxy-web

$ source ./run_demo

Output should look like

Create MySQL Tier
-----------------
* Create MySQL01
* Create MySQL02
* Sleep for two seconds for servers to come online...
* Creat replication user
* Export Data from MySQL01 to MySQL02
-- Warning: Skipping the data of table mysql.event. Specify the --events option explicitly.
* Set MySQL01 as master on MySQL02
* Set MySQL02 as master on MySQL01
* Start Slave on both Servers
* Create database 'wordpress' on MySQL01
* Sleep 2 seconds, then check that database 'wordpress' exists on MySQL02
wordpress

Create MySQL Load Balancer
--------------------------
* Create HAProxy-MySQL
* Check our haproxy works
   (should show alternating server_id)
server_id	1
server_id	2
server_id	1
server_id	2

Create Wordpress Web Servers
------------------------
* Create WordPress01
* Create WordPress02

Create Web Load Balancer
--------------------------
* Create HAProxy-Web
* Check it works
<tr><td class="e">PHP API </td><td class="v">20090626 </td></tr>
Environment Created!
--------------------

Browse to http://172.17.0.30 to access your wordpress site

Variables available fo you :-

MYSQL01_IP : 172.17.0.25
MYSQL02_IP : 172.17.0.26
HAPROXY_MYSQL_IP : 172.17.0.27
WORDPRESS1_IP : 172.17.0.28
WORDPRESS2_IP : 172.17.0.29
HAPROXY_WEB_IP : 172.17.0.30

Authors

Paul Czarkowski - [email protected]

License

Copyright 2013 Paul Czarkowski

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

docker-mysql-replication's People

Contributors

eugeneware avatar paulczar avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.