In this lab we will push an ASP.NET MVC web application to cloud foundry.
-
Open Visual Studio and create a new ASP.NET Web Application with the name MVCAttendees
-
Choose MVC as the Template
-
Change the Authentication to No Authentication
-
-
Run it locally to verify that the application works locally
-
Right click on the project name and select Publish…
-
Choose a Custom publish target.
-
Provide a name like Publish for PCF - Debug
-
Publish method: File System
-
Target location, e.g: ..\PCFDeploy (Remember this location to access it later from the command prompt)
-
Choose a configuration (Debug or Release)
-
(Optional) Change File Publish Options
-
Check Delete all existing files prior to publish
-
Check Precompile during publishing
-
-
-
Create a PCF Manifest file
-
Create a manfest.yml file in the Publish Target Location
-
Change the section <your initials> to use your own initials
-
---
applications:
- name: wsattendees
host: wsattendees-<your initials>
memory: 512m
stack: windows2012R2
buildpack: binary_buildpack
-
Open up a command prompt
-
Change to the folder containing the published code files and manifest.yml (Replace "[Publish-Target-Location-folder]" with the actual folder name:
> cd [Publish-Target-Location-folder]
-
Push the application!
> cf push
You should see output similar to the following listing. Take a look at the listing callouts for a play-by-play of what’s happening:
C:\...\MVCAttendees\PCFDeploy>cf push Using manifest file C:\Users\admin\Documents\Visual Studio 2015\Projects\MVCAttendees\PCFDeploy\manifest.yml Using stack windows2012R2... OK Updating app wsattendees in org instructor / space development as admin... OK Using route wsattendees-jga.cfapps.haas-76.pez.pivotal.io Uploading wsattendees... Uploading app files from: C:\Users\admin\Documents\Visual Studio 2015\Projects\MVCAttendees\PCFDeploy Uploading 940.5K, 62 files Done uploading OK Stopping app wsattendees in org instructor / space development as admin... OK Starting app wsattendees in org instructor / space development as admin... Downloading binary_buildpack... Downloaded binary_buildpack Creating container Successfully created container Downloading app package... Downloaded app package (7.8M) Downloading build artifacts cache... Downloaded build artifacts cache (148B) Staging... Uploading droplet... Exit status 0 Staging complete Uploading droplet, build artifacts cache... Uploading build artifacts cache... Uploaded build artifacts cache (169B) Uploaded droplet (7.7M) Uploading complete 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 starting 1 of 1 instances running App started OK App wsattendees was started using this command `..\tmp\lifecycle\WebAppServer.exe` Showing health and status for app wsattendees in org instructor / space development as admin... OK requested state: started instances: 1/1 usage: 512M x 1 instances urls: wsattendees-jga.cfapps.haas-76.pez.pivotal.io last uploaded: Mon Oct 17 03:35:28 UTC 2016 stack: windows2012R2 buildpack: binary_buildpack state since cpu memory disk details #0 running 2016-10-16 11:36:33 PM 0.0% 292M of 512M 25.3M of 1G
-
Visit the application in your browser by hitting the route that was generated by the CLI:
-
Get information about the currently deployed application using CLI apps command:
> cf apps
Note the application name for next steps
-
Get information about running instances, memory, CPU, and other statistics using CLI instances command
> cf app wsattendees
-
Stop the deployed application using the CLI
> cf stop wsattendees
-
Delete the deployed application using the CLI
> cf delete wsattendees