from a pipeline to a government cloud
play

From a pipeline to a government cloud Toby Lorne SRE @ GOV.UK - PowerPoint PPT Presentation

From a pipeline to a government cloud Toby Lorne SRE @ GOV.UK Platform-as-a-Service www.toby.codes github.com/tlwr github.com/alphagov From a pipeline to a government cloud How the UK government deploy a Platform-as-a-Service using


  1. From a pipeline to a government cloud Toby Lorne SRE @ GOV.UK Platform-as-a-Service www.toby.codes github.com/tlwr github.com/alphagov

  2. From a pipeline to a government cloud How the UK government deploy a Platform-as-a-Service using Concourse, an open-source continuous thing-doer

  3. From a pipeline to a government cloud 1. GOV.UK PaaS overview 2. Concourse overview 3. Pipeline walkthrough 4. Patterns and re-use

  4. What is GOV.UK PaaS? What is a Platform-as-a Service? What are some challenges with digital services in government? How does GOV.UK PaaS make things better?

  5. What is a PaaS? Run, manage, and maintain apps and backing services Without having to buy, manage, and maintain infrastructure or needing specialist expertise

  6. Here is my source code Run it for me in the cloud I do not care how

  7. Deploy to production safer and faster Reduce waste in the development process

  8. Proprietary Open source Heroku Cloud Foundry Pivotal application service DEIS EngineYard Openshift Google App Engine kf AWS Elastic Beanstalk Dokku Tencent BlueKing Rio

  9. Why does government need a PaaS?

  10. UK-based web hosting for government services Government should focus on building useful services, not managing infrastructure

  11. Enable teams to create services faster Reduce the cost of procurement and maintenance An opinionated platform promotes consistency

  12. Communication within large bureaucracies can be slow Diverse app workloads are impossible to reason about Highly leveraged team requires trust and autonomy

  13. Only able to do this because of open source software and communities

  14. APPS SERVICES MANAGEMENT Operational API + CLI Service brokers metrics provided by OSB User management specification Cloud Foundry compliant Billing

  15. BOSH Grafana Concourse Terraform Prometheus

  16. Terraform BOSH terraform.io bosh.io Infrastructure as code, for Release engineering, VM provisioning arbitrary provisioning and resources lifecycling management Versatile tool for managing Very specific use-case, cloud infrastructure but very good at it Steep learning curve, high reward

  17. Prometheus Grafana prometheus.io grafana.com Metric collection, storage, Visualisation and and query dashboarding tool Large open-source ecosystem Good for aggregating multiple data sources Multi-dimensional labels for display enable a rich query language

  18. What is Concourse? Concourse is an open-source continuous thing-doer “A thing which does things, sometimes continuously” concourse-ci.org

  19. A general approach to automation, with extensibility as the primary design goal

  20. PIPELINE RESOURCE JOB TASK

  21. Pipelines Jobs Directed acyclic graph, Can run in parallel, or not just read in series left-to-right Composed of steps Contain resources and jobs Steps are compositions of running tasks, Written in YAML flow-control, and resource interactions Automatically visualised in the web UI

  22. Tasks Resources Specific Generic Represent doing a thing Defined by (unit of code execution) resource types Are stateless Immutable, idempotent, (in the long run) external source of truth Code is executed inside an “a single object with a ephemeral environment, linear version sequence” based on a container image

  23. Step flow control Resource interactions in_parallel is a step for getting a resource pulls running other steps in external state from the parallel, e.g. clone many source of truth git repos concurrently putting a resource step do is a step for running pushes local state to steps in series the source of truth try is a step which will Periodically resources not fail a job if it does are checked for new not succeed versions set_pipeline will update a pipeline’s config

  24. Task examples Resource types Build a container image Git/Image repository Compile release artefacts File in object storage Run automated tests Semantic version Generate release notes Distributed lock/pool GitHub release Terraform deployment Cloud Foundry app

  25. Simple continuous deployment

  26. Multi-environment continuous deployment

  27. A branching pipeline

  28. “Autonomate” a manual release process

  29. “Show me the YAML”

  30. Example: Continuously deploy terraform

  31. Continuously deploy terraform

  32. resources: - name: my-code-repo … - name: my-tf-deployment … jobs: - name: deploy-my-code …

  33. resources: - name: my-code-repo type: git icon: git source: branch: develop uri: https://github.com/x/y.git - name: my-tf-deployment … jobs: …

  34. resources: - name: my-code-repo … - name: my-tf-deployment type: terraform icon: terraform source: … jobs: - name: deploy-my-code …

  35. resources: … jobs: - name: deploy-my-code serial: true plan: - get: my-code-repo trigger: true - put: my-tf-deployment

  36. resources: This pipeline will deploy - name: my-code-repo terraform whenever the type: git icon: git develop branch changes source: branch: develop uri: https://github.com/x/y.git ((secrets)) are retrieved - name: my-tf-deployment from a credentials provider type: terraform icon: terraform when they are needed source: backend_type: s3 backend_config: Credential providers: bucket: my-prod-bucket key: tfstate/my-deployment.tfstate - Credhub region: eu-west-2 access_key: ((aws_access_key_id)) - AWS SSM secret_key: ((aws_secret_access_key)) - Kubernetes jobs: - Hashicorp Vault - name: deploy-my-code serial: true plan: - get: my-code-repo trigger: true - put: my-tf-deployment

  37. fly login \ --target my-concourse \ --open-browser fly set-pipeline \ --pipeline deployment \ --config cd-tf.yml

  38. Continuously deploy terraform

  39. Continuously deploy terraform (oh no)

  40. resources: - name: my-code-repo … - name: my-tf-deployment … - name: project-slack-channel type: slack icon: slack source: … jobs: …

  41. … put: my-tf-deployment on_failure: put: project-slack-channel params: channel: '#develop' icon_emoji: ':airplane:' text: | Build $BUILD_NAME failed. Check it out at: …

  42. Continuously deploy terraform with failure notifications

  43. Extending Concourse Resource interactions Build your own resource check is executed periodically An OCI compatible image, hosted somewhere Concourse in can access. is executed for a get step Which should contain up to three executables: out - /opt/resource/check is executed for a put - /opt/resource/in step - /opt/resource/out

  44. A git repo flies Through a concourse pipeline It becomes a cloud

  45. What do we care about? App availability (~99.99%) API availability (~99.9%) Safety and reproducibility are achieved through autonomation

  46. GOV.UK PaaS deployment pipeline

  47. GOV.UK PaaS deployment pipeline

  48. GOV.UK PaaS deployment pipeline

  49. GOV.UK PaaS deployment pipeline UNLOCK LOCK

  50. GOV.UK PaaS deployment pipeline CONFIG UNLOCK LOCK

  51. GOV.UK PaaS deployment pipeline CONFIG WAIT UNLOCK LOCK AVAILABILITY TESTS

  52. GOV.UK PaaS deployment pipeline CONFIG TERRAFORM WAIT UNLOCK LOCK AVAILABILITY TESTS

  53. GOV.UK PaaS deployment pipeline CONFIG TERRAFORM WAIT DEPLOY CF UNLOCK LOCK AVAILABILITY TESTS

  54. LOCK AVAILABILITY TESTS CONFIG GOV.UK PaaS deployment pipeline WAIT TERRAFORM DEPLOY CF PROMETHEUS & BROKERS UNLOCK

  55. GOV.UK PaaS deployment pipeline PROMETHEUS & BROKERS TESTS CONFIG TERRAFORM WAIT DEPLOY CF UNLOCK LOCK AVAILABILITY TESTS OTHER APPS

  56. GOV.UK PaaS deployment pipeline PROMETHEUS & BROKERS TESTS CONFIG TERRAFORM WAIT DEPLOY CF UNLOCK LOCK CERT AVAILABILITY TESTS OTHER APPS ROTATION

  57. GOV.UK PaaS deployment pipeline PROMETHEUS & BROKERS TESTS CONFIG TERRAFORM WAIT DEPLOY CF GIT TAG RELEASE UNLOCK LOCK CERT AVAILABILITY TESTS OTHER APPS ROTATION

  58. GOV.UK PaaS deployment pipeline PROMETHEUS & BROKERS TESTS CONFIG TERRAFORM WAIT DEPLOY CF GIT TAG RELEASE UNLOCK LOCK CERT AVAILABILITY TESTS OTHER APPS ROTATION

  59. Now do it all again! git merge --gpg-sign → Deploy staging → git tag → Deploy prod London → Deploy prod Dublin This process happens ~2.5x per day

  60. PROD IRELAND PROD LONDON STAGING

  61. Normal deployments are fully automated, so deploys are small, and occur often Deployments fail safely, due to locking, tests, and BOSH

  62. The UI is “anger optimised” - @vito It is visually obvious* what state a pipeline is in, and if it is broken

  63. Concourse and Grafana deployment overview annotations

  64. Concourse and Grafana deployment overview details

  65. Someone else’s code Is running in production Can I re-use this?

  66. Patterns and re-use, how? Concourse resource types available at resource-types.concourse-ci.org Patterns - Locks, pools, and counters - Availability tests - Metrics and annotations - Releases and communications

  67. Pools and locks with controls for pipeline operators github.com/concourse/pool-resource

  68. Availability tests implemented as a task github.com/tsenart/vegeta

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend