8/8/2019 Pallet Gogrid
1/24
build your environments
in the cloud with pallet@tbatchelli
a.k.a. @disclojure
Oct 28, 2010
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
2/24
what
a provisioning and
configuration tool for thecloud
(and other places too)
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
3/24
how
jclouds by Adrian Cole - Create/destroynodes/services in the cloud.
- http://www.jclouds.org
pallet by Hugo Duncan - Manage andconfigure your nodes in a sane way.
- http://hugoduncan.github.com/pallet/
Thursday, October 28, 2010
http://hugoduncan.github.com/pallet/http://www.jclouds.org/http://hugoduncan.github.com/pallet/http://hugoduncan.github.com/pallet/http://www.jclouds.org/http://www.jclouds.org/8/8/2019 Pallet Gogrid
4/24
pallets goals
Use the same configuration of computenodes from development to production
Reuse of configuration artifacts by
composition and reuse (as opposed to copy
+modify)
Leverage SCM systems to store the historyof setups
Bring software engineering practices to
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
5/24
No central server
No agents on nodes
Works with standard (or custom) images
First-class support for complex multi-service configurations
All node configuration done remotely viagenerated scripts over SSH
DSL for generating scripts, resources
Testable
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
6/24
crates
Pallets basic configuration unit
A crate is a grouping of functions
Functions usually:- manipulate/create internal representations
- result in resources deployed or scripts being runin the target nodes
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
7/24
proxied
bootstrap
automatedadmin user
tomcat
java tomcat
tomcat
deploy
reverse
proxy
haproxy
Custom Crates
Standard Crates
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
8/24
proxied node(core/defnodeproxied"Basicwebapp,servedbytomcat"
{:os-family:ubuntu
:os-description-matches"10.04"
:inbound-ports[808022]}:bootstrap(resource/phase(crates/bootstrap))
:configure(resource/phase(crates/tomcat))
:deploy(resource/phase
(crates/tomcat-deploy"webapp.war"))
:restart-tomcat(resource/phase
(service/service"tomcat6"
:action:restart)))
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
9/24
proxied node(core/defnodeproxied"Basicwebapp,servedbytomcat"
{:os-family:ubuntu
:os-description-matches"10.04"
:inbound-ports[808022]}:bootstrap(resource/phase(crates/bootstrap))
:configure(resource/phase(crates/tomcat))
:deploy(resource/phase
(crates/tomcat-deploy"webapp.war"))
:restart-tomcat(resource/phase
(service/service"tomcat6"
:action:restart)))
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
10/24
proxied node(core/defnodeproxied"Basicwebapp,servedbytomcat"
{:os-family:ubuntu
:os-description-matches"10.04"
:inbound-ports[808022]}:bootstrap(resource/phase(crates/bootstrap))
:configure(resource/phase(crates/tomcat))
:deploy(resource/phase
(crates/tomcat-deploy"webapp.war"))
:restart-tomcat(resource/phase
(service/service"tomcat6"
:action:restart)))
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
11/24
jclouds instantiates one node (if needed)
Pallet:- Sets up an admin user, and exchanges SSH keys so that
you can login via SSH
-Installs tomcat, and all the necessary dependencies (e.g.
java)
- Deploys the designated webapp on tomcat- Starts tomcat
(converge{proxied1}
:computeservice
:phase:deploy)
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
12/24
How to deal withmulti-service setups?
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
13/24
well use this example
http://github.com/hugoduncan/pallet-examples
haproxy
proxy
tomcat
proxied
webapp
Thursday, October 28, 2010
http://github.com/hugoduncan/pallet-exampleshttp://github.com/hugoduncan/pallet-examples8/8/2019 Pallet Gogrid
14/24
multi-service config
(pallet.core/converge
{proxied10haproxy1}
:computeservice
:phase:deploy)
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
15/24
two-phase model1. Invoke: for each phase (bootstrap,
configure, deploy, etc...), on all nodes of
each tag, call the crates. This generates:
- An intermediate representation of boththe particular and the global configuration- A list of the tasks to perform to setup the
nodes up to that configuration level needed
2. Execute all listed tasks based on the final
configuration created in the previous step
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
16/24
the invoke step
haproxycrate- Schedules the creation its configuration based on the
info about the proxied nodes found in the intermediatemodel.
Notice that at this point the proxied info might not yet known
Notice that the actual creation of the configuration will bedone in the next step
proxied crate- for every proxied node it will create an entry in theintermediate model
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
17/24
the execute step
builds the actual files and scripts to becreated and executed, based on theintermediate model
Executes the scripts on the node via ssh,move files, etc...
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
18/24
{ { debconf-set-selections /etc/haproxy/haproxy.cfg.new
8/8/2019 Pallet Gogrid
19/24
reuse crates in allcycles of your app
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
20/24
development
haproxy
proxied
DB
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
21/24
QA
haproxy
proxied
DB
haproxy
proxied
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
22/24
integration tests
haproxy
DB
proxied proxied
DB
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
23/24
production
haproxy
proxied
haproxy
proxiedproxiedproxiedproxiedproxied
DBDB
Thursday, October 28, 2010
8/8/2019 Pallet Gogrid
24/24
thank you
please visit- www.pallet.org- www.jclouds.org
- #pallet on IRC- #jclouds on IRC- @hugoduncan on twitter
- @jclouds on twitter- and of course you can find everyting clojure in
www.disclojure.org
http://www.jclouds.org/http://www.pallet.org/http://www.disclojure.org/http://www.disclojure.org/http://www.jclouds.org/http://www.jclouds.org/http://www.pallet.org/http://www.pallet.org/