This is an example app for my session at the SpringOne2Gx. It demonstrates combining SendGrid and Cloudfoundry.
Show the app code. Run it with gradle jettyRunWar locally.
Show that you then do gem install cf
but just in a slide.
Go through the following steps live.
cf target api.run.pivotal.io
cf login
gradle assemble
cf push --path build/libs/spring-attack.war
Then show the live running app. Then add SendGrid.
cf create-service sendgrid
cf bind-service
Next, show how you can see the VCAP_Environment variables.
cf restart spring-attack
cf files spring-attack logs/env.log
Note the username and password in the VCAP_SERVICES and then lets set those as environment variables.
cf set-env spring-attack SENDGRID_USERNAME username
cf set-env spring-attack SENDGRID_PASSWORD password
Note that they are in there.
cf env spring-attack
gem install cf
cf target api.run.pivotal.io
cf login
gradle assemble
cf push --path build/libs/spring-attack.war
- Set the
SENDGRID_USERNAME
andSENDGRID_PASSWORD
environment variables.
export SENDGRID_USERNAME=your_username
export SENDGRID_PASSWORD=your_password
- Then build and serve the war file.
gradle jettyRunWar
- Visit http://localhost:8080.