Cloud Foundry is a cloud computing Platform-as-a-Service (PaaS) that allows quick development and deployment of web applications. One of its many benefits is that it's open source, which means that applications can be easily deployed to different Cloud Foundry providers.
Migrating Your Cloud Foundry App to CenturyLink AppFog
This tutorial is for Cloud Foundry users who already have applications deployed to another Cloud Foundry provider. We will walk through the simple steps needed to migrate your application to AppFog.
The Cloud Foundry CLI
This tutorial assumes that you are using Version 6 of the Cloud Foundry Command-Line Interface (CLI). You can get instructions for installing the CLI on the project homepage.
The CLI keeps its configuration in the
$HOME/.cf directory. Before running any of the commands we give you, make a backup using the following commands:
$ cd $HOME $ mv .cf .cf-backup
Later on, we'll show you how to switch between multiple configurations from the command line.
Getting a CenturyLink Cloud Account
The first step in migrating your application to AppFog is to sign up for a free CenturyLink Cloud trial account.
- Go to CenturyLink Cloud.
- Click Start Free Trial.
- Follow the on-screen instructions.
Deploying Your Application to AppFog
The next step is to configure AppFog in your CenturyLink Cloud account. You can read more about AppFog basics in the Getting Started Guide.
First, enable AppFog in the CenturyLink Cloud Control Panel.
- Go to Control Portal and log in.
- Select AppFog from the pull-down menu.
- Select the region that will host your AppFog instances.
Login to AppFog using the Cloud Foundry Tools
Now that AppFog is set up in your CenturyLink Cloud account, you need to login to AppFog using the Cloud Foundry CLI. The Control Panel gives you an exact command from the Overview tab.
- Find the cf login command on the AppFog control panel. It looks similar to the following:
cf login -a https://api.useast.appfog.ctl.io -o C007 -u your.username
- Run the command in your project directory.
- Enter your CenturyLink Cloud password when prompted.
- Select the Dev application space.
To learn more about logging into AppFog using the Cloud Foundry command-line tools, read this article from our Knowledge Base.
Deploy Your Application
After the initial configuration and login, deployment is just one command.
Run the following command in your project directory, replacing
<my-project-name> with the name of your project.
$ cf push <my-project-name>
A successful deployment produces a lot of output and looks similar to the following when completed:
You can limit the resources allocated to your application by passing options to the
cf push command. For instance, to allocate only 256 MB of memory and 512 MB of disk space, use the following command.
$ cf push -m 256M -k 512M <my-project-name>
Using Multiple Cloud Foundry Configurations
The Cloud Foundry CLI tool can access different configurations. It reads the
CF_HOME environment variable to determine which directory to search for login credentials and other configuration options. For example, to get a list of applications running in your previous configuration, run the following command.
$ CF_HOME=$HOME/.cf-backup cf apps
Running on AppFog
Once your application has been successfully migrated, it's time to examine which other cloud services your application might need. One of the benefits of AppFog is that it is part of the CenturyLink Cloud family of products. We offer a comprehensive suite of cloud products, from virtual cloud servers to managed enterprise applications. Check out the CenturyLink Cloud Home Page for a complete list of our cloud products and services.