Top Banner
50

GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Oct 04, 2020

Download

Documents

dariahiddleston
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: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io
Page 2: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

GovCMS: Lagoon ahoy!Auckland - May 2019

Page 3: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Agenda

1. Introduction to Lagoon

2. Introduction to the development platform

3. Demonstration

4. Q&A

Page 4: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Open Platform Technology: Lagoon,

Containerisation & Openshift

Page 5: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

History of amazee.ioSTORY TIME

2010 2011 2012 2013 2014 2015 2016 2017 2018

Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Page 6: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

History of LagoonSTORY TIME

... 2014 2015 2016 2017 2018

Local Docker

Decoupled!?

Open Source FTW!

Vagrant 😢🧐💡

Docker in Production!

Page 7: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Aug 2017: Lagoon is Open SourceSTORY TIME

Page 8: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Open Sourcevs.

Proprietary Hosting

Page 9: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Proprietary Hosting

Page 10: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Proprietary Hosting

Page 11: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

✅ Drupal

Open Sourceness of Drupal Hosting

❌ Hosting Platform

✅ PHP

✅ Nginx

✅ MySQL

✅ Operating System

✅ Linux Kernel

Page 12: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

● All Docker Images

● All Service Configurations

● Build & Deploy Scripts

● Test Infrastructure

● Apache 2.0 License

Lagoon is fully Open Source

Page 13: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

● OpenShift

● Kubernetes

● Alpine Docker Images

● Node.js, Golang, PHP

● Elasticsearch, Kibana, Logstash, RabbitMQ, OpenSSH

● Varnish, Nginx, MariaDB, Postgres, Redis, Solr, MongoDB,

Lagoon uses Open Source

Page 14: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

GovCMS 2.0: TL;DR;

Page 15: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

GovCMS 2.0: Too Short; Want More.

Lagoon OpenShift / Kubernetes

Local

Develop with docker-compose ● Reads

docker-compose.yml

● Build Images

● Setup OpenShift Projects

● Push Images to OS Registry

● Configure Resources

Container Orchestration

Git push

Webhooks Notifications

● Monitor Deployments

Page 16: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Microservices

Page 17: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Runs inside OpenShift

Page 18: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Lagoon deploys Lagoon

Page 19: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Lagoon is fully tested

1. Ansible

2. Starts new OpenShift & Lagoon

3. Creates fresh git repo

4. Commits Node.js code with random string

5. Let's Lagoon deploy from that git repo

6. Checks if deployed App contains random string

7. Rinse and Repeat for:

○ Drupal 7, Drupal 8, MariaDB, Postgres, Elasticsearch, Drush, and and and

Page 20: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Lagoon runs Docker

● Whatever you can put into Docker

○ It deploys with Lagoon

● Existing Templates for

○ Drupal (Varnish, Nginx, PHP, Solr, Elasticsearch, Redis, MariaDB, Postgres)

○ Wordpress, Silverstripe, TYPO3 ...

○ PHP Frameworks (Symfony, Laravel)

○ ELK (Elasticsearch, Logstash, Kibana)

Page 21: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Summary of Lagoon BenefitsA FEW REASONS TO USE LAGOON

● Lagoon is Battle tested

● Lagoon is and leverages Open Source

● Lagoon is fully automated tested

● Lagoon allows congruent local development

● Lagoon is and runs Docker

Page 22: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Wait! Containers? Images? Pods? Registries? OpenShift? Kubernetes?

Page 23: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Container ImagesUNDERSTANDING CONTAINERS

● Container Image contains an application and its dependencies

● Independent on Kernel Version (runs everywhere)

● Logically similar to VM Image but with very different implementation

● Immutable. Rebuild instead of Update an existing one

Page 24: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Container ImagesUNDERSTANDING CONTAINERS

● Container Images are based on another Container Image

PHP Container Image Drupal Container ImageAlpine Container Image

basedon

basedon

Page 25: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

ContainersUNDERSTANDING CONTAINERS

● Containers are created from Container Images

● Many Containers per Images possible

● Creation of Container takes Milliseconds

Container Image Container

Container

Container

Page 26: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Container Image RegistriesUNDERSTANDING CONTAINERS

● Container images are pushed to a Container Image Registry

Container Image

Container Image Registry

Page 27: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Container OrchestratorMANAGING CONTAINERS

● Container Orchestrator manages the container lifecycle over a distributed set of worker nodes

● Images are pulled from a Container Image Registry

● The container Orchestrator provides:

○ Service Discovery○ Self healing○ Networking○ Storage○ Routing○ Resource allocation

Container Image Registry

Page 28: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

PodsMANAGING CONTAINERS

● Pods keeps Containers together that should stay together

● Example: Nginx & PHP (both have Drupal Code in them)

PHP Container

Nginx/PHP Pod

Nginx Container

MariaDB Pod

MariaDB Container

Page 29: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

ApplicationsMODELLING APPLICATIONS AS SETS OF CONTAINERS

● Applications are composed of one or more Containers● Container Orchestrator understands dependencies● The services provided by the Container Orchestrator allow the Containers to

○ Find and communicate with each other○ Share storage○ Etc.

Page 30: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Environments aka Namespaces MAPPING CONTAINERS INTO ENVIRONMENTS USING NAMESPACES

● Kubernetes: NameSpace / OpenShift: Project● A NameSpace contains one or more Pods and Resources● A NameSpace can be thought of as an environment

Page 31: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

ScalingFLEXIBLE CONTROL OF WORKLOAD SIZE AND REDUNDANCY

● Pods can be automatically scaled

● Redundancy & Performance at the same time

Page 32: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

CI/CDA NEW PARADIGM FOR DEVELOPMENT AND DEPLOYMENT

● Each Git Branch can be deployed as an Environment/NameSpace

● Same for Pull-Requests

Page 33: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

ClustersFULL CLUSTER FOR FULL HA AND PROPER SLAS

● Masters manage Pods, Resources and Nodes (Orchestrators)● Etcd is the Master Database● Scaling happens on Worker/Compute Node

Page 34: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

OpenShift vs KubernetesOPENSHIFT = ENTERPRISE KUBERNETES

Kubernetes OpenShift

“Vanilla Linux Kernel” “Linux Distribution”

No Support Enterprise Support

“Self Service” All Inclusive

Upgradeable Full Upgrade Support

Moves FastMoves more predictable

Page 35: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Maintaining GovCMS project

Page 36: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Required

● Docker

● pygmy - multi-purpose Docker helper

Optional

● Ahoy - workflow helper

Host dependenciesWHAT NEEDS TO BE INSTALLED ON HOST TO DEVELOP A GOVCMS PROJECT

Page 37: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

● Docker images are built with all development tools installed during the image build process

● Development tools:

○ Parallel PHP lint

○ PHP Code Sniffer

○ Behat

○ PHPUnit

Toolset is inside containersDEVELOPMENT ENVIRONMENT HAS ALL TOOLS INBUILT

Page 38: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

1. CI configuration stored in image repository

2. Runs in GitLab on code changes in `master` branch and PRs

3. Publishes images to Dockerhub

GovCMS images CI AUTOMATED IMAGE TESTING AND PUBLISHING

Page 39: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

GovCMS image releaseCONTROLLED IMAGE RELEASE WORKFLOW

● Pushing tagged commit triggers deployment of ‘beta’ images to Dockerhub

● After manual review, images promoted to ‘latest’

● `ahoy release`:

1. Pulls latest ‘beta’ images from Dockerhub

2. Tags images as ‘latest’

3. Pushes images to Dockerhub

Page 40: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Improved DXSMOOTH DEVELOPMENT WORKFLOW

Ahoy wraps complex CLI calls into simplified commands:

build Build project.cli Start a shell inside CLI container.drush Run drush commands in the CLI service container.install Install the profile.lint Lint code.login Login to a website.logs Show Docker logs.make Install local dependencies.ps List running Docker containers.pull Pull latest docker images.push Push all docker images.release Push all docker images.restart Restart Docker containers.run Run command inside CLI container.stop Stop Docker containers.test Run all tests.test-behat Run Behat tests.test-phpunit Run PHPUnit tests.up Build project.

Page 41: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Maintaining SaaS site

Page 42: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

SaaS development platform contains all

necessary tools to efficiently develop, test and

deploy websites into preview and production

environments in a consistent and efficient way.

SaaS development platformBATTERIES INCLUDED

Page 43: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

● Environment configuration is provided with SaaS repository

● Easy to debug production issues

● No more “... but it works on my machine ...”

Identical environments

Page 44: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

SaaS project structurePROJECT SCAFFOLDING

.├── .ahoy.yml | Ahoy configuration.│├── .docker | Docker image files.│ ├── Dockerfile.cli │ ├── Dockerfile.nginx│ └── Dockerfile.php│├── .gitlab-ci.yml | GitLab CI configuration.│├── .lagoon.yml | Lagoon deployment configuration.│├── docker-compose.yml | Docker-compose configuration.│├── files | Project files.│ └── .gitkeep│├── tests | Behat and PHPUnit tests.│ └── .gitkeep│└── themes | Project themes. └── .gitkeep

Page 45: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Authoring SaaS themesADDING CODE TO SAAS SITE

● SaaS site get own private GitLab repository

● SaaS site use GovCMS images

● themes directory mounted into GovCMS container when environment is built

● While developing locally, changes are synchronized to container

● Code linting available in the GovCMS image

● Behat and PHPUnit configuration available in the GovCMS image

● Custom Behat and PHPUnit tests can be added to tests directory

Page 46: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

1. CI configuration stored in GovCMS image to enforce predefined steps

2. Consistent across all SaaS sites

3. Runs in GitLab for all sites when code changes on all branches and PRs

4. Performs code standards check and runs per-site tests

5. Triggers Lagoon deployment on success

SaaS CI AUTOMATED SAAS TESTING AND DEPLOYMENT

Page 47: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Improved DXSMOOTH DEVELOPMENT WORKFLOW

Ahoy wraps complex CLI calls into simplified commands:

build Build project.cli Start a shell inside CLI container.drush Run drush commands in the CLI service container.install Install the profile.lint Lint code.login Login to a website.logs Show Docker logs.make Install local dependencies.ps List running Docker containers.pull Pull latest docker images.push Push all docker images.release Push all docker images.restart Restart Docker containers.run Run command inside CLI container.stop Stop Docker containers.test Run all tests.test-behat Run Behat tests.test-phpunit Run PHPUnit tests.up Build project.

Exactly the same Ahoy commands as for GovCMS project

Page 48: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Demonstration

Page 50: GovCMS: Lagoon ahoy!amazee.io... · History of amazee.io STORY TIME 2010 2011 2012 2013 2014 2015 2016 2017 2018 Need hosting in CH Configuration Mgmt “How do you host?” amazee.io

Questions and discussions