liveBook · Manning

Platform as a service

As explained in Shipping Go: Develop, deliver, discuss, design, and go again

Platform as a Service is a cloud service model that provides a managed application platform while abstracting underlying infrastructure.

A team has a working application and wants to deploy small changes without managing servers first. Platform as a Service (PaaS) lets the team hand over source code while the platform identifies, builds, and runs the application. Heroku and Google App Engine are examples. This makes deployment easier, but the abstraction can cost more and limit access to underlying features. section 4.4 section 4.6

For a long-running Go service, make its status visible before deploying:

  • Add a `/health` handler that returns JSON such as `{"status":"up"}`. section 4.6
  • Register the handler with the HTTP server and listen on the platform-provided `PORT`, falling back to `8080` locally. section 4.6
  • Configure liveness and readiness checks against `/health`. A failed check can cause the platform to restart the application or mark a deployment as failed. section 4.6
Listing 4.8 app.yaml
runtime: go116
main: ./cmd
liveness_check:
  path: "/health"
  check_interval_sec: 30
  timeout_sec: 4
  failure_threshold: 2
  success_threshold: 2
readiness_check:
  path: "/health"
  check_interval_sec: 5
  timeout_sec: 4
  failure_threshold: 2
  success_threshold: 2
  app_start_timeout_sec: 300

The `app.yaml` example sets the Go runtime and points both liveness and readiness checks at `/health`. section 4.6

Listing 4.9 pipeline.yml
name: CI Checks
 
on:
  push:
    branches:
      - main
 
jobs:
...
  deploy-paas:
    name: Deploy PaaS
    runs-on: ubuntu-latest
    needs: test
    steps:
    - name: Check out code into the Go module directory
      uses: actions/checkout@v2
      with:
        fetch-depth: 0
    - name: Deploy App
      id: deploy
      uses: google-github-actions/deploy-appengine@main
      with:
        credentials: ${{ secrets.gcp_credentials }}
    - id: test
      run: curl "${{ steps.deploy.outputs.url }}/translate/hello"

The pipeline example deploys with a GitHub Actions App Engine action after tests, then calls the deployed application URL. section 4.6

PaaS sits between managing more infrastructure yourself and deploying a single function. It offers a more complete server for an application than Function as a Service (FaaS), while keeping deployment straightforward. Choose the abstraction that helps the team release and gather feedback now; revisit its cost and control limits as the product grows. section 4.4 section 4.7

How Shipping Go: Develop, deliver, discuss, design, and go again covers it

How deep it goes
Works through health checks, App Engine configuration, and a deployment pipeline; leaves underlying server provisioning abstracted.
Examples
Uses a Go health handler, App Engine YAML, and a GitHub Actions deployment followed by an HTTP request.
What it assumes
Assumes readers can work with Go HTTP handlers and YAML; provides deployment examples rather than teaching those formats from zero.
What you can do after
Apply it via Google App Engine by configuring health checks and a test-gated deployment pipeline.
How it connects
Relates PaaS to Infrastructure as a Service, Function as a Service, health checks, and continuous deployment.

Also explained in

Compare how 4 books explain platform as a service →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Shipping Go: Develop, deliver, discuss, design, and go again. The section links point to the parts of the book it draws on.