Slides from my talk at the first Clojure Conj in October, 2010. Accompanying code and a screencast may be found @ http://cemerick.com/2010/11/01/continuous-deployment-of-clojure-web-applications
2. ego
I am:
• A Clojure programmer of > 2.5 years
• Coauthor of the forthcoming “Clojure
Programming” book from O’Reilly
• Architect of Docuharvest
• Founder of Snowtide Informatics
(first (clojure-conj))
3. first principles
⚛ ☺
Your Powerful Beauty Your Customers
Anything that gets in the way of this happy
union is the enemy.
(first (clojure-conj))
4. definitional bits & minor opinions
• We’re focusing on small- to medium-size
deployments today.
• You’re (probably) not a special snowflake. Stay
close to the herd, and stick to your knitting.
• Application deployment is (always?) a people
and process problem, not a technology
problem.
(first (clojure-conj))
5. choosing a path
“system administration”
Unrepeatable, manual, undocumented; the high
priesthoods
oh god no
(first (clojure-conj))
6. choosing a path (“roll your own”)
Even the most clever spike is not a solution.
“Emacs + SLIME + Clojure running in GNU Screen;
all requests handled by Apache; mod_proxy sends
them to the appropriate Jetty instance / servlet.”
– Brian Carper @ http://briancarper.net/blog/510/deploying-
clojure-websites
“Feel free to say: ‘duct tape and string’ and ‘You're
doing it wrong’.” – Brian Carper (private email)
(first (clojure-conj))
9. interlude: deployment existentialism
The complexity that is visited upon us when writing
software is enough; in an ideal world, we shouldn’t have
to develop all this extraneous expertise in how to build,
package, and deploy that software as well. There are a
few things in software that I know how to do really well
that make me slightly unique, and I wish I could
concentrate on those rather than becoming a generalist
in this, yet another vector, which is fundamentally a
means to an end. History and circumstance seem to be
stacked against me at the moment, though.
– “…wherein I feel the pain of being a generalist”
http://cemerick.com/2010/09/22/
(first (clojure-conj))
10. hey jclouds!
• Meatspace: e.g. compute nodes, storage (local
& EBS/SAN), network routing & security, IP
allocation, etc
• If you had an API to this infrastructurey stuff,
you could make it do your bidding
• Luckily: jclouds provides exactly this, for
multiple cloud providers
(first (clojure-conj))
11. howdy pallet!
• Pallet:crates :: chef:recipes
• Include recipes via chef-solo if you like
• Beautiful declarative expression of
provisioning and configuration operations
• Simple, flexible model:
lift/converge/phases/tags/prefix
(first (clojure-conj))
13. get thee a .war file
• Allows you to deploy to any Java app server &
platforms like Google App Engine and the
Spring/VMWare platform
• Seriously, it’s not difficult:
– Maven: baked in war packaging
– Leiningen/Cake: leiningen-war plugin
– Gradle, Buildr, rake: Surely simple enough
(first (clojure-conj))
15. embedded Jetty/Grizzly
• Great for experimentation and throughout
development, e.g. jetty directly supported in
ring/compojure
• In production environments: roll-your-own
that buys you nothing, therefore unnecessarily
evil.
(first (clojure-conj))
16. Tomcat, JBoss, Glassfish et al.
• Huge communities guarantee:
• tool integration (e.g. profilers)
• tons of experienced devs
• books
• monitoring and management support
• resource management (e.g. DB connection pools)
• clustering (e.g. Shoal)
• commercial/paid support
• You will eventually need these; give yourself the
chance to take advantage of these resources
(first (clojure-conj))
17. now for the (continuous) part
Craft more
power & beauty
git push
Hudson
pulls
<build
process
here>
provision
/
configure
(first (clojure-conj))
18. automate or die
Craft more
power & beauty
git push
Hudson
pulls
<build
process
here>
provision
/
configure
(first (clojure-conj))
19. links
Resources that will eventually be available:
Slides: linked from my blog @ http://cemerick.com
Code: http://github.com/cemerick/clojure-web-deploy-conj
Credits:
• Hugo Duncan et al. http://github.com/hugoduncan/pallet
• Adrian Cole et al. http://code.google.com/p/jclouds
• ClojureNYC and Western Mass Dev Group attendees
that suffered through earlier revs of this talk
(first (clojure-conj))
20. Thank You!
I too am not a bit tamed—I too am untranslatable;
I sound my barbaric yawp over the roofs of the world.
The last scud of day holds back for me;
It flings my likeness after the rest, and true as any, on the
shadow’d wilds;
It coaxes me to the vapor and the dusk.
I depart as air—I shake my white locks at the runaway sun;
I effuse my flesh in eddies, and drift it in lacy jags.
I bequeathe myself to the dirt, to grow from the grass I love;
If you want me again, look for me under your boot-soles.
You will hardly know who I am, or what I mean;
But I shall be good health to you nevertheless,
And filter and fibre your blood.
Failing to fetch me at first, keep encouraged;
Missing me one place, search another;
I stop somewhere, waiting for you.
— Walt Whitman, Leaves of Grass
(first (clojure-conj))