![]()
Heroku Cloud Application Development
Table of Contents
Heroku Cloud Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers and more
Why Subscribe?
Free Access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Errata
Piracy
Questions
1. Hello Heroku
What is cloud computing?
Cloud service models
What is cloud application development?
Key advantages of cloud application development
Introducing Heroku
Walking down the memory lane
An overview of Heroku's architecture
Process management
Logging
HTTP routing
Heroku interfaces
The Heroku feature set
Let's play Heroku
Getting ready for the ride – the prerequisites
Signing up
Installing the Heroku toolbelt
Logging in and generating a new SSH key
Test driving Heroku
Summary
2. Inside Heroku
The Heroku platform stack
The Celadon Cedar stack
Request routing in Heroku
The execution environment - dynos and the dyno manifold
Heroku's logging infrastructure – the Logplex system
The Heroku add-on architecture
Programmatically consuming Heroku services
The Heroku Platform API
Security
Schema
Data
Accessing the API
API clients
Calling the API
Response
Limits on API calls
The Heroku process architecture
Procfile
Declaring process types
The Procfile format
A sample Procfile
Adding Procfile to Heroku
Running applications locally
Setting local environment variables
Process formation
Process scaling
Stopping a process type
Checking on your processes
Process logs
Running a one-off process
Running anything
Summary
3. Building Heroku Applications
Heroku's guiding influence – the Twelve-Factor App methodology
A codebase is always versioned and it can have multiple deploys
Declare and isolate dependencies explicitly (always)
Configuration should be stored in the environment
Backend services should be treated as attached (loosely-coupled) resources
Strict separation of the build, release, and run stages of an app
An app in execution is a process or many processes
Services should be exported through port binding
An app should scale out through its process model
Faster startup and graceful shutdown is the way to app agility and scalability
Development and production (and everything in between) should be as similar as possible
The app should just log the event not manage it
App's administrative or management task should be run as a one-off process
Creating a Heroku application
Configuring your Heroku application
The Heroku application configuration API
Examples of using application configuration
The persistence of configuration variables
Accessing configuration variables at runtime
Limits on configuration data
Using the Heroku config plugin
Introducing buildpacks
Using a custom buildpack
Specifying a custom buildpack at the app creation stage
Third-party buildpacks
The buildpack API
Components of a buildpack API
The bin/detect script
The bin/compile script
The bin/release script
Writing a buildpack
The slug compiler
Optimizing the slug
Size limits
Summary
4. Deploying Heroku Applications
Deployment on Heroku
Getting a Heroku account
Installing the toolbelt client kit
Logging into the Heroku account
Setting up SSH
Writing your application
Pushing your application to Heroku
The Git vocabulary
Getting started with Git
Tracking a new project
Using an existing Git project
The life cycle of an artifact in Git
Tracking files in a Git project
When you don't need Git to track your files
The git diff command – knowing what changed
Committing your changes
Deleting a file
Moving a file
Viewing commit history
Undoing a change
You can use some Git help
The local repository
Remote repositories
Creating a Heroku remote
Renaming an application
Sending code to Heroku
Optimizing slug size
Cloning existing Heroku applications
Forking an application
Side effects of forking an application
Transferring Apps
Optimizing deployments
The choice of a region
Tracking application changes
Setting up Deploy Hooks
Basecamp
Campfire
E-mail
HTTP
IRC
Release management
Checking installed releases
Verifying the new release
Rolling back the release
Summary
5. Running Heroku Applications
The Heroku app lifecycle
The Heroku CLI
How to get the Heroku client tool
Verifying the tool
How to get the latest Heroku client tool
Where is the Heroku client stored?
What if my client installation is corrupted or not working?
The Heroku CLI commands
Heroku CLI commands by function
Extending the Heroku CLI
The Heroku CLI and add-ons
A note on Heroku CLI and security
Running your cloud apps locally
Using Foreman to check Procfiles
Using Foreman to run apps directly
Running one-off commands
Foreman command-line options
The Apps page
The Resources tab
Managing resources
The Activity tab
The Access tab
The Settings tab
The Run Production Check tab
Heroku support
Summary
6. Putting It All Together
Heroku's support for Java
General support for Java
Database support for Java apps
Environment configuration
Integrating Eclipse with Heroku
Prerequisites
Configuring Heroku in Eclipse
Installing the Eclipse plugin for Heroku
Setting up Heroku for development
Setting up SSH support
Creating a new Heroku Java app in Eclipse
Using an existing Heroku appli...