Building an automated
Staging environment
LESSONS LEARNED BY DANIEL OLIVEIRA
About Me
danieloliv079
danieloliveira079
df@autobutler.de
Daniel Oliveira
Black Magic Ops
About Us
https://www.autobutler.dk
Stack
Challenge
Provide a staging environment where
we can deploy our applications
requiring as less human
interaction/intervention as possible.
Toolbox
1º Step: Dockerize 'Em All
+
2º Step: Cloud Provisioning
+ KOPShttps://github.com/kubernetes/kops
(Network, Postgresql, Salt Master, Salt Minion)
3º Step: From code to K8S
https://Pull Request
Dynamic URLs
Challenges / Solutions
■ Developers don't wanna learn shell commands / CD + Github integration
■ Where should I host my docker images? / Docker Cloud Private Registry
■ Docker building time / Base image for gems initial install
■ Database Isolation per deployment / Reuse or on-demand
■ AWS - K8S Cluster CPU and RAM Usage / Ops Microservices - Garbage collector
Challenges / Solutions
■ Dynamic URLs / Salt Formulas + AWS Route 53 + NGINX controllers
■ HTTPS / Letsencrypt
■ Jira Integration / Ops Microservice - Update Ticket and includes URLs
■ Logging and debugging / Weavescope
■ DRY / Saltstack states+pillars
■ Integrations / Third-Party APIs (Github, Jira, Internal)
■ Deployments management / Deployment Dashboard (Built in house)
■ Pull request updates (source code) / Redeploy using dashboard or slack bot
■ Linked environments / Rails API + React Front-End
Challenges / Solutions
Challenges / Solutions
■ Manual deployments / Slack Bot
■ Manual Destroy / Deployment dashboard option
Deployment workflow
Pull Request webhook
Update
Notify
Update
Deployment Dashboard
Logging and Monitoring - Weavescope
Logging and Monitoring - Weavescope
Results
■ Sandbox environment
■ Product team can validate features and bug fixes
■ End-to-end testing
■ AWS - K8S Cluster CPU and RAM / Ops Microservices - Garbage collector
Future
■ Decrease rails application image size
■ Helm Charts - https://helm.sh/
■ Ops FaaS - https://github.com/alexellis/faas
■ Move off from Heroku to AWS / Kubernetes
■ Logging and Monitoring Aggregation / Prometheus + Sysdig + Datadog
From Code to Kubernetes - Slideshare
Questions ?
Thank you ?

Implementing an Automated Staging Environment