Upgrade to Pro — share decks privately, control downloads, hide ads and more …

T3DD24: The Art of Deployment

T3DD24: The Art of Deployment

From an FTP upload to a containerized and horizontally-scalable deployment on Kubernetes (and everything in between) — in this talk, I will take you on a journey through the history and challenges of getting your code up and running on your infrastructure.

I will present different deployment strategies and tools, explain the benefits and drawbacks of each, and offer guidance as to which strategy should be used when — starting with the usual atomic-deployment tools and then make my way to building and deploying container images, all the way to a fully cloud-native and scalable deployment on modern container orchestration platforms like Kubernetes.

Martin Helmich

August 02, 2024
Tweet

More Decks by Martin Helmich

Other Decks in Programming

Transcript

  1. MARTIN HELMICH Head of Architecture & Developer Relations Lecturer, Software

    Engineering & Cloud Computing Sci-Fi-Nerd, Metalhead, Amateur Woodworker
  2. WE HAVE VERSION CONTROL, DON’T WE? WE HAVE VERSION CONTROL,

    DON’T WE? I'M GOING TO DEPLOY MY SOFTWARE
  3. FRONTEND BUILDS DATABASE MIGRATIONS SMOKE TESTS “I JUST NEED TO

    GET MY CODE UP ON THE SERVER” “JUST DO A GIT PULL” CACHE FLUSHING CONTINUOUS RY COMPOSER DEPENDENCIES
  4. DEPLOYMENT REQUIREMENTS REPEATABLE and (potentially) AUTOMATABLE Complex processes consisting of

    multiple build steps should be easily repeatable without margin for human error. Typically, specialized deployment tools are used for this.
  5. DEPLOYMENT REQUIREMENTS REPEATABLE and (potentially) AUTOMATABLE ZERO DOWN TIME Deployments

    should not cause a down time; the software delivered to users should always be consistent, and releases should be switched instantly (“atomic”)
  6. DEPLOYMENT REQUIREMENTS REPEATABLE ZERO DOWN TIME REVERSIBLE and (potentially) AUTOMATABLE

    A deployment should be easily reversible in case of an unexpected error.
  7. DEPLOYED APP DEPLOYED DATABASE v1 v2 v2 ATOMIC SWITCH between

    releases sA sAB sB MIGRATIONS applied to live database; atomic switch impractical* Schema version B (and intermediary states) must be compatible with app version 1 + 2! v1 ROLLBACK to previous release
  8. QUALITY CONTROL AUTOMATE YOUR TESTING ( PHPUnit, Jest, Cypress, ...)

    CODING STYLE ( CS Fixer, CodeSniffer, Prettier, TypoScript Lint...) TYPE CHECKING ( TSC, PHPStan, PSALM, ...) CAUTION ! SHAMELESS SELF - PROMOTION
  9. watch kubectl get pods NAME READY STATUS AGE app-web-555899dd77-qxt6v 1/1

    Running 2d martin@local > helm upgrade --install --set image.tag=v1.0.1 ./chart app Chart upgraded. martin@local > app-db-0 1/1 Running 912d
  10. martin@local > helm upgrade --install --set image.tag=v1.0.1 ./chart app Chart

    upgraded. martin@local > watch kubectl get pods NAME READY STATUS AGE app-web-555899dd77-qxt6v 1/1 Running 2d app-db-0 1/1 Running 912d app-web-28677420-njbrn 0/1 Pending 1s
  11. martin@local > helm upgrade --install --set image.tag=v1.0.1 ./chart app Chart

    upgraded. martin@local > watch kubectl get pods NAME READY STATUS AGE app-web-555899dd77-qxt6v 1/1 Running 2d app-db-0 1/1 Running 912d app-web-28677420-njbrn 0/1 CrashLoopBackoff 5s helm upgrade --install --set image.tag=v1.0.2 ./chart app Chart upgraded. martin@local > AVAILABILITY is not impacted, because the previous release is still up and running
  12. martin@local > helm upgrade --install --set image.tag=v1.0.1 ./chart app Chart

    upgraded. martin@local > watch kubectl get pods NAME READY STATUS AGE app-web-555899dd77-qxt6v 1/1 Running 2d app-db-0 1/1 Running 912d app-web-28677420-njbrn 0/1 CrashLoopBackoff 5s helm upgrade --install --set image.tag=v1.0.2 ./chart app Chart upgraded. martin@local > app-web-799cf5bff-6kg2x 0/1 Pending 1s
  13. martin@local > helm upgrade --install --set image.tag=v1.0.1 ./chart app Chart

    upgraded. martin@local > watch kubectl get pods NAME READY STATUS AGE app-db-0 1/1 Running 912d app-web-28677420-njbrn 0/1 CrashLoopBackoff 11 helm upgrade --install --set image.tag=v1.0.2 ./chart app Chart upgraded. martin@local > app-web-799cf5bff-6kg2x 1/1 Running 5s app-web-555899dd77-qxt6v 0/1 Terminating 2d
  14. HEADLESS TYPO3 CMS MOBILE APP MICROSERVICES PI FIRST LOUD -

    NATIVE EADLESS A C H SINGLE PAGE APP SIDE NOTE https://extensions.typo3.org/extension/headless
  15. HEADLESS TYPO3 CMS MOBILE APP SINGLE PAGE APP FEATURE FEATURE

    FEATURE FEATURE FLAG STEP 1 : Release feature, disabled by feature flag Deploy in any order, ahead-of-time STEP 2 : Enable feature flag STEP 3 : Profit! FEATURE FEATURE FEATURE
  16. $unleash = UnleashBuilder::create(); ->withAppName('My TYPO3 site') ->withAppURL('https://my-typo3-site.example') ->withInstanceId('...') ->build(); $context

    = new UnleashContext( currentUserId: $req->getAttribute('frontend.user')->user['uid'], ); if ($unleash->isEnabled('some-feature'), $context) { // yay }
  17. page = PAGE page.10 = CONTENT # [...] [isFeatureEnabled('some-feature')] #

    [...] [end] // Caution: Not a real TYPO3 extension // (yet?)