Running a Java Stack App on Cloud Foundry
NOTE: This page remains current for Java Stack 3 projects only; Stack 4 projects should refer to Integration Point.
Deploying via mvn alm-promote
Gather and Setup info you will need before running stack starter
- Login to http://cf.lds.org with your LDS Account credentials and click on the application management box on the home page
- At the top left section of the page lists your Portfolio and Solution Spaces. Write down or remember your portfolio and a space. Case sensitivity matters. A “Demo” Portfolio has been setup to use for trying out Cloud Foundry. If you don't have a space, ask your portfolio manager to create one for you.
- Your Solution Space should be the name of your application you are wanting to create with an environment suffix. If my project was called “sample-cloud-app” in Stack Starter, I need to have a “sample-cloud-app-dev”, “sample-cloud-app-test” and so on solution space in Cloud Foundry.
- If you will be wanting to use Oracle with your application you need to setup an “oracle-db” service for your app's solutions space. You can do this from the Application Marketplace on http://cf.lds.org. Select the Oracle Services and the select your Portfolio and Solution to create your oracle-db service. You will need to have the developer role in Cloud Foundry or you won't have authorization to create services.
- You may need to also create an “lds-account” or “wam” service if you choose those options for your application in Stack Starter. This can be done in the Application Marketplace as well.
Run stack starter
- Run the latest stack starter from here: http://code.lds.org/maven-sites/stack/module.html?module=starter-download
- Select web application, enter appropriate project names and locations and click next. Note the “Portolio Name” select box. This refers to your cloud Portfolio Space (gathered earlier from http://cf.lds.org). You can use the “Demo” portfolio as a sample portfolio sandbox. The name of your application followed by the environment will be used as the Solution Space (see above).
- You'll notice Cloud Foundry is selected as the default deployment option.
- Select any other options you want for your project (assuming you have appropriate services defined in cloud foundry for oracle and lds-account, etc.) and click “Next” and ultimately “Finish” to create your project. If you want to test your app from Stack Starter click the “Test Build” button before closing and it will attempt to install and run your application in Cloud Foundry.
Deploy your app to the ICS Cloud Foundry
- Open a terminal or command prompt and navigate to the root of your new project.
- Run a “mvn install” on your project
- cd into the alm sub-module or folder of your project
- Run “mvn alm-promote -P dev -Dcf.username=<ldsUser> -Dcf.password=<ldsPass>” (Note: you can set the credentials in the settings.xml or use the LDS cf gem to perform a login to cloud foundry if you don't want to set the credentials on the command line)
Test your app
- If everything went correctly you can access your app at http://<project-name>.app-dev.lds.org
- You can also check the status of your application at http://cf.lds.org
- Most issues will be related to your portfolio and solution space being incorrect or not setup correctly. Double check those values. Also verify that your lds account credentials get set correctly when runing mvn alm-promote.
- Your app may need to bind to a cloud foundry service to run correctly. For example if you are using an Oracle datasource in your application you will need to bind your application to a correctly set “oracle-db” service that has been setup to point to your oracle instance with appropriate credentials. See cloud foundry documentation for more info on this.