Vagrantfile to create a three node Docker Swarm cluster using ScaleIO and Rex-Ray.
This Vagrant setup will automatically deploy three CentOS 7.2 nodes, download the ScaleIO 2.0 software and install a full ScaleIO cluster. Furthermore a Docker Swarm cluster is created and support for persistent storage is added using Rex-Ray!
To use this, you'll need to complete a few steps:
git clone https://github.com/vchrisb/vagrant-swarm.git- Run
vagrant up - Login into one node:
vagrant ssh node1 - Login into ScaleIO:
scli --mdm_ip 192.168.100.11,192.168.100.12 --login --username admin --password Scaleio123 --approve_certificate - Validate ScaleIO;
scli --mdm_ip 192.168.100.11,192.168.100.12 --query_all - Validate docker swarm:
docker node ls - Validate RexRay:
docker volume ls
- Create network for communication between wordpress and mariadb:
docker network create --driver overlay wp_nw - Create volume for mariadb:
docker volume create -d scaleio --name wp_db - Create volume for wordpress:
docker volume create -d scaleio --name wp_content - Start mariadb:
docker service create --name wordpress_db --network wp_nw --mount type=volume,volume-driver=scaleio,source="wp_db",target=/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Passw0rd mariadb - Start wordpress:
docker service create --name wordpress --network wp_nw --mount type=volume,volume-driver=scaleio,source="wp_content",target=/var/www/html/wp-content -e WORDPRESS_DB_HOST=wordpress_db -e WORDPRESS_DB_PASSWORD=Passw0rd -p 80:80 wordpress - Access wordpress on any of the nodes:
http://192.168.100.11 - Create some sample content
- Remove wordpress
docker service rm wordpress - Remove mariadb
docker service rm wordpress_db - Start mariadb:
docker service create --name wordpress_db --network wp_nw --mount type=volume,volume-driver=scaleio,source="wp_db",target=/var/lib/mysql -e MYSQL_ROOT_PASSWORD=Passw0rd mariadb - Start wordpress:
docker service create --name wordpress --network wp_nw --mount type=volume,volume-driver=scaleio,source="wp_content",target=/var/www/html/wp-content -e WORDPRESS_DB_HOST=wordpress_db -e WORDPRESS_DB_PASSWORD=Passw0rd -p 80:80 wordpress - Access wordpress on any of the nodes:
http://192.168.100.11and validate that it kept your content!
If anything goes wrong during the deployment, run vagrant destroy -f to remove all the VMs and then vagrant up again to restart the deployment.