Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
5f2c7e0
Add build cmd to demo setup
pmorie May 27, 2014
714b55e
Demo WIP
pmorie May 28, 2014
4636882
Update demo setup.sh
pmorie May 28, 2014
16dec29
Add demo instructions
pmorie May 28, 2014
966f9d0
Tweak instructions
pmorie May 28, 2014
eaec5c8
WIP: multi-host
pmorie May 28, 2014
a60c5f3
Derek WIP for multihost
derekwaynecarr May 28, 2014
62de2bb
Change provisioner script to hit a docker registry on the host
pmorie May 29, 2014
a72ada4
Tweak instructions
pmorie May 29, 2014
4967891
Tweaks II
pmorie May 29, 2014
68515d3
Make demo instructions README
pmorie May 29, 2014
4f85dc7
Tweaks III
pmorie May 29, 2014
faafaa9
Tweaks IV
pmorie May 29, 2014
581b7de
Ensure private network interface is up after restart
derekwaynecarr May 29, 2014
3440a80
Modify ostree repo config to disable gpg-verify
derekwaynecarr May 29, 2014
297e614
Use explicit host names instead of IP for On
derekwaynecarr May 29, 2014
cd92efe
Gear deploy uses a simple in-order placement strategy
derekwaynecarr May 29, 2014
23b4c96
Vagrantfile / readme changes
pmorie May 29, 2014
f662953
Rename VMs
pmorie May 30, 2014
cd2bdab
Minor changes to Vagrantfile
pmorie May 30, 2014
b636120
Add cockpit to instructions
pmorie May 30, 2014
4947da5
Add shipyard instructions
pmorie May 30, 2014
a80d52c
Re-add cockpit stuff
pmorie May 30, 2014
3c53db0
Last minute tweaks
pmorie May 30, 2014
b375bbd
Add vagrant gem warning.
mrunalp May 30, 2014
2d1cb9e
Take shipyard instructions back out :)
pmorie May 30, 2014
1037ed1
Set explict host-names to differentiate boxes in cockpit
derekwaynecarr May 30, 2014
ddf04ad
Update box in demo readme and remove rpm-ostree upgrade step
pmorie Jun 1, 2014
fafc3b4
Fix multiple provision invocations
pmorie Jun 1, 2014
55d8798
Add instructions for atomic-2 setup in cockpit
pmorie Jun 1, 2014
bddd41a
Redirect stderr for provision scripts
pmorie Jun 1, 2014
21d577c
Update README.md
thesteve0 Jun 2, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
161 changes: 161 additions & 0 deletions contrib/demo/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
demo
====

These instructions will take you through setting up vagrant and libvirt and using these tools to
setup and execute a geard demo.

1. [Host setup](#host-setup)
1. [Demo setup](#demo-setup)

Host 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

2. 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

3. 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
#For this to work I had to "sudo yum install ruby-dev*"
$ gem install nokogiri -v '1.5.11'
# Make sure that vagrant isn't installed as a gem. If it is, then uninstall it.
$ vagrant plugin install --plugin-version 0.0.16 vagrant-libvirt

4. Setup Vagrant Box and review Vagrantfile

vagrant box add --name=atomic --provider=libvirt http://download.eng.bos.redhat.com/rcm-guest/staging/walters/images/snaps/20140531.1/vagrant-libvirt/rhel-atomic-host.box

Clone pmorie's fork and check out the `multi-demo` branch:

$ git clone git://github.com/pmorie/geard
$ cd geard
$ git checkout demo-multi
$ cd contrib/demo
$ cat Vagrantfile

5. Pull and start local docker registry

$ docker pull pmorie/geard-demo-registry
$ docker run -p 5000:5000 pmorie/geard-demo-registry

6. Start VMs

$ 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
errors when running the following plug-ins with vagrant-libvirt:

1. vagrant-aws
2. vagrant-openshift

Be patient. This will bring up two vm instances: `atomic-1` and `atomic-2`. The provisioner on
the initial vagrant up will fetch all required docker images to support the demo from the local
registry, and git clone required content.

7. SSH access

Validate that you can reach the VMs with ssh:

$ vagrant ssh atomic-1
$ docker images
$ cd geard
$ git branch
* demo-multi
master

$ vagrant ssh atomic-2
$ docker images
* demo-multi
master

You can now run rpm-ostree commands, etc. You can also see the vm running by viewing in
virt-manager:

$ virt-manager

You should see be able to see both instances running.

<!---
8. OSTree Upgrade

Next, we need to update to the latest packages. On both VMs, run the following:

$ rpm-ostree upgrade

Then reboot the VMs:

$ vagrant halt
$ vagrant up --provider=libvirt && vagrant provision

Note: The `vagrant-libvirt` provider does not support the `vagrant up --provision` flag. The
provision step is required to work around an issue where the private network interface is not
brought up on boot by vagrant controller for each VM to communicate.
-->

8. Cockpit

After running `vagrant up`, cockpit should be started and available at: `http://localhost:11001`.
Use the following credentials:

user: root
password: atomic2014

Once you have logged into cockpit, click the 'Add server' button on the right-hand side of the
page. Enter `atomic-2` for the hostname and leave `login with my current credentials` checked.

Demo Setup
----------

Once the host is set up, you can deploy the demo containers:

$ cd geard
$ contrib/demo/setup-multi.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`
111 changes: 111 additions & 0 deletions contrib/demo/Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
VAGRANTFILE_API_VERSION = "2"

# TODO: add determination of where a registry is available on the host - fall back to public index if not
$script = <<SCRIPT

id=$(docker inspect --format="{{.id}}" openshift/centos-haproxy-simple-balancer 2> /dev/null)
ret=$?
if [ $ret -ne 0 ]; then
echo Performing required docker pulls
gateway=`netstat -rn | grep "^0.0.0.0 " | cut -d " " -f10`
docker pull $gateway:5000/openshift/centos-haproxy-simple-balancer
docker tag $gateway:5000/openshift/centos-haproxy-simple-balancer openshift/centos-haproxy-simple-balancer

docker pull $gateway:5000/openshift/nodejs-0-10-centos
docker tag $gateway:5000/openshift/nodejs-0-10-centos openshift/nodejs-0-10-centos
docker tag openshift/nodejs-0-10-centos nodejs-centos

docker pull $gateway:5000/openshift/centos-mongodb
docker tag $gateway:5000/openshift/centos-mongodb openshift/centos-mongodb

docker pull $gateway:5000/openshift/parks-map-app
docker tag $gateway:5000/openshift/parks-map-app openshift/parks-map-app
docker tag openshift/parks-map-app parks-map-app
fi

if [ ! -d "geard" ]; then
echo "Fetching geard code"
git clone git://github.com/pmorie/geard
cd geard
git checkout demo-multi 2>&1
fi

if [ ! "$(ifconfig | grep eth1)" ]; then
echo "Enabling eth1 for private network across VMs"
ifup eth1 2>/dev/null
echo Done
fi

if [ ! "$(cat /ostree/repo/config | grep gpg-verify=false)" ]; then
echo "Modifying ostree repo config to use gpg-verify=false"
echo "gpg-verify=false" >> /ostree/repo/config
fi

if [ ! "$(cat /etc/hosts | grep atomic-1)" ]; then
echo "Adding host entries for VMs"
echo "192.168.205.10 atomic-1" >> /etc/hosts
echo "192.168.205.11 atomic-2" >> /etc/hosts
echo "$gateway testrepo" >> /etc/hosts
fi

echo "Setting root password"
passwd 2> /dev/null <<EOF
atomic2014
atomic2014
EOF

if [ "$1" == "atomic-1" ]; then
echo "Setting hostname on atomic-1"
hostname atomic-1
fi

if [ "$1" == "atomic-2" ]; then
echo "Setting hostname on atomic-2"
hostname atomic-2
fi

echo "Starting cockpit"
sudo systemctl start cockpit

sudo setenforce 0
SCRIPT

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "atomic"
config.vm.synced_folder './', '/vagrant', type: 'rsync', disabled: true

config.vm.provider :virtualbox do |v|
v.memory = 4096
v.cpus =4
v.customize ["modifyvm", :id, "--cpus", "4"]
v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end

config.vm.provider :libvirt do |libvirt|
libvirt.cpus = 4
libvirt.memory = 4096
libvirt.driver = 'kvm' # needed for kvm performance benefits!
libvirt.connect_via_ssh = false
libvirt.username = 'root'
end

config.vm.define "atomic-1" do |config|
config.vm.provision "shell", inline: $script, args: "atomic-1"
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
config.vm.network "forwarded_port", guest: 1001, host: 11001
config.vm.network "private_network", ip: "192.168.205.10", libvirt__network_name: "demo"
end

config.vm.define "atomic-2" do |config|
config.vm.provision "shell", inline: $script, args: "atomic-2"
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
config.vm.network "forwarded_port", guest: 1001, host: 21001
config.vm.network "private_network", ip: "192.168.205.11", libvirt__network_name: "demo"
end

end
5 changes: 5 additions & 0 deletions contrib/demo/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
systemctl stop geard
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
rm -fr /var/lib/containers
systemctl start geard
Loading