O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Cloud Foundry for Developers

Book Description

Deploy and scale applications on Cloud Foundry

About This Book

  • Gain hands-on experience using Cloud Foundry
  • Implement deployment, management and scaling of applications on Cloud Foundry
  • Learn best practices and troubleshooting tips for running applications on Cloud Foundry

Who This Book Is For

This book is aimed at developers, engineers and architects who want to learn key aspects of developing and running applications on the Cloud Foundry Platform.

Prior knowledge Cloud Foundry is not necessary.

What You Will Learn

  • Understand Cloud Foundry (CF) tools and concepts.
  • Understand the breadth of possibilities unleashed through a lightweight agile approach to building and deploying applications.
  • Design and deploy cloud native applications that run well on Cloud Foundry.
  • Learn Microservice design concepts and worker applications.
  • Customize service brokers to publish your services in the Cloud Foundry marketplace.
  • Using, managing and creating buildpacks for the Cloud Foundry Platform.
  • Troubleshoot applications on Cloud Foundry
  • Perform zero-downtime deployments using blue/green routes, A/B testing, and painless rollbacks to earlier versions of the application.

In Detail

Cloud Foundry is the open source platform to deploy, run, and scale applications. Cloud Foundry is growing rapidly and a leading product that provides PaaS (Platform as a Service) capabilities to enterprise, government, and organizations around the globe. Giants like Dell Technologies, GE, IBM, HP and the US government are using Cloud Foundry innovate faster in a rapidly changing world.

Cloud Foundry is a developer’s dream. Enabling them to create modern applications that can leverage the latest thinking, techniques and capabilities of the cloud, including:

  • DevOps
  • Application Virtualization
  • Infrastructure agnosticism
  • Orchestrated containers
  • Automation
  • Zero downtime upgrades
  • A/B deployment
  • Quickly scaling applications out or in

This book takes readers on a journey where they will first learn the Cloud Foundry basics, including how to deploy and scale a simple application in seconds. Readers will build their knowledge of how to create highly scalable and resilient cloud-native applications and microservices running on Cloud Foundry. Readers will learn how to integrate their application with services provided by Cloud Foundry and with those external to Cloud Foundry. Readers will learn how to structure their Cloud Foundry environment with orgs and spaces. After that, we’ll discuss aspects of continuous integration/continuous delivery (CI/CD), monitoring and logging. Readers will also learn how to enable health checks, troubleshoot and debug applications.

By the end of this book, readers will have hands-on experience in performing various deployment and scaling tasks. Additionally, they will have an understanding of what it takes to migrate and develop applications for Cloud Foundry.

Style and Approach

A practitioner's guide to Cloud Foundry that covers the areas of application development, deployment and services.

Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

Table of Contents

  1. Preface
    1. What is book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer Support
      1. Downloading the example code
      2. Downloading the color images for this book
      3. Errata
      4. Piracy
      5. Questions
  2. Cloud Foundry Introduction
    1. Why Cloud Foundry?
    2. What is PaaS?
      1. The Cloud Foundry definition of PaaS
    3. Who are Pivotal and the Cloud Foundry Foundation?
    4. What is Cloud Foundry?
      1. Cloud Foundry architecture
      2. Cloud Foundry security
      3. Cloud Foundry containers
        1. What are containers?
    5. What is Pivotal Cloud Foundry?
      1. Pivotal Cloud Foundry components glossary
      2. Other Cloud Foundry distributions and public providers
    6. Summary
  3. Cloud Foundry CLI and Apps Manager
    1. The cf CLI
    2. What is Pivotal Web Services (PWS)?
    3. Creating a PWS account
      1. What you get when you register for PWS
      2. Signing up
    4. Installing the cf CLI
      1. Downloading and installing from GitHub
      2. Install using a package manager
    5. Initial setup of the cf CLI
    6. The cf CLI help command 
      1. Finding cf CLI commands
      2. Command-specific help
    7. Deploying an application to Cloud Foundry
      1. Targeting Pivotal cf API endpoint
      2. Logging into the Cloud Foundry API endpoint
      3. Pushing a simple application
    8. Accessing the Apps Manager on PWS
    9. Summary
  4. Getting Started with PCF Dev
    1. A brief introduction to TDD
    2. Why PCF Dev?
      1. Comparing PCF Dev to Pivotal Cloud Foundry
    3. PCF Dev technical requirements
    4. 20 minutes to cf push with PCF Dev
      1. Installing PCF Dev
      2. Exploring PCF Dev
      3. Deploying a test application to PCF Dev
        1. Clone and build the Spring Music App
      4. PCF Dev housekeeping
        1. Stop
        2. Suspend
        3. Resume
        4. Destroy
        5. Status
    5. Alternatives to PCF Dev
    6. Further reading
    7. Summary
  5. Users, Orgs, Spaces, and Roles
    1. Organizations (Orgs)
      1. Create an Org using Apps Manager
      2. Create an Organization (Org) using the cf CLI
      3. List Orgs using the cf CLI
    2. Spaces
      1. Creating a Space using the Apps Manager
      2. Creating a Space using cf CLI
      3. List spaces using the cf CLI
    3. User accounts
      1. Create a user using the cf CLI
    4. Roles
      1. OrgManager role
      2. BillingManager role
      3. OrgAuditor role
      4. SpaceManager role
      5. SpaceDeveloper role
      6. SpaceAuditor role
      7. Assigning roles to a user using cf CLI
    5. Summary
  6. Architecting and Building Apps for the Cloud
    1. What is a cloud-native application?
    2. The principles of cloud-native design
      1. One codebase, one application
      2. API First
      3. Dependency management
      4. Design, build, release, and run
      5. Configuration, credentials, and code
      6. Logs
      7. Disposability
      8. Backing services
      9. Environment parity
      10. Administrative processes
      11. Port binding
      12. Stateless processes
      13. Concurrency
      14. Telemetry
      15. Authentication and authorization
      16. Graceful fault tolerance
    3. Application migration and the journey to cloud-native design on Cloud Foundry
      1. Becoming Cloud Ready
    4. Modernizing the monolith
      1. Anti-corruption layer
      2. Strangling the monolith
    5. Application modernization and your organization
    6. References
    7. Summary
  7. Deploying Apps to Cloud Foundry
    1. Pushing your first application to Cloud Foundry
      1. What you need before you push
    2. Services
      1. Listing the available services to create
      2. Creating a service
    3. Buildpacks
    4. Deploying your first app onto cf using the cf CLI
      1. Applications versus application instances
      2. The phases of application deployment
        1. The Droplet
      3. Re-deploying the application
      4. Binding a service to the application
        1. Restaging applications versus restarting applications
      5. Manifest files
    5. Monitoring and managing the applications
      1. Monitoring and managing the application using cf CLI
        1. Monitoring your application
          1. Listing all of the applications in a space
          2. Getting the health and status of your application
          3. Viewing application logs
        2. Managing your application
          1. Scaling your application
          2. Application tasks
          3. Routes and domains
          4. Domains, HTTP domains, and TCP domains
          5. Viewing and managing HTTP shared domains
          6. Viewing and managing TCP shared domains
          7. Viewing and managing HTTP private domains
          8. Routes, HTTP routes, and TCP routes
          9. Creating HTTP routes
          10. Creating HTTP routes with the hostname option
          11. Creating HTTP Routes with a Wildcard hostname
          12. Creating HTTP context path routing
          13. Creating TCP routes
          14. Managing routes
          15. Deleting your application
      2. Monitoring and managing applications using Apps Manager
      3. Application Performance Monitoring (APM)
    6. Summary
  8. Microservices and Worker Applications
    1. What are microservices?
    2. Worker applications
      1. Fortune teller worker application
      2. Building and deploying the fortune teller application to PCF Dev
    3. Application resiliency
      1. Resiliency provided by Cloud Foundry
      2. Building resiliency into microservices
      3. Using the Config Server for managing application configuration
        1. Service Registry for application registration and discovery
      4. Circuit breakers and dashboard
    4. References
    5. Summary
  9. Services and Service Brokers
    1. Services on Cloud Foundry
    2. Service binding of applications
    3. User-provided services
    4. Service brokers
      1. Structure of services on a service broker
      2. The Open Service Broker API
        1. HTTP request and response structure
        2. Asynchronous and synchronous operations
        3. Authentication
      3. Custom service brokers on Cloud Foundry
        1. Deploying and registering custom service brokers on Cloud Foundry
        2. Updating custom service brokers
    5. Route services
      1. Enabling route services
      2. Service broker and service instance implementation requirements
      3. Route service deployment strategies
        1. Fully-brokered route service
        2. Static-brokered route service
        3. User-provided route service
      4. Route service example
    6. Service integration strategies
    7. Summary
  10. Buildpacks
    1. Buildpacks on Cloud Foundry
      1. Common buildpacks on Cloud Foundry
      2. Consuming and managing buildpacks on Cloud Foundry
        1. Offline versus online buildpacks
        2. Consuming external buildpacks on Cloud Foundry
        3. Adding a new buildpack to Cloud Foundry
        4. Updating a buildpack on Cloud Foundry
        5. Deleting a buildpack
        6. Existing cached droplets and maintaining installed buildpacks
    2. Deep-dive into buildpacks
      1. How buildpacks actually work with Cloud Foundry
        1. The detect script
        2. The compile script
        3. The release script
        4. The droplet
      2. Creating buildpacks
        1. Creating the Simple-HTTP buildpack
          1. Setting up Buildpack-packager
          2. Creating the buildpack
          3. Installing the buildpack 
          4. Test driving the Simple-Http buildpack 
    3. Summary
  11. Troubleshooting Applications in Cloud Foundry
    1. Failure due to Org/Space quota settings
      1. Failures due to application crashes
        1. Exited with status 0
        2. Exited with status 4 or status 64
        3. Exited with status 6 or 65
        4. Exited with status 255
        5. Exited with status X
    2. References
    3. Summary
  12. Continuous Integration and Continuous Deployment
    1. What is continuous integration?
    2. What is continuous delivery?
    3. What is continuous deployment?
      1. Zero downtime deployment
      2. A/B deployment
    4. References
    5. Summary