+

Search Tips  |   Advanced Search

Cloud Foundry Public

Getting started with Cloud Foundry Public


Before you begin

Review the IBM Cloud Foundry terms and conditions.


Developing your app

There are three ways to develop your app:


Developing and deploying your apps by using toolchains and the Continuous Delivery service

Add a toolchain that includes the IBM Cloud Continuous Delivery service to your app. Then, use the toolchain to develop and deploy your app.

Try the Develop a Cloud Foundry app tutorial to learn about using toolchains to modify and continuously deliver a simple "Hello World" sample Cloud Foundry app.


Creating your web app with the IBM Cloud console

After signing up, start to build your first app by using the IBM Cloud catalog and console.

In IBM Cloud apps are associated with IBM Cloud organizations and spaces. An organization is owned and used by multiple collaborators. Initially, you get a default organization that is named after your user name and you are the only collaborator. You also get a space within this organization. The space is an environment to run your apps; for example, you can have a dev space as a development environment, a test space as a test environment, and a production space as a production environment. Each of the environments belong to a region. With IBM Cloud, you can deploy your apps to a specific geographical region for lower network latency, data privacy, and better availability.

For this scenario, you want to develop a web app by using Node.js. Assume that you are in the US and most of your app users are also in the US. For lower network latency you decide to build and run your app close to your user base. After logging in to IBM Cloud, click the user account preferences link and select the US South region. Then, you can take the following steps to create an app:

  1. Click Catalog in the IBM Cloud toolbar.
  2. Click Cloud Foundry Apps and choose the Cloud Foundry tile.
  3. Click Public Applications to select Region and Runtime.
  4. Type a unique name for your app and click Create. The app name must be unique in the whole IBM Cloud environment.

Once created, a Getting started page is added to the left navigation pane. Follow the instructions in that page to download the starter code of your app, modify, and deploy it.

The app is created with one instance and 512 MB memory quota by default. We can increase the memory, or add more instances to get high availability of your app, for example, three instances with 1 GB memory per instance. Click Overview to specify your app instances and memory quota. For example, type 3 for instances and 1 GB for memory quota, and click Save. We can also see the files, logs, and environment variables to troubleshoot your problems.


Binding a service by using IBM Cloud console

After creating your app, connect to a database with your app. We can store and retrieve the app data by using a database query language. In this scenario, you decide to use the IBM Cloudant service that is provided by IBM Cloud.

To use IBM Cloud with your Cloud Foundry app, create a service instance and bind your app to the service instance:

  1. In the IBM Cloud catalog, select the IBM Cloudant service. Add a unique name for your IBM Cloudant service and click Create. In the Cloudant Manage panel, launch the service by clicking Launch.
  2. Click Connections. Then, click Create connection.
  3. Click Connect next to your app.
  4. The Restage App window is displayed. Click Restage.

Now your app is bound to the IBM Cloudant service. The environment variable contains the data that is required for the app to communicate with the service instance. Because IBM Cloud hosts several apps on the same virtual machine, multiple apps cannot use the same HTTP port number to receive incoming requests. To avoid conflicts, each app is given a unique port number. This port number is available in the variable.

Follow these steps to see the list of values associated with your app in the console.

  1. Click the menu in the IBM Cloud toolbar.
  2. Click Dashboard.
  3. Click your app.
  4. Click Runtimes and select the Environment Variables tab.

This environment variable is the serialization of a JSON object with one entry for each service instance that the app is bound to. The amount and type of data that each service instance provides are service-specific. When your app does not use a service, is an empty JSON object. This environment variable is used only when you add a service to your app.


Building your app by using the Cloud Foundry CLI

IBM Cloud provides several tools for you to start coding your app, for example, the ibmcloud cf command line interface and Eclipse tools. In this example you will use the ibmcloud cf command line interface to start coding your app.

    ibmcloud cf

We can also choose other tools to build your app, such as Eclipse tools. See the Getting started page of your app in the IBM Cloud console.


Binding a service by using the ibmcloud cf cli

We can also bind a service by using the ibmcloud cf command line interface. This example assumes that you want to add the IBM Cloudant service to your app with the ibmcloud cf command line interface.

To use the IBM Cloudant service within your app, create an IBM Cloudant service instance, bind your app to the service instance, and then use the service instance. The same procedure applies to all the other services.

    ibmcloud cf create-service


Calculating your app cost

If your 30-day free trial has expired, and you want to continue to use IBM Cloud, you must add your credit card information for a Pay As You Go account or a Subscription account. However, IBM Cloud still provides free allowances for the community runtime frameworks (Python, PHP, Go, Ruby, Tomcat) and services even after you convert to a pay account. You are not charged by IBM Cloud unless the usage is beyond the free allowances.

IBM Cloud provides an estimator and calculator for you to see your app cost. We can see the cost of your app in the following ways:

We can also calculate your app cost manually by adding up the prices of your runtimes and services and deducting the free allowance. See Calculating your costs manually.


Removing apps

As you build more apps, the quota might approach your limits. However, some apps that you might no longer use still occupy the quota. It's easy to delete apps to free up some spaces in IBM Cloud at any time.

In the IBM Cloud console, go to the app Overview page, click the menu icon, and delete the app that you no longer use. We can also use the ibmcloud cf delete command to delete apps.