Workshop cheatsheets
Workshop #1 reference steps (20 mins):
- Login from CLI:
cf login -a api.run.pivotal.io
cd workshop-material/demo-apps/node
cf 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-music
indemo-apps
folder - 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.yml
with 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-start
to push your app (it will automatically findmanifest.yml
in your working directory and use it as configuration)cf logs articulate
to tail the logs of thearticulate
app- Open another terminal and run
cf start articulate
to 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 articulate
to 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
articulate
app log again:$ cf logs articulate | grep "API\|CELL"
grep
filters 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
articulate
back to original settings.$ cf scale articulate -m 512M
Workshop #3 main steps for Horizontally Scale (10 mins):
- Browse to the
Scale and HA
page of thearticulate
application. Review theApplication Environment Information
. - Press the
Refresh
button 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
articulate
in a web browser. Press theRefresh
button several times. Observe theAddresses
andInstance Index
changing.
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
articulate
in browser and navigate toScale and HA
page. Press theRefresh
button. Confirm the application is running. - Kill the app. Press the
Kill
button! cf app articulate
to check app state.Refresh
the page to see if app is back up.cf events articulate
to see which app instance was killed.cf scale articulate -i 1
to 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-service
in a browser.
Workshop #4 main steps for user provided service instance (10 mins):
articulate
's default configuration for theattendee-service
uri
is 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 uri
Note: 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
articulate
Blue-Green
page. And generate some requests by pressing theStart
button. Don't close this page yet. Observe our current version (v1) handle all web requests. - Run
cf routes
and take note of the currenthost
ofarticulate
. cf push articulate-v2 -p ./articulate-0.0.1-SNAPSHOT.jar -m 512M -n articulate-prodtest
cf bind-service articulate-v2 attendee-service
cf restart articulate-v2
- Open a new tab and view version 2 of
articulate
in 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-XXX
wherearticulate-XXX
is 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
Reset
button on the page, so we can see how the load get distributed across app instances. Runcf apps
to 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-route
If youReset
the 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
No comments:
Post a Comment