-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Update SQL #451
Update SQL #451
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't create dbs or users from the cloud console with v2 instances yet, AFAIK. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, I can. Maybe not yet deployed? |
||
3. Create a Database (under Databases) (or use MySQL with `gcloud sql connect <instance> --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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, but I prefer the 4-space indent or
Also, it's a bit funny to see a property name that isn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Generally yes, but I really want to call attention to it. |
||
-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. | ||
<br/>`$ mvn clean appengine:devserver` | ||
|
||
## Deploying | ||
1. Update the connection string in ``appengine-web.xml`` with your Cloud SQL instance values. | ||
<br/>`$ mvn clean appengine:update` | ||
`$ mvn clean appengine:run -Duser=root -Dpassword=myPassowrd -Ddatabase=myDatabase` | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should update the link to point to the cloud console.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's wrong with the link?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be https://console.cloud.google.com/sql/instances Remember console.developers.google.com just has the API manager now and no cloud stuff.