diff --git a/appengine/cloudsql/README.md b/appengine/cloudsql/README.md index bf8dbb101a5..36995d1a174 100644 --- a/appengine/cloudsql/README.md +++ b/appengine/cloudsql/README.md @@ -1,13 +1,25 @@ # Cloud SQL sample for Google App Engine This sample demonstrates how to use [Cloud SQL](https://cloud.google.com/sql/) on Google App Engine + ## Setup -Before you can run or deploy the sample, you will need to create a [Cloud SQL instance](https://cloud.google.com/sql/docs/create-instance) -1. Create a new user and database for the application. The easiest way to do this is via the [Google Developers Console](https://console.developers.google.com/project/_/sql/instances/example-instance2/access-control/users). Alternatively, you can use MySQL tools such as the command line client or workbench. +Before you can run or deploy the sample, you will need to create a [Cloud SQL instance)](https://cloud.google.com/sql/docs/create-instance) + +1. Create a new user and database for the application. The easiest way to do this is via the [Google +Developers Console](https://console.developers.google.com/sql/instances). Alternatively, you can use MySQL tools such as the command line client or workbench. +2. Change the root password (under Access Control) and / or create a new user / password. +3. Create a Database (under Databases) (or use MySQL with `gcloud sql connect --user=root`) +4. Note the **Instance connection name** under Overview > properties +(It will look like project:instance for v1 or project:region:zone for v2) + +## Deploying + +`$ mvn clean appengine:deploy -DINSTANCE_CONNECTION_NAME="instanceConnectionName" -Duser=root +-Dpassword=myPassword -Ddatabase=myDatabase` + +Or you can update the properties in `pom.xml` and + ## Running locally 1. You will need to be running a local instance of MySQL. -1. Update the connection string in ``appengine-web.xml`` with your local MySQL instance values. -
`$ mvn clean appengine:devserver` -## Deploying -1. Update the connection string in ``appengine-web.xml`` with your Cloud SQL instance values. -
`$ mvn clean appengine:update` +`$ mvn clean appengine:run -Duser=root -Dpassword=myPassowrd -Ddatabase=myDatabase` + diff --git a/appengine/cloudsql/pom.xml b/appengine/cloudsql/pom.xml index 28cd3f805f1..c58c0260e18 100644 --- a/appengine/cloudsql/pom.xml +++ b/appengine/cloudsql/pom.xml @@ -27,41 +27,69 @@ ../.. + + + + + root + + + + + 1.0.0 + 1.7 + 1.7 + + + - - com.google.cloud.sql - mysql-socket-factory - 1.0.2 - javax.servlet - javax.servlet-api - 3.1.0 - jar + servlet-api + 2.5 provided - - - mysql - mysql-connector-java - 6.0.5 - + com.google.appengine appengine-api-1.0-sdk + + + + mysql + mysql-connector-java + 5.1.40 + ${project.build.directory}/${project.build.finalName}/WEB-INF/classes + + + src/webapp/WEB-INF + true + + + + com.google.cloud.tools + appengine-maven-plugin + ${appengine.maven.plugin} + + diff --git a/appengine/cloudsql/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/cloudsql/src/main/webapp/WEB-INF/appengine-web.xml index a801e60ea8a..eb9cb1fbef2 100644 --- a/appengine/cloudsql/src/main/webapp/WEB-INF/appengine-web.xml +++ b/appengine/cloudsql/src/main/webapp/WEB-INF/appengine-web.xml @@ -13,13 +13,11 @@ --> - YOUR-PROJECT-ID - YOUR-VERSION-ID true true - - + +