Top Banner
BARCELONA HUG - 14 SEP 2017 at
37

Hashicorp at holaluz

Jan 23, 2018

Download

Internet

Ricard Clau
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Hashicorp at holaluz

BARCELONA HUG - 14 SEP 2017

at

Page 2: Hashicorp at holaluz

7 YEARS AGO…• Vagrant first commit was in 17 Jan 2010

• Holaluz was founded in 12 Nov 2010

• DevOps starts becoming a concept

• A backend developer in a big e-commerce

Page 3: Hashicorp at holaluz
Page 4: Hashicorp at holaluz

WHO AM I?• Currently working as CTO at Holaluz

• Ex Wonga, Hailo, SocialPoint, Ulabox, Privalia…

• Developer for many years, been automating things for a while, DevOps before it was trendy!

• https://devops.barcelona conference co-organiser

Page 5: Hashicorp at holaluz
Page 6: Hashicorp at holaluz

HOLALUZ WEBAPPS INFRA

Web servers under ELBS

running Apache+ PHP7.1

Dedicatedcron job boxesusing PHP7.1

RDS PostgreSQLinstances

EC2 Elasticsearch

Some S3buckets tostore files

ElasticacheRedis

for messagededuping

SQS queuesbackground

jobs

RDS MySQLinstances

EFS to storeshared files(moving to S3 & ELK)

Page 7: Hashicorp at holaluz

HOLALUZ BIGDATA INFRA

Python apps & cron tasks using Django and Celery

R runninginstances

RDSPostgreSQL

instances

EC2 Elasticsearch

EC2 MongoDB

Some S3buckets tostore files

ElasticacheRedis

for Celery

Page 8: Hashicorp at holaluz

HOLALUZ ERP INFRA

RDSSQLServer

Per env S3 buckets and SQS communicating

with Web Infra

License ServersCluster

Windows 2012R2 Servers Cluster running Java8

PROD

INTEGRATION

DEVELOPMENT

Page 9: Hashicorp at holaluz

OTHER THINGS AROUND

Shared ELK Stack for logs aggregation and inspection

Middleman static sitesgenerator

Grafana for Time Series inspection and alerting

InfluxDB for Time Series metrics storage

E-Invoice Document Management + approval

flows

Cloudwatch Time Series metrics storage and alerting

Page 10: Hashicorp at holaluz

HASHICORP TOOLS• Confession: I am a massive fan

• Work everywhere, automate anything

• Excellent open-source community

• Well documented, specially BC changes

Page 11: Hashicorp at holaluz

Development Environments Made Easy

Page 12: Hashicorp at holaluz

VAGRANT AT HOLALUZ• Static website generator middleman (Ruby based)

• Local environments for PHP projects

• Local environments for Python Big Data projects

• Coming soon, Windows boxes for people who need to connect to sites needing old IE

Page 13: Hashicorp at holaluz
Page 14: Hashicorp at holaluz

Build Automated Machine Images

Page 15: Hashicorp at holaluz

CONCEPTS• Builders: Platforms you build images in. It is all

about what you start from!

• Provisioners: Installs and configures

• Post-processors: Optional final steps

Page 16: Hashicorp at holaluz

WHAT I LIKE• Builds for multiple platforms from a single

source configuration

• VERY Easy to understand

• Works (and can provision) in Win, Mac, Linux

• Easy to share provisioning scripts or use Puppet / Ansible recipes

Page 17: Hashicorp at holaluz

CAVEATS• Need to be very prescriptive or you end up

with multiple very similar templates

• A bit hard to go with a DRY approach

• Some things are hard to destroy / replace with new images

Page 18: Hashicorp at holaluz

PACKER AT HOLALUZ• All PHP infrastructure with ASGs using

AMIs we recycle periodically

• Kibana, Logstash, Grafana, InfluxDB

• Python BigData infrastructure as well (R soon)

• ERP first steps on top of official Windows AMIs

Page 19: Hashicorp at holaluz
Page 20: Hashicorp at holaluz
Page 21: Hashicorp at holaluz

Write, Plan and Create Infrastructure as Code

Page 22: Hashicorp at holaluz

CONCEPTS• Provider: Platform we are automating

• Resources: Automatable things in the Provider

• Modules: Reusable set of resources

• State: Used to diff desired state to existing. Can be stored remotely and supports distributed locking

Page 23: Hashicorp at holaluz

WHAT I LIKE• Can integrate with anything that has an API

• Easy to extend, contribute and really quick to add new features. Excellent Github community

• Existing resources can be imported (PAIN)

• Have used it for 18 months, multiple providers, rarely hit a bug and was always quickly fixed

Page 24: Hashicorp at holaluz

CAVEATS• Once you go Terraform, STOP using Console

• Some providers don´t have nice update support

• Terraform modules feel a bit hacky

• Sometimes state needs manual edition (getting much better but beware new providers)

Page 25: Hashicorp at holaluz

TERRAFORM AT HOLALUZ• Most infrastructure rebuilt using Terraform

• VPC / Network for test environments

• Some S3 buckets and SQS configuration

• Most IAM policies

Page 26: Hashicorp at holaluz

INTERESTING TRICKS (I)

Automatic code deployment via EC2userdata on startup

Page 27: Hashicorp at holaluz

INTERESTING TRICKS (II)

Always apply latest built AMI using a filter

on tags created by Packer

Page 28: Hashicorp at holaluz

INTERESTING TRICKS (III)

Environments Modules

State in S3 per envLock via DynamoDB

Use env output as variables in another env

Page 29: Hashicorp at holaluz

BACK IN JANUARY• Deployments were painful

• Unreliable test and local dev environments

• Hard to integrate new things

• Poor logging and monitoring metrics

• Painful error recovery, no real DR strategy

Page 30: Hashicorp at holaluz

BAD HABITS AND PROBLEMS• Development teams did not talk much

• Little understanding of network and infra

• Lack of technical guidelines

• No time to rethink processes

• Lots of legacy code with no tests at all

Page 31: Hashicorp at holaluz

HOLALUZ IN SEPTEMBER• One-click deployments almost everywhere

• Development teams talk and collaborate

• Releases speed MASSIVELY improved

• Decent logging and monitoring

• Better error recovery, decent DR strategy

Page 32: Hashicorp at holaluz

LONG WAY TO GO• Lots of technical debt still to pay

• Fragility in crucial parts of our business

• Still too many bugs, still too little testing

• Incoming changes in Energy (electric cars, smart batteries, prosumers, blockchain…)

Page 33: Hashicorp at holaluz

NEAR FUTURE• Complete missing Vagrant environments

• Packer generating Docker containers for Dev envs

• Import all existing resources into Terraform and rebuild the production network (PAIN)

• Increase AWS usage (Redshift, DynamoDB…)

• Full automated EVERYTHING

Page 34: Hashicorp at holaluz

DEVOPS IS…• Devs and Ops working together to deliver value

• Empower teams, reduce hard dependencies

• Communicaton, Integration, Collaboration

• Boosting productivity, make life easier!

• Automation, CI/CD, Infrastructure as code…

Page 35: Hashicorp at holaluz

ENABLE THE BUSINESS!That´s what they pay us for!

Page 36: Hashicorp at holaluz

BOOKS AND REPOS• The Phoenix Project - Gene Kim, Kevin Behr, George Spafford

• The DevOps Handbook - Gene Kim, Patrick Debois

• Terraform: Up and Running - James Turnbull

• https://github.com/ricardclau/geekshubsbcn (Packer + Terraform)

• https://github.com/kaorimatz/packer-templates (Linux) & https://github.com/joefitzgerald/packer-windows (Windows)

• https://github.com/terraform-community-modules (MANY examples)

Page 37: Hashicorp at holaluz

QUESTIONS? CONTACT?• Email: [email protected]

• Twitter : @ricardclau

• Github: https://github.com/ricardclau

• If you think these techniques help your company, let´s talk!