Skip to content

Latest commit

 

History

History
154 lines (128 loc) · 4.04 KB

File metadata and controls

154 lines (128 loc) · 4.04 KB

Lab 5 - Deploying an ASP.NET MVC Application

In this lab we will push an ASP.NET MVC web application to cloud foundry.

Create a New ASP.NET Web Application

  1. Open Visual Studio and create a new ASP.NET Web Application with the name MVCAttendees

    1. Choose MVC as the Template

    2. Change the Authentication to No Authentication

  2. Run it locally to verify that the application works locally

Publish the Application

  1. Right click on the project name and select Publish…​

  2. Choose a Custom publish target.

    1. Provide a name like Publish for PCF - Debug

    2. Publish method: File System

    3. Target location, e.g: ..\PCFDeploy (Remember this location to access it later from the command prompt)

    4. Choose a configuration (Debug or Release)

    5. (Optional) Change File Publish Options

      1. Check Delete all existing files prior to publish

      2. Check Precompile during publishing

  3. Create a PCF Manifest file

    1. Create a manfest.yml file in the Publish Target Location

    2. Change the section <your initials> to use your own initials

---
applications:
- name: wsattendees
  host: wsattendees-<your initials>
  memory: 512m
  stack: windows2012R2
  buildpack: binary_buildpack

Push It!

  1. Open up a command prompt

  2. 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]
  3. 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
  4. Visit the application in your browser by hitting the route that was generated by the CLI:

    lab mvcattendeesrunning

Interact with App from CF CLI

  1. Get information about the currently deployed application using CLI apps command:

    > cf apps

    Note the application name for next steps

  2. Get information about running instances, memory, CPU, and other statistics using CLI instances command

    > cf app wsattendees
  3. Stop the deployed application using the CLI

    > cf stop wsattendees
  4. Delete the deployed application using the CLI

    > cf delete wsattendees