Deploy an application on AppFog using Cloudfoundry vmc tool or Maven plugin

AppFog is a simple Cloud Platform for web applications. It's built on Cloud Foundry, the Open Platform as a Service Project. Like the Cloud Foundry command-line interface (known as 'vmc'), AppFog offers a CLI tool, 'af' based on CloudFoundry's 'vmc' but includes features specific to AppFog and has the default target set to AppFog's service.

But if you want to use 'vmc' with the AppFog Service or the Cloudfoundry Maven plugin, you will be rejected when creating your application with something like: Error 701: The URIs: "your app name".appfog.com have already been taken or reserved.

This is because AppFog need to know your choosen underlying infrastructure in this list:

-AWS US East - Virginia
-AWS EU West - Ireland
-AWS Asia SE - Singapore
-Rackspace AZ 1 - Dallas
-HP AZ 2 - Las Vegas
-MS Azure AZ 1 - San Antonio

This can be done with the --infra parameters, but this is only available for the 'af' CLI tool, not for 'vmc'.

Then, instead of specify your application deployed url with .appfog.com as target base, you have to choose the right target base for your infrastructure:

-AWS US East - Virginia -> .aws.af.cm
-AWS EU West - Ireland -> .eu01.aws.af.cm
-AWS Asia SE - Singapore -> .ap01.aws.af.cm
-Rackspace AZ 1 - Dallas -> .rs.af.cm
-HP AZ 2 - Las Vegas -> .hp.af.cm

You will get for instance for AWS US East in the command line style:

vincentdevillers@alienware: vmc push

Would you like to deploy from the current directory?

Application Name: my-little-blog 
Detected a Standalone Application, is this correct? [Yn]: 
1: java
2: node04
3: node06
4: node08
5: php
6: python2
7: ruby18
8: ruby192
9: ruby193
Select Runtime [java]: 
Selected java
Start Command: bin/start.sh 
Application Deployed URL [None]: my-little-blog.eu01.aws.af.cm
Memory reservation (128M, 256M, 512M, 1G, 2G) [512M]: 2G
How many instances? [1]: 
Create services to bind to 'my-little-blog'? [yN]: 
Would you like to save this configuration? [yN]: 
Creating Application: OK
Uploading Application:
  Checking for available resources: OK
  Processing resources: OK
  Packing application: OK
  Uploading (11M): OK 
Push Status: OK
Staging Application 'my-little-blog': OK                                   
Starting Application 'my-little-blog': OK 


And for your Maven plugin, you will have for instance, for AWS US East again:


<plugin>
    <groupId>org.cloudfoundry</groupId>
    <artifactId>cf-maven-plugin</artifactId>
    <version>1.0.0.M4</version>
    <configuration>
        <server>mycloudfoundry-instance</server>
        <target>https://api.appfog.com</target>
        <url>hello-java-maven.aws.af.cm</url>
        <memory>256</memory>
    </configuration>
</plugin>

That's all!

More infos here:
- https://github.com/cloudfoundry/vcap-java-client/tree/master/cloudfoundry-maven-plugin
- blog.appfog.com/how-to-use-appfogs-multi-infrastructure-architecture-in-the-command-line/
https://www.appfog.com/

Labels: , , ,