I'd like to talk to everyone about someone we often neglect. That someone keeps our code flowing into production, runs all those automated tests, does things that we might not even remember to deploy to all our environments.
That someone is our build servers.
They tirelessly work to get our changes to our end users and we do neglect them. We don't treat our build servers like production servers, we hack them, we play with them, we mess up the environments. We may have several agents with different runtimes and gems and patch levels and who knows what.
We can do better.
In this talk I'd like to take you through something I've been working on over the last couple of months: Containerising your build. The tool I'll be using for this is Docker, but it's achievable with any VM or container technology. I'll take you through going from a working build on local to building local inside a container and then to moving that build to a build server, explaining what how and why as I go.
3. HOW'S THIS TALK GOING TO WORK
and what are we actually talking
about?
3
4. "a server is a server is a server, there
really are no test servers, build
servers, dev servers and production
servers... and spoons of course"
- @dewald_v
4
5. DOCKER IN 5
MINUTES
a quick and dirty look into images, containers and all that lies below
5
28. THE SUPER BUILD AGENT
28
BUILD AGENT
• Complex
• Can be containerised but needs a lot of config
• Holds all build tools and configuration for any type
of build it can service
• Results in high build-contention
• Difficult to scale
• Pushes artifacts to repositories
MAVEN 3
MAVEN 2
JDK 1.5
JDK 1.6
JDK 1.7
RUBY
PYTHON
GRADLE
29. THE MICRO BUILD AGENT
29
BUILD AGENT
• Very simple
• Can be easily containerised
• Holds build tools and configuration for only the
type of build it can service
• Easier to scale
• Can be managed with configuration as code
• Pushes artifacts to repositories
MAVEN 3
JDK 1.7
30. THE CONTAINER BUILD AGENT
30
BUILD AGENT
DOCKER
• Very simple
• Can be containerised it self (Docker in Docker)
• Doesn't have any build dependencies inside, only
docker
• Pulls build containers from a registry
• Simple to scale
• Pushes artifacts to repositories
• Basically a micro agent running only Docker
31. so what does a containerised build
pipeline look like?
31
37. BUILD CONFIGURATION
37
Backup your configuration
Configuration as code
Keep as little configuration on the server as possible
Keep build configuration next to the app it builds
38. THE GO SCRIPT
38
A Script for your build actions
Knows the commands to build your app
Keep it simple. Bash is a good start.
Everything that works on the build server should
work UNMODIFIED on the local environment.
Build server should just call this script
Use environment variables for environment
changes