From 68e1f86829817deb2288735012c11d5b616a55cc Mon Sep 17 00:00:00 2001 From: Jerjou Cheng Date: Fri, 28 Oct 2016 11:32:35 -0700 Subject: [PATCH] Fix up sendgrid README --- compute/sendgrid/README.md | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/compute/sendgrid/README.md b/compute/sendgrid/README.md index 7a9c16aa53c..00b2281d2da 100644 --- a/compute/sendgrid/README.md +++ b/compute/sendgrid/README.md @@ -11,7 +11,7 @@ For more information about SendGrid, see their [sample-docs]: https://cloud.google.com/compute/docs/tutorials/sending-mail/using-sendgrid -## Running on Compute Engine +## Running on Compute Engine To run the sample, you will need to do the following: @@ -20,17 +20,30 @@ To run the sample, you will need to do the following: 1. Create a compute instance on the Google Cloud Platform Developer's Console 1. SSH into the instance you created 1. Update packages and install required packages - sudo apt-get update && sudo apt-get install git-core openjdk-8-jdk maven + + sudo apt-get update && sudo apt-get install git-core openjdk-8-jdk maven + 1. Clone the repo - git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git -1. Configure your SendGrid settings in the java class (SENDGRID_API_KEY, SENDGRID_SENDER, TO_EMAIL) - java-docs-samples/compute/sendgrid/src/main/java/com/example/compute/sendgrid/SendEmailServlet.java -1. Navigate back to ./sendgrid and use maven to package the class as a jar - mvn clean package + + git clone https://github.com/GoogleCloudPlatform/java-docs-samples.git + +1. Configure your SendGrid settings in the java class (`SENDGRID_API_KEY`, + `SENDGRID_SENDER`, `TO_EMAIL`) + + java-docs-samples/compute/sendgrid/src/main/java/com/example/compute/sendgrid/SendEmailServlet.java + +1. Navigate back to `./sendgrid` and use maven to package the class as a jar + + mvn clean package + 1. Switch to the target directory with the jar file and enable execution on that file - chmod +x compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar + + chmod +x compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar + 1. Make sure that openjdk 8 is the selected java version - sudo update-alternatives --config java + + sudo update-alternatives --config java + 1. Execute the jar file and send an email (make sure you are in the target folder) - java -jar compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar + java -jar compute-sendgrid-1.0-SNAPSHOT-jar-with-dependencies.jar