Monday, March 20, 2017

Cloud Foundry @ PIVOTAL WEB SERVICES

Cloud Foundry Providers :
•• Cloud Foundry Foundationhttp://cloudfoundry.org/
•• ActiveState Stackatohttp://www.activestate.com/stackato
FF Free for production use up to 20GB RAM
•• AppFoghttp://appfog.com/
FF 30-day free trial (up to 2GB RAM)
•• IBM Bluemixhttp://www.ibm.com/software/bluemix/
FF 30-day free trial (up to 2GB RAM)
•• Pivotal Cloud Foundryhttp://pivotal.io/platform-as-aservice/pivotal-cloud-foundry
FF 90 day evaluation term, non-production use, up to 50 app instances
•• Pivotal Web Serviceshttps://run.pivotal.io/
FF 60-day free trial (up to 2GB RAM)

Create a account @ Pivotal Web Services (PWS): http://run.pivotal.io/

Deploy the Sample App:
  1. Download the app with git:
    git clone https://github.com/cloudfoundry-samples/cf-sample-app-spring.git
  2. Navigate to the app directory: cd cf-sample-app-spring
  3. Sign in to PWS: cf login -a https://api.run.pivotal.io
  4. Push the app to PWS: cf push my_app
View the Logs:
  1. View a snapshot of recent logs: cf logs cf-spring --recent 
  2. Stream live logs: cf logs cf-spring 
Adding a Service/Connect a Database:
  1. List the available ElephantSQL plans: cf marketplace -s elephantsql
  2. Create a service instance with the free plan: cf create-service elephantsql turtle cf-spring-db
  3. Bind the newly created service to the app: cf bind-service cf-spring cf-spring-db
    NotE:
    Once a service is bound to an app, environment variables are stored that allow the app to connect to the service after a push, restage, or restart command.
  4. Restart the app: cf restart cf-spring
  5. Verify the new service is bound to the app: cf services 
Create/Delete user-provided service:
  1. Create Eureka Server as eureka-service :
    cf cups eureka-service -p '{"uri":"https://eureka007.cfapps.io/"}'
  2. Delete eureka-service :
    cf delete-service eureka-service
 Scale the App:
  1. Increase the number of app instances to two: cf scale cf-spring -i 2
  2. Check the status of the app and verify there are two instances running: cf app cf-spring
    NotE: Scaling your app vertically changes the disk space limit or memory limit for each app instance.
  3. Increase the memory limit for each app instance: cf scale cf-spring -m 1G
  4. Increase the disk limit for each app instance: cf scale cf-spring -k 512M