From 5f2c7e013741926833d612ba33d61807d28a6d90 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Tue, 27 May 2014 15:39:49 -0400 Subject: [PATCH 01/32] Add build cmd to demo setup --- contrib/demo/setup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/demo/setup.sh b/contrib/demo/setup.sh index dd330d7d..c4152a39 100755 --- a/contrib/demo/setup.sh +++ b/contrib/demo/setup.sh @@ -9,6 +9,7 @@ if [ $ret -ne 0 ] || [ "$FETCH_IMAGES" != "" ]; then docker pull openshift/nodejs-0-10-centos docker tag openshift/nodejs-0-10-centos nodejs-centos docker pull openshift/centos-mongodb + gear build https://github.com/smarterclayton/fluentwebmap.git nodejs-centos parks-map-app fi set +x From 714b55ed5fd5f39d036e22ee74af394593d53108 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Wed, 28 May 2014 13:08:13 -0400 Subject: [PATCH 02/32] Demo WIP --- contrib/demo/Vagrantfile | 61 ++++++++++++++++++++ contrib/demo/deploy_parks_map_instances.json | 4 +- contrib/demo/setup.sh | 9 ++- 3 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 contrib/demo/Vagrantfile diff --git a/contrib/demo/Vagrantfile b/contrib/demo/Vagrantfile new file mode 100644 index 00000000..8521e6de --- /dev/null +++ b/contrib/demo/Vagrantfile @@ -0,0 +1,61 @@ +# -*- mode: ruby -*- +# vi: set ft=ruby : + +# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! +VAGRANTFILE_API_VERSION = "2" + +Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| + # All Vagrant configuration is done here. The most common configuration + # options are documented and commented below. For a complete reference, + # please see the online documentation at vagrantup.com. + config.vm.box = "atomic" + config.vm.provider :libvirt do |libvirt| + libvirt.driver = "qemu" + libvirt.connect_via_ssh = false + end + + config.vm.define "vm1", primary: true do |config| + config.vm.network "forwarded_port", guest: 43273, host: 43273 + config.vm.network "forwarded_port", guest: 6060, host: 2225 + config.vm.network "forwarded_port", guest: 14000, host: 14000 + for i in 4000..4050 + config.vm.network :forwarded_port, guest: i, host: i + end + + comfig.vm.network "private_network", ip: "192.168.205.10" + end + + config.vm.define "vm2", primary: true do |config| + config.vm.network "forwarded_port", guest: 43273, host: 53273 + config.vm.network "forwarded_port", guest: 6060, host: 12225 + config.vm.network "forwarded_port", guest: 14000, host: 24000 + for i in 4000..4050 + config.vm.network :forwarded_port, guest: i, host: i+10001 + end + + config.vm.network "private_network", ip: "192.168.205.11" + end + + if ENV['GOPATH'] && ENV['GOPATH'] != "" + puts "Sharing GOPATH with VM" + gopath = File.expand_path(ENV['GOPATH'].split(/:/).last) + vagrantfile = File.expand_path(File.dirname(__FILE__)) + if !vagrantfile.index(gopath) + puts "\nYou have GOPATH set to '#{gopath}', which geard expects to contain your geard source repository, but are running from '#{vagrantfile}' instead.\n\nSet GOPATH='' when running vagrant or move your geard repo to '#{gopath}/src/github.com/openshift/geard'." + exit 1 + end + config.vm.synced_folder gopath, "/vagrant" + else + puts "Sharing current directory with VM" + config.vm.synced_folder '.', "/vagrant/", disabled: true + config.vm.synced_folder '.', "/vagrant/src/github.com/openshift/geard", create: true + end + + if ENV['JUMBO'] && ENV['JUMBO'] != "" + config.vm.provider "virtualbox" do |v| + v.memory = 4096 + v.cpus = 4 + v.customize ["modifyvm", :id, "--cpus", "4"] + end + end +end diff --git a/contrib/demo/deploy_parks_map_instances.json b/contrib/demo/deploy_parks_map_instances.json index 1ef2650d..a5f8ea74 100644 --- a/contrib/demo/deploy_parks_map_instances.json +++ b/contrib/demo/deploy_parks_map_instances.json @@ -88,7 +88,7 @@ "Id": "parks-backend-2", "Image": "parks-map-app", "From": "backend", - "On": "localhost", + "On": "192.168.205.11", "Ports": [ { "Internal": 3000, @@ -104,7 +104,7 @@ "Id": "parks-backend-3", "Image": "parks-map-app", "From": "backend", - "On": "localhost", + "On": "192.168.205.11", "Ports": [ { "Internal": 3000, diff --git a/contrib/demo/setup.sh b/contrib/demo/setup.sh index c4152a39..f00f7dc3 100755 --- a/contrib/demo/setup.sh +++ b/contrib/demo/setup.sh @@ -23,8 +23,13 @@ fi $base/teardown.sh -gear deploy $base/deploy_parks_map.json localhost -gear stop localhost/parks-backend-{2,3} +descriptor=$base/deploy_parks_map.json +if [ "$MULTIHOST" != "" ]; then + descriptor=$base/deploy_parks_map_instances.json +fi + +gear deploy $descriptor localhost 192.168.205.11 +gear stop 192.168.205.11/parks-backend-{2,3} $base/wait_for_url.sh "http://localhost:14000/" From 4636882cab002d677d64f883cb012ae96e6f8a9f Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Wed, 28 May 2014 13:43:59 -0400 Subject: [PATCH 03/32] Update demo setup.sh --- contrib/demo/setup.sh | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/contrib/demo/setup.sh b/contrib/demo/setup.sh index f00f7dc3..adedaa11 100755 --- a/contrib/demo/setup.sh +++ b/contrib/demo/setup.sh @@ -9,7 +9,8 @@ if [ $ret -ne 0 ] || [ "$FETCH_IMAGES" != "" ]; then docker pull openshift/nodejs-0-10-centos docker tag openshift/nodejs-0-10-centos nodejs-centos docker pull openshift/centos-mongodb - gear build https://github.com/smarterclayton/fluentwebmap.git nodejs-centos parks-map-app + docker pull pmorie/parks-map-app + docker tag pmorie/parks-map-app parks-map-app fi set +x @@ -28,9 +29,9 @@ if [ "$MULTIHOST" != "" ]; then descriptor=$base/deploy_parks_map_instances.json fi -gear deploy $descriptor localhost 192.168.205.11 -gear stop 192.168.205.11/parks-backend-{2,3} +gear deploy $descriptor localhost +gear stop localhost/parks-backend-{2,3} $base/wait_for_url.sh "http://localhost:14000/" -sudo switchns --container=parks-db-1 -- /bin/bash -c "curl https://raw.githubusercontent.com/thesteve0/fluentwebmap/master/parkcoord.json | mongoimport -d fluent -c parkpoints --type json && mongo fluent --eval 'db.parkpoints.ensureIndex( { pos : \"2d\" } );'" \ No newline at end of file +sudo switchns --container=parks-db-1 -- /bin/bash -c "curl https://raw.githubusercontent.com/thesteve0/fluentwebmap/master/parkcoord.json | mongoimport -d fluent -c parkpoints --type json && mongo fluent --eval 'db.parkpoints.ensureIndex( { pos : \"2d\" } );'" From 16dec29bb58d430db18da66adecba69c36ec2129 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Wed, 28 May 2014 15:29:22 -0400 Subject: [PATCH 04/32] Add demo instructions --- contrib/demo/instructions.md | 114 +++++++++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 contrib/demo/instructions.md diff --git a/contrib/demo/instructions.md b/contrib/demo/instructions.md new file mode 100644 index 00000000..9e1212dc --- /dev/null +++ b/contrib/demo/instructions.md @@ -0,0 +1,114 @@ +These instructions will take you from a clean VM* to a working dockercon demo app. In future iterations these instructions will handle creating the VMs for demo hosts. + +Libvirt setup +------------- + +1. Install Vagrant 1.6.2 + + $ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.2_x86_64.rpm + $ yum -y --nogpgcheck localinstall vagrant_1.6.2_x86_64.rpm + $ vagrant version + Installed Version: 1.6.2 + Latest Version: 1.6.2 + +1. Setup libvirt + + $ sudo yum install @virtualization + $ wget http://file.rdu.redhat.com/~decarr/dockercon/libvirt-setup.sh + $ chmod u+x libvirt-setup.sh + $ sudo ./libvirt-setup.sh + $ sudo systemctl start libvirtd.service + $ sudo systemctl enable libvirtd.service + +1. Setup vagrant with libvirt + +Setup vagrant with libvirt + + $ sudo yum install -y wget tree vim screen mtr nmap telnet tar git + $ curl -sSL https://get.rvm.io | bash -s stable + $ sudo yum install -y libvirt-devel libxslt-devel libxml2-devel + $ gem install nokogiri -v '1.5.11' + $ vagrant plugin install --plugin-version 0.0.16 vagrant-libvirt + +1. Setup Vagrant Box and Vagrantfile + + vagrant box add --name=atomic --provider=libvirt http://rcm-img06.build.bos.redhat.com/images/releases/snaps/20140522.0/vagrant/rhel-atomic-host-vagrant.box + +Assume you have some location to hold Vagrantfile, i.e. ~/dockercon + + $ cd + $ wget https://raw.githubusercontent.com/matthicksj/vagrant-ostree-setup/master/Vagrantfile + +5. Start VM + + $ vagrant up --provider=libvirt + Bringing machine 'default' up with 'libvirt' provider... + ==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead. + ==> default: This is a bug with the provider. Please contact the creator + ==> default: of the provider you use to fix this. + ==> default: Creating image (snapshot of base box volume). + ==> default: Creating domain with the following settings... + ==> default: -- Name: dockercon_489e2b0ea1cb9397b6db6b1bd3a89ad8 + ==> default: -- Domain type: kvm + ==> default: -- Cpus: 4 + ==> default: -- Memory: 4096M + ==> default: -- Base box: atomic + ==> default: -- Storage pool: default + ==> default: -- Image: /var/lib/libvirt/images/dockercon_489e2b0ea1cb9397b6db6b1bd3a89ad8.img + ==> default: -- Volume Cache: default + ==> default: Creating shared folders metadata... + ==> default: Starting domain. + ==> default: Waiting for domain to get an IP address... + ==> default: Waiting for SSH to become available... + +If you run into issues, try the following: + + $ rm -fr ./vagrant + $ vagrant plugin list + +If you have other third-party plug-ins installed, try to remove them. In particular, we found erors when running the following plug-ins with vagrant-libvirt: + + 1. vagrant-aws + 2. vagrant-openshift + +SSH + +$ vagrant ssh + +You can now run rpm-ostree commands, etc. + +You can also see the vm running by viewing in virt-manager: + +$ virt-manager + + +Demo Setup +---------- + +These instructions assume that you already have a VM with geard and docker. Before you get started: + +1. Make sure that the docker and geard daemons are running. +1. Make sure that port `14000` on the VM is mapped to `14000` on your host machine. +1. Make sure that firewalld is stopped if using fedora as the OS for the VM: + + sudo systemctl stop firewalld.service + +1. Clone pmorie's geard for and switch to the right branch: + + git clone git://github.com/pmorie/geard + cd geard + git checkout demo + +1. Next, run the demo setup script: + + contrib/demo/setup.sh + +This will install the following containers: + + parks-backend-{1,2,3} + parks-db-1 + parks-lb-1 + +The setup script will leave `parks-backend-{2,3}` stopped, to be started for scale-up during the demo. Once the script has run, you should be able to hit the demo from your host in a browser at: + + http://localhost:14000 From 966f9d03e18bb639f491dd0edf41970b52d33b87 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Wed, 28 May 2014 18:24:06 -0400 Subject: [PATCH 05/32] Tweak instructions --- contrib/demo/instructions.md | 116 +++++++++++++++++------------------ 1 file changed, 55 insertions(+), 61 deletions(-) diff --git a/contrib/demo/instructions.md b/contrib/demo/instructions.md index 9e1212dc..555b6264 100644 --- a/contrib/demo/instructions.md +++ b/contrib/demo/instructions.md @@ -5,82 +5,78 @@ Libvirt setup 1. Install Vagrant 1.6.2 - $ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.2_x86_64.rpm - $ yum -y --nogpgcheck localinstall vagrant_1.6.2_x86_64.rpm - $ vagrant version - Installed Version: 1.6.2 - Latest Version: 1.6.2 + $ wget https://dl.bintray.com/mitchellh/vagrant/vagrant_1.6.2_x86_64.rpm + $ yum -y --nogpgcheck localinstall vagrant_1.6.2_x86_64.rpm + $ vagrant version + Installed Version: 1.6.2 + Latest Version: 1.6.2 1. Setup libvirt - $ sudo yum install @virtualization - $ wget http://file.rdu.redhat.com/~decarr/dockercon/libvirt-setup.sh - $ chmod u+x libvirt-setup.sh - $ sudo ./libvirt-setup.sh - $ sudo systemctl start libvirtd.service - $ sudo systemctl enable libvirtd.service + $ sudo yum install @virtualization + $ wget http://file.rdu.redhat.com/~decarr/dockercon/libvirt-setup.sh + $ chmod u+x libvirt-setup.sh + $ sudo ./libvirt-setup.sh + $ sudo systemctl start libvirtd.service + $ sudo systemctl enable libvirtd.service 1. Setup vagrant with libvirt -Setup vagrant with libvirt - - $ sudo yum install -y wget tree vim screen mtr nmap telnet tar git - $ curl -sSL https://get.rvm.io | bash -s stable - $ sudo yum install -y libvirt-devel libxslt-devel libxml2-devel - $ gem install nokogiri -v '1.5.11' - $ vagrant plugin install --plugin-version 0.0.16 vagrant-libvirt + $ sudo yum install -y wget tree vim screen mtr nmap telnet tar git + $ curl -sSL https://get.rvm.io | bash -s stable + $ sudo yum install -y libvirt-devel libxslt-devel libxml2-devel + $ gem install nokogiri -v '1.5.11' + $ vagrant plugin install --plugin-version 0.0.16 vagrant-libvirt 1. Setup Vagrant Box and Vagrantfile - vagrant box add --name=atomic --provider=libvirt http://rcm-img06.build.bos.redhat.com/images/releases/snaps/20140522.0/vagrant/rhel-atomic-host-vagrant.box + vagrant box add --name=atomic --provider=libvirt http://rcm-img06.build.bos.redhat.com/images/releases/snaps/20140522.0/vagrant/rhel-atomic-host-vagrant.box -Assume you have some location to hold Vagrantfile, i.e. ~/dockercon +Make a directory called `dockercon`: - $ cd - $ wget https://raw.githubusercontent.com/matthicksj/vagrant-ostree-setup/master/Vagrantfile + $ mkdir dockercon + $ cd dockercon + $ wget https://raw.githubusercontent.com/matthicksj/vagrant-ostree-setup/master/Vagrantfile 5. Start VM - $ vagrant up --provider=libvirt - Bringing machine 'default' up with 'libvirt' provider... - ==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead. - ==> default: This is a bug with the provider. Please contact the creator - ==> default: of the provider you use to fix this. - ==> default: Creating image (snapshot of base box volume). - ==> default: Creating domain with the following settings... - ==> default: -- Name: dockercon_489e2b0ea1cb9397b6db6b1bd3a89ad8 - ==> default: -- Domain type: kvm - ==> default: -- Cpus: 4 - ==> default: -- Memory: 4096M - ==> default: -- Base box: atomic - ==> default: -- Storage pool: default - ==> default: -- Image: /var/lib/libvirt/images/dockercon_489e2b0ea1cb9397b6db6b1bd3a89ad8.img - ==> default: -- Volume Cache: default - ==> default: Creating shared folders metadata... - ==> default: Starting domain. - ==> default: Waiting for domain to get an IP address... - ==> default: Waiting for SSH to become available... + $ vagrant up --provider=libvirt + Bringing machine 'default' up with 'libvirt' provider... + ==> default: HandleBoxUrl middleware is deprecated. Use HandleBox instead. + ==> default: This is a bug with the provider. Please contact the creator + ==> default: of the provider you use to fix this. + ==> default: Creating image (snapshot of base box volume). + ==> default: Creating domain with the following settings... + ==> default: -- Name: dockercon_489e2b0ea1cb9397b6db6b1bd3a89ad8 + ==> default: -- Domain type: kvm + ==> default: -- Cpus: 4 + ==> default: -- Memory: 4096M + ==> default: -- Base box: atomic + ==> default: -- Storage pool: default + ==> default: -- Image: /var/lib/libvirt/images/dockercon_489e2b0ea1cb9397b6db6b1bd3a89ad8.img + ==> default: -- Volume Cache: default + ==> default: Creating shared folders metadata... + ==> default: Starting domain. + ==> default: Waiting for domain to get an IP address... + ==> default: Waiting for SSH to become available... If you run into issues, try the following: - $ rm -fr ./vagrant - $ vagrant plugin list + $ rm -fr ./vagrant + $ vagrant plugin list If you have other third-party plug-ins installed, try to remove them. In particular, we found erors when running the following plug-ins with vagrant-libvirt: 1. vagrant-aws 2. vagrant-openshift -SSH - -$ vagrant ssh +6. SSH -You can now run rpm-ostree commands, etc. + $ vagrant ssh -You can also see the vm running by viewing in virt-manager: - -$ virt-manager +You can now run rpm-ostree commands, etc. You can also see the vm running by viewing in virt-manager: + $ virt-manager Demo Setup ---------- @@ -91,24 +87,22 @@ These instructions assume that you already have a VM with geard and docker. Bef 1. Make sure that port `14000` on the VM is mapped to `14000` on your host machine. 1. Make sure that firewalld is stopped if using fedora as the OS for the VM: - sudo systemctl stop firewalld.service + sudo systemctl stop firewalld.service 1. Clone pmorie's geard for and switch to the right branch: - git clone git://github.com/pmorie/geard - cd geard - git checkout demo + git clone git://github.com/pmorie/geard + cd geard + git checkout demo 1. Next, run the demo setup script: - contrib/demo/setup.sh + contrib/demo/setup.sh This will install the following containers: - parks-backend-{1,2,3} - parks-db-1 - parks-lb-1 - -The setup script will leave `parks-backend-{2,3}` stopped, to be started for scale-up during the demo. Once the script has run, you should be able to hit the demo from your host in a browser at: + parks-backend-{1,2,3} + parks-db-1 + parks-lb-1 - http://localhost:14000 +The setup script will leave `parks-backend-{2,3}` stopped, to be started for scale-up during the demo. Once the script has run, you should be able to hit the demo from your host in a browser at: `http://localhost:14000` From eaec5c8f56437a585938e6f14a6d577cefc266e5 Mon Sep 17 00:00:00 2001 From: Paul Morie Date: Wed, 28 May 2014 15:39:57 -0400 Subject: [PATCH 06/32] WIP: multi-host --- contrib/demo/deploy_parks_map_instances.json | 4 +- contrib/demo/deploy_parks_map_multihost.json | 138 +++++++++++++++++++ contrib/demo/instructions.md | 2 +- contrib/demo/setup-multi.sh | 41 ++++++ contrib/demo/setup.sh | 7 +- contrib/demo/teardown-multi.sh | 10 ++ 6 files changed, 193 insertions(+), 9 deletions(-) create mode 100644 contrib/demo/deploy_parks_map_multihost.json create mode 100755 contrib/demo/setup-multi.sh create mode 100755 contrib/demo/teardown-multi.sh diff --git a/contrib/demo/deploy_parks_map_instances.json b/contrib/demo/deploy_parks_map_instances.json index a5f8ea74..1ef2650d 100644 --- a/contrib/demo/deploy_parks_map_instances.json +++ b/contrib/demo/deploy_parks_map_instances.json @@ -88,7 +88,7 @@ "Id": "parks-backend-2", "Image": "parks-map-app", "From": "backend", - "On": "192.168.205.11", + "On": "localhost", "Ports": [ { "Internal": 3000, @@ -104,7 +104,7 @@ "Id": "parks-backend-3", "Image": "parks-map-app", "From": "backend", - "On": "192.168.205.11", + "On": "localhost", "Ports": [ { "Internal": 3000, diff --git a/contrib/demo/deploy_parks_map_multihost.json b/contrib/demo/deploy_parks_map_multihost.json new file mode 100644 index 00000000..a5f8ea74 --- /dev/null +++ b/contrib/demo/deploy_parks_map_multihost.json @@ -0,0 +1,138 @@ +{ + "Containers": [ + { + "Name": "lb", + "Image": "openshift/centos-haproxy-simple-balancer", + "PublicPorts": [ + { + "Internal": 80, + "External": 14000 + } + ], + "Links": [ + { + "To": "backend", + "NonLocal": true, + "AliasPorts": [ + { + "Internal": 3000, + "External": 8080 + } + ] + } + ], + "Count": 1 + }, + { + "Name": "backend", + "Image": "parks-map-app", + "PublicPorts": [ + { + "Internal": 3000 + } + ], + "Links": [ + { + "To": "db", + "AliasPorts": [ + { + "Internal": 27017 + } + ] + } + ], + "Count": 3 + }, + { + "Name": "db", + "Image": "openshift/centos-mongodb", + "PublicPorts": [ + { + "Internal": 27017 + } + ], + "Count": 1 + } + ], + "Instances": [ + { + "Id": "parks-lb-1", + "Image": "openshift/centos-haproxy-simple-balancer", + "From": "lb", + "On": "localhost", + "Ports": [ + { + "Internal": 80, + "External": 14000, + "Target": {} + } + ] + }, + { + "Id": "parks-backend-1", + "Image": "parks-map-app", + "From": "backend", + "On": "localhost", + "Ports": [ + { + "Internal": 3000, + "External": 4002, + "Target": { + "Host": "192.168.1.1", + "Port": 8080 + } + } + ] + }, + { + "Id": "parks-backend-2", + "Image": "parks-map-app", + "From": "backend", + "On": "192.168.205.11", + "Ports": [ + { + "Internal": 3000, + "External": 4003, + "Target": { + "Host": "192.168.1.2", + "Port": 8080 + } + } + ] + }, + { + "Id": "parks-backend-3", + "Image": "parks-map-app", + "From": "backend", + "On": "192.168.205.11", + "Ports": [ + { + "Internal": 3000, + "External": 4004, + "Target": { + "Host": "192.168.1.3", + "Port": 8080 + } + } + ] + }, + { + "Id": "parks-db-1", + "Image": "openshift/centos-mongodb", + "From": "db", + "On": "localhost", + "Ports": [ + { + "Internal": 27017, + "External": 4005, + "Target": { + "Host": "127.0.0.1", + "Port": 27017 + } + } + ] + } + ], + "IdPrefix": "parks-", + "RandomizeIds": false +} diff --git a/contrib/demo/instructions.md b/contrib/demo/instructions.md index 555b6264..fb01075e 100644 --- a/contrib/demo/instructions.md +++ b/contrib/demo/instructions.md @@ -1,4 +1,4 @@ -These instructions will take you from a clean VM* to a working dockercon demo app. In future iterations these instructions will handle creating the VMs for demo hosts. +These instructions will take you from a clean VM* to a working demo app. In future iterations these instructions will handle creating the VMs for demo hosts. Libvirt setup ------------- diff --git a/contrib/demo/setup-multi.sh b/contrib/demo/setup-multi.sh new file mode 100755 index 00000000..f014769e --- /dev/null +++ b/contrib/demo/setup-multi.sh @@ -0,0 +1,41 @@ +#!/bin/sh -x + +base=$(dirname $0) + +id=$(docker inspect --format="{{.id}}" openshift/centos-haproxy-simple-balancer) +ret=$? +if [ $ret -ne 0 ] || [ "$FETCH_IMAGES" != "" ]; then + docker pull openshift/centos-haproxy-simple-balancer + docker pull openshift/nodejs-0-10-centos + docker tag openshift/nodejs-0-10-centos nodejs-centos + docker pull openshift/centos-mongodb + docker pull pmorie/parks-map-app + docker tag pmorie/parks-map-app parks-map-app +fi + +set +x + +units=$(curl -q http://localhost:43273/containers) +ret=$? +if [ $ret -ne 0 ]; then + echo "gear daemon not responding, make sure the service is running and retry." + exit 1 +fi + +units=$(curl -q http://192.168.205.11:43273/containers) +ret=$? +if [ $ret -ne 0 ]; then + echo "gear daemon on vm2 not responding, make sure the service is running and retry." + exit 1 +fi + +$base/teardown-multi.sh + +descriptor=$base/deploy_parks_map_multihost.json + +gear deploy $descriptor localhost 192.168.205.11 +gear stop 192.168.205.11/parks-backend-{2,3} + +$base/wait_for_url.sh "http://localhost:14000/" + +sudo switchns --container=parks-db-1 -- /bin/bash -c "curl https://raw.githubusercontent.com/thesteve0/fluentwebmap/master/parkcoord.json | mongoimport -d fluent -c parkpoints --type json && mongo fluent --eval 'db.parkpoints.ensureIndex( { pos : \"2d\" } );'" diff --git a/contrib/demo/setup.sh b/contrib/demo/setup.sh index adedaa11..24058d31 100755 --- a/contrib/demo/setup.sh +++ b/contrib/demo/setup.sh @@ -24,12 +24,7 @@ fi $base/teardown.sh -descriptor=$base/deploy_parks_map.json -if [ "$MULTIHOST" != "" ]; then - descriptor=$base/deploy_parks_map_instances.json -fi - -gear deploy $descriptor localhost +gear deploy $base/deploy_parks_map.json localhost gear stop localhost/parks-backend-{2,3} $base/wait_for_url.sh "http://localhost:14000/" diff --git a/contrib/demo/teardown-multi.sh b/contrib/demo/teardown-multi.sh new file mode 100755 index 00000000..725b347b --- /dev/null +++ b/contrib/demo/teardown-multi.sh @@ -0,0 +1,10 @@ +#!/bin/sh -x + +base=$(dirname $0) + +gear stop --with=$base/deploy_parks_map_multihost.json +gear delete --with=$base/deploy_parks_map_multihost.json + +docker rm parks-db-1-data + +sudo du -s -h /var/lib/docker/vfs/dir From a60c5f301919bb004c58a5be47d9e61e73ff6af2 Mon Sep 17 00:00:00 2001 From: derekwaynecarr Date: Wed, 28 May 2014 15:36:06 -0500 Subject: [PATCH 07/32] Derek WIP for multihost --- contrib/demo/Vagrantfile | 72 +++++++++++++++++------------------- contrib/demo/instructions.md | 65 +++++++++++++++++++++----------- 2 files changed, 76 insertions(+), 61 deletions(-) diff --git a/contrib/demo/Vagrantfile b/contrib/demo/Vagrantfile index 8521e6de..3544401a 100644 --- a/contrib/demo/Vagrantfile +++ b/contrib/demo/Vagrantfile @@ -1,61 +1,55 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! VAGRANTFILE_API_VERSION = "2" +$script = <