Creating and Deploying a Simple Web App to Cloud Foundry
To create and deploy a simple web application, you can clone a copy of the Predix Hello World web application and deploy it to Cloud Foundry.
Procedure
- Use the Cloud Foundry CLI to log into Cloud Foundry.
cf login -a <API_Endpoint>
Note: If you are a GE employee, you must use thecf login --sso
command to log into Cloud Foundry. After you enter your SSO, you will receive a one-time passcode URL. Copy this URL and paste it in a browser to retrieve your one-time passcode. Use this code with thecf
command to complete the CF login process.Depending on your Predix.io registration, the value of
<API_Endpoint>
is one of the following:- Predix US-West
https://api.system.aws-usw02-pr.ice.predix.io
- Predix Europe
https://api.system.aws-eu-central-1-pr.ice.predix.io
For example,
cf login -a https://api.system.aws-usw02-pr.ice.predix.io
- Predix US-West
- Clone a copy of the Predix Hello World web app to create a Predix Hello World project. At the command prompt, enter:
git clone https://github.com/PredixDev/Predix-HelloWorld-WebApp
The command produces the following output:Cloning into 'Predix-HelloWorld-WebApp'... remote: Counting objects: 7, done. remote: Compressing objects: 100% (5/5), done. remote: Total 7 (delta 0), reused 7 (delta 0), pack-reused 0 Unpacking objects: 100% (7/7), done. Checking connectivity... done.
- Edit the manifest.yml file in the Predix-HelloWorld-WebApp directory to update the name of the web app to Predix-HelloWorld-WebApp-<YourAppName>. For example:
# applications: - name: Predix-HelloWorld-WebApp-<YourAppName> buildpack: predix_openresty_buildpack #path: dist memory: 64M stack: cflinuxfs2
- Make sure that you are in the
Predix-HelloWorld-WebApp
directory. From the directory, push your Predix web application to Cloud Foundry. At the command prompt, enter:cf push
- See your web app listed in your Cloud Foundry space:
cf apps
- Enter your web app URL in a browser, including your app name, using HTTPS. For example:
https://Predix-HelloWorld-WebApp-<YourAppName>.run.aws-usw02-pr.ice.predix.io
Your Predix Hello World web app displays in the web browser.