Cloud Foundry Workshop cheatsheets
Workshop cheatsheets
Workshop #1 reference steps (20 mins):
- Login from CLI:
cf login -a api.run.pivotal.io cd workshop-material/demo-apps/nodecf push node-sample-app --random-route -m 128M- open the app's URL in browser and see if it works
- repeat the same steps for
python/spring-musicindemo-appsfolder - Don't forget to delete the apps when you're done to reduce cost
Workshop #2 reference steps (10 mins):
cd workshop-material/demo-apps/articulate- Write a manifest file
manifest.ymlwith the following content, be aware that indention matters with YAML syntax :---
applications:
- name: articulate
memory: 512M
random-route: true
path: ./articulate-0.0.1-SNAPSHOT.jar cf push --no-startto push your app (it will automatically findmanifest.ymlin your working directory and use it as configuration)cf logs articulateto tail the logs of thearticulateapp- Open another terminal and run
cf start articulateto start the app.
Workshop #2 main steps (cont.) (5 mins):
- Open your browser and view the application. Observe the log output, then refresh the page and you can see more logs are added.
- Stop tailing logs by pressing
Control+C - Run
cf events articulateto see CF events for audit purposes. - Don't delete the app yet as we need it for next workshop.
Workshop #3 main steps for Vertically Scale (10 mins):
- Start tailing the
articulateapp log again:$ cf logs articulate | grep "API\|CELL"
grepfilters log lines from the Cloud Controller and Cell components. - Vertically scale the app (scale up): Open another terminal and run:
cf scale articulate -m 1G
- Observe log output.
- Scale
articulateback to original settings.$ cf scale articulate -m 512M
Workshop #3 main steps for Horizontally Scale (10 mins):
- Browse to the
Scale and HApage of thearticulateapplication. Review theApplication Environment Information. - Press the
Refreshbutton multiple times. All requests are going to one application instance. - Start tailing the logs:
$ cf logs articulate | grep 'API\|CELL'
- Open another terminal and scale the application to 3 instances:
cf scale articulate -i 3
- Observe log output. Then stop tailing the logs.
- Return to
articulatein a web browser. Press theRefreshbutton several times. Observe theAddressesandInstance Indexchanging.
Workshop #3 main steps for HA (5 mins):
- At this time you should be running multiple instances of
articulate. Confirm this with the following command:$ cf app articulate - Return to
articulatein browser and navigate toScale and HApage. Press theRefreshbutton. Confirm the application is running. - Kill the app. Press the
Killbutton! cf app articulateto check app state.Refreshthe page to see if app is back up.cf events articulateto see which app instance was killed.cf scale articulate -i 1to scale app back to original settings.
Workshop #4 main steps for managed service (15 mins):
$ cd workshop-material/demo-apps/attendee-service
$ cf push attendee-service -p ./attendee-service-0.0.1-SNAPSHOT.jar -m 512M --random-route$ cf marketplace
$ cf create-service cleardb spark attendee-mysql
$ cf bind-service attendee-service attendee-mysql
$ cf restart attendee-service- View the
attendee-servicein a browser.
Workshop #4 main steps for user provided service instance (10 mins):
articulate's default configuration for theattendee-serviceuriis http://localhost:8181/attendees. The subsequent steps will allow you to override the default configuration with your own.cf create-user-provided-service attendee-service -p uriNote: The CLI will ask you interactively for "uri" parameter, you should answer like "https://attendee-service-XXX-XXX.cfapps.io/attendees"- Execute the following commands:
$ cf bind-service articulate attendee-service
$ cf restart articulate
$ cf env articulate # To review the environment - Navigate to
articulate's "Services" page and try to add some attendees.
Workshop #5 main steps (20 mins):
- Browse to the
articulateBlue-Greenpage. And generate some requests by pressing theStartbutton. Don't close this page yet. Observe our current version (v1) handle all web requests. - Run
cf routesand take note of the currenthostofarticulate. cf push articulate-v2 -p ./articulate-0.0.1-SNAPSHOT.jar -m 512M -n articulate-prodtestcf bind-service articulate-v2 attendee-servicecf restart articulate-v2- Open a new tab and view version 2 of
articulatein your browser. Take note of the application name. You can do further testing on this environment.
Workshop #5 main steps (cont.):
- When we're ready to release this version, run
$ cf map-route articulate-v2 cfapps.io -n articulate-XXXwherearticulate-XXXis version 1's hostname. - Return to the original browser tab of Blue-Green` page where you're generating requests. You should see that it is starting to send requests to version 2.
- Press the
Resetbutton on the page, so we can see how the load get distributed across app instances. Runcf appsto see how many instances of each app version.
Workshop #5 main steps (cont.):
- Move more traffic to version 2.
$ cf scale articulate -i 1
$ cf scale articulate-v2 -i 2 - Move all traffic to version 2 by running
$ cf unmap-route articulate cfapps.io -n articulate-version1-routeIf youResetthe requests generator, you will see all the traffic goes toarticulate-v2. - Remove the temp route from the articulate-v2 application:
$ cf unmap-route articulate-v2 cfapps.io -n articulate-prodtest - Clean up:
$ cf delete articulate
$ cf rename articulate-v2 articulate
$ cf restart articulate
$ cf scale articulate -i 1
Comments
Post a Comment