Code testing and Continuous Integration are just the first step in a source code to production process. Combined with infrastructure-as-code tools such as Puppet the whole process can be automated, and tested!
28. Vagrant
Virtual and cloud automation
VirtualBox
VMWare Fusion
AWS
Rackspace
Easy Puppet and Chef provisioning
Keep VM configuration for different projects
Share boxes and configuration files across teams
base box + configuration files
29. Vagrant base boxes
www.vagrantbox.es
puppet-vagrant-boxes.puppetlabs.com
anywhere! just (big) files
31. Vagrant
Vagrant.configure("2") do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "CentOS-6.4-x86_64-minimal"
config.vm.box_url = "https://.../CentOS-6.4-x86_64-minimal.box"
# web server
config.vm.define :www do |config|
config.vm.hostname = "www.acme.local"
config.vm.network "forwarded_port", guest: 80, host: 10080
config.vm.network "private_network", ip: "192.168.33.12"
end
config.vm.provision :puppet do |puppet|
puppet.module_path = "modules"
puppet.manifest_file = "site.pp"
end
end
41. appfuse-tomcat Dockerfile
FROM tutum/tomcat:8.0
ENV WEBAPP_HOME $CATALINA_HOME/webapps/ROOT
RUN apt-get update && apt-get install -y unzip curl postgresql
RUN rm -rf $CATALINA_HOME/webapps/ROOT
ENV REPO http://192.168.192.46:8000/repository/snapshots/
ENV VERSION 2.2.2-SNAPSHOT
# Get the war
RUN curl -sSL -o /tomcat/webapps/ROOT.war $REPO/org/appfuse/appfuse-spring/$VERSION/appfuse-spring-$
VERSION.war
&& mkdir -p $CATALINA_HOME/webapps/ROOT
&& cd $CATALINA_HOME/webapps/ROOT
&& unzip ../ROOT.war
&& rm ../ROOT.war
# get the postgresql jdbc jar
RUN curl -sSL -o $WEBAPP_HOME/WEB-INF/lib/postgresql-9.1-901.jdbc4.jar http://repo1.maven.org/
maven2/postgresql/postgresql/9.1-901.jdbc4/postgresql-9.1-901.jdbc4.jar
# configure the db connection and copy sql init file
COPY jdbc.properties $WEBAPP_HOME/WEB-INF/classes/
COPY dump.sql /
COPY run.sh /
42. run.sh
#!/bin/bash
if [ ! -f /.tomcat_admin_created ]; then
/create_tomcat_admin_user.sh
fi
psql -U postgres -h db postgres < /
dump.sql
exec ${CATALINA_HOME}/bin/catalina.sh run
47. Puppet Labs Beaker
Test deployments on real VMs, Docker containers,
Cloud providers
Use serverspec for assertions
48. Serverspec
describe package('httpd') do
it { should be_installed }
end
describe service('httpd') do
it { should be_enabled }
it { should be_running }
end
describe port(80) do
it { should be_listening }
end
describe file('/etc/httpd/conf/httpd.conf') do
it { should be_file }
its(:content) { should match /ServerName www.example.jp/ }
end
53. Capybara
Runs Web tests using lower level APIs
Webdriver/Selenium
Poltergeist
supports JavaScript
headless
54. features/smoke_tests.feature
@smoke_tests
Feature: Smoke tests
Smoke testing scenarios to make sure all system
components are up and running.
Scenario: Services should be up and listening to
their assigned port
* services should be listening on ports:
| 80 | apache |
| 8080 | tomcat |
| 5432 | postgresql |
Scenario: Appfuse is up and listening on port 80
Given I am at the "/login" page
Then I should see the text "Sign In"
55. Example code and slides
Available at
http://slideshare.csanchez.org
https://github.com/carlossg/continuous-delivery
http://blog.csanchez.org
57. Photo Credits
Brick wall - Luis Argerich
http://www.flickr.com/photos/lrargerich/4353397797/
Agile vs. Iterative flow - Christopher Little
http://en.wikipedia.org/wiki/File:Agile-vs-iterative-flow.jpg
DevOps - Rajiv.Pant
http://en.wikipedia.org/wiki/File:Devops.png
Pimientos de Padron - Howard Walfish
http://www.flickr.com/photos/h-bomb/4868400647/
Compiling - XKCD
http://xkcd.com/303/
Printer in 1568 - Meggs, Philip B
http://en.wikipedia.org/wiki/File:Printer_in_1568-ce.png
Relativity - M. C. Escher
http://en.wikipedia.org/wiki/File:Escher%27s_Relativity.jpg
Teacher and class - Herald Post
http://www.flickr.com/photos/heraldpost/5169295832/
Containers - Global Logistics Media
http://www.globallogisticsmedia.com/articles/view/primitive-container-transportation-you-wont-believe
Docker build ship run
http://blog.docker.com/2014/06/announcing-docker-hub-and-official-repositories/