Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix up sendgrid README #391

Merged
merged 2 commits into from
Oct 28, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 23 additions & 10 deletions compute/sendgrid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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