Skip to content

Instantly share code, notes, and snippets.

@davecan
Last active January 12, 2019 02:48
Show Gist options
  • Save davecan/9939343afa0382bcaf5b20cd1c1babae to your computer and use it in GitHub Desktop.
Save davecan/9939343afa0382bcaf5b20cd1c1babae to your computer and use it in GitHub Desktop.

REST & Spring Boot concepts

Sources

CloudFoundry Architecture

  • PCF is a set of apps installed on VMs run in public or private clouds
    • It abstracts away the underlying IaaS across multiple cloud providers by focusing on their common denominator -- VMs
    • By doing this it provides a PaaS for rapid cloud development -- dev against PCF, deploy onto any CSP where we installed PCF
  • Ex: an AWS or Azure cloud in a certain geographic region may have a set of VMs on it leased by a company
    • The company installs PCF onto these VMs
    • The company goes into PCF and establishes orgs and spaces
      • Orgs: logical groupings of compute resources
      • Spaces: within orgs, ex: dev, qa, prod spaces (custom names) -- we create spaces within orgs
      • Apps live in spaces, spaces live in orgs, orgs live in a PCF instance
        • Apps and services are not shared between spaces -- they are bound to a specific space
        • This makes for cleaner installs, no shared data/state
        • Each app in PCF can have one or more services bound to it
          • This injects some runtime environment variables into the app during the provisioning process
          • These in turn configure PCF to autoconfigure some components (beans in Spring Boot) into the app
  • PCF consists of over 15 specialized apps, originally written in Ruby then rewritten in Go
  • Diego Brain service allocates resources within the PCF
  • CF Router facilitates routing and service registry within PCF
  • The Cloud Controller exposes a REST interface -- can interact with it programmatically via the CLI cf command
  • The UAA is an OAuth2 server within PCF
  • Client request flow:
    • Client submits request
    • Request first hits a load balancer -- usually F5 load balancer
    • F5 distributes request to a chosen GoRouter
    • GoRouter in turn acts as load balancer for a set of container apps
    • GoRouter monitors health of the container, if it is maxing memory/etc and autoscaling is set up the GoRouter can spin up a new container by coordinating with Diego Brain to access a VM from the VM pool
    • Other PCF services such as Health Monitor facilitate service orchestration

Deploying Apps to PCF

  • Use cf push in the home dir of the app
  • What this does
    • CLI sends request to Cloud Controller to create the app
    • CLI uploads the app to the Blob Store
    • CLI sends requests to Diego Cell which allocates reources & starts the app
  • It also checks for buildpacks appropriate to the app
    • These provide runtime support for the app
    • It determines which buildpacks to use by scanning the app directories and looking for certain signatures
      • e.g. if it detects python code it uses the python buildpack, etc
      • We can also specify which one to use in case PCF can't determine which to use
  • Can view app instance health - running, memory, space, etc.
  • Loggregator is a log viewer that shows consolidated logs from all app container instances
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment