Cloud Foundry has a Container-based architecture, open source cloud application platform. It provides the cloud instances and mainly used to deploy the Application directly into cloud environment. Instead of running the app separately, using the CF CLI(Command Line Interface) tool to deploy , test, configure and manage the apps on CF.
Features of Cloud Foundry:
- An open source Cloud Native Platform
- Fast and easy to build, test, deploy ,manage& scale apps
- Works with any language or framework
- Highly adaptable
- Can able to see running status of apps
- Can scale up or down, debug apps on CF
How to interact with CF?
- Command Line Interface (CLI): from terminal / command prompt
- IDE plugins
Org and App Space Roles:
CF uses role-based access control, with each role granting permissions in either an organization or an application space.
- An Organisation or org represents an organisational account and groups together users, resources, applications, and environments.
- Each organisation has a resource quota and it shares the same resource and domain.
- Organisations segregate tenants in a Cloud Foundry installation.
To List all orgs that the user has access to the below command can be given in the terminal.
- An organisation have separate spaces for development, staging and production versions of the apps.
- A space can also have its own quota.
- It has the shared location for developing and running apps
- Every application and service is scoped to a space
To List all spaces in the current org
Relationship between org, space and Apps:
Before pushing the app into Cloud Foundry, Ensure that:
- Log into cloud foundary using cf login command
- cf login -a API-URL
- It will prompt for username and password, then give the correct credentials
- Select the org and space where the app gets push.
- Then push the application using cf push
How to deploy an app into cf?
To deploy an application, need to push its code to the Cloud Foundry instance. The push command is used to push the application on cloud foundary. The arguments may be vary depends on application types. However, it is the best practice to specify all the arguments in a system file called manifest.yml
It provides consistency and reproducibility.An app can specify its service instance dependencies in the manifest.yml file. It will automatically bind to the service instances.
- # Start a new app called “myapp”
- # If there’s a manifest.yml in the current folder,
- # the config will be read from there
- cf push
Manifests has written in YAML. The below manifest illustrates some YAML conventions, as follows:
- The manifest file begins with three dashes.
- The applications block begins with a heading followed by a colon.
- The app name is preceded by a single dash and one space.
- Subsequent lines in the block are indented two spaces to align with name
– name: my-app
- A Cloud Foundry component that resolves app’s runtime dependencies
- It provides framework and run time support for applications.
- It is used to determine what dependencies to download
- It is used to tell how to configure applications to communicate with different services.
- It is used to compile or prepare the application for launch.
What happens when push an app using cf push?
- Upload: App files sent to CF
- Staging:Executable artifact is created (droplet)
- Running:App starts on an app host
App receives web requests (if it binds to TCP port)