Git Product home page Git Product logo

cf-dotnetcontoso's Introduction

cf-DotNetContoso


There are two versions of the app in this repo: V1 has a gray background on the home page, and V2 has a green background: this is to show a 'blue green' deployment scenario

You need to create two "user provided services" in PCF. The first is a connection to an SQL server:

cf cups contoso-demo-sql -p 'connectionString'

the system will then prompt you for the connection string to the SQL database by showing connectionString:, and you can enter your SQL Server connection string (the SQL Server database can be hosted anywhere, e.g. on Azure). Replace the following parameters with the appropriate values: YOUR_IP, YOUR_USERID, YOUR_PASSWORD, YOUR_DATABASE

Data Source=YOUR_IP;Integrated Security=False;User ID=YOUR_USERID;Password=YOUR_PASSWORD;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False;Initial Catalog=YOUR_DATABASE

The second service is to an Azure Service Bus queue:

cf cups contoso-demo-queue -p 'queueConnectionString'

the command line will then prompt you for the queue connection string with the prompt queueConnectionString:, and you can enter the information as follows. Replace the following parameters with the appropriate values: YOUR_QUEUE_HOST, YOUR_QUEUE_NAME, YOUR_QUEUE_KEY

Endpoint=sb://YOUR_QUEUE_HOST;SharedAccessKeyName=YOUR_QUEUE_NAME;SharedAccessKey=YOUR_QUEUE_KEY

When creating the above services, please be sure to use only the variable names connectionString and queueConnectionString since the apps look for these strings when parsing the VCAP_SERVICES environment variable.

The code is provided pre-built so you can push without compiling the code.

There are batch files in each project folder (demo1.bat in contoso-university-V1 and demo2.bat in contoso-university-V2) that will issue the right push command and bind the right services.

Please see the supporting java app available here that pumps messages into the Azure Service Bus: please note that the contoso-demo-queue service must be provided to this app before it can function correctly.

Usage

The https://app.domain.com/Messages link in the app will give a list of messages from the queue

There are two actions on the top of the Messages page only in the V1 app version : Kill Instance and Expensive Task

The Kill Instance link will kill an instance; this can be used to show auto-recovery

The Expensive Task link will make the system undergo an expensive process, and the following endpoint can be hit with something like JMeter to stress the system and trigger and autoscaling operation: https://app.domain.com/Message/PerformExpensiveTask

Also, the bottom of each page contains an IP address and a random number uniquely assigned to each instance, so you can show load balancing with multiple instances, as the random number will change with each refresh to one of the n assigned numbers corresponding to each of the n instances of the app.

Cloud Foundry

Use the following commands to deploy to Pivotal Cloud Foundry after you have created the User Provided Servies in the earlier steps.

Step 1: Edit the file contoso-university-v1/demo.bat and replace YOUR_DOMAIN with the domain in use by application in your instance of Cloud Foundry.

Step 2a: On Linux:

cd contoso-university-v1
bash demo1.bat

cd ../contoso-university-v2
bash demo2.bat

Step 2b: On Windows:

cd contoso-university-v1
demo1.bat

cd ../contoso-university-v2
demo2.bat

cf-dotnetcontoso's People

Contributors

kyletravis avatar saurabhguptasg avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.