@@ -28,7 +28,7 @@ Instructions are provided below for using the proxy with a TCP connection or a
2828Unix domain socket. On Linux or macOS, you can use either option, but the
2929Windows proxy requires a TCP connection.
3030
31- ### Unix Socket mode
31+ ### Launch proxy with Unix Domain Socket
3232
3333NOTE: this option is currently only supported on Linux and macOS. Windows users
3434should use the TCP option.
@@ -37,22 +37,16 @@ To use a Unix socket, you'll need to create a directory and give access to the
3737user running the proxy:
3838
3939``` bash
40- sudo mkdir /path/to/the/new/directory
41- sudo chown -R $USER /path/to/the/new/directory
40+ sudo mkdir /cloudsql
41+ sudo chown -R $USER /cloudsql
4242```
4343
44- You'll also need to initialize an environment variable pointing to the directory
45- you just created:
46-
47- ``` bash
48- export DB_SOCKET_DIR=/path/to/the/new/directory
49- ```
50-
51- Use these terminal commands to initialize other environment variables as well:
44+ Use these terminal commands to initialize environment variables:
5245
5346``` bash
5447export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
55- export INSTANCE_CONNECTION_NAME=' <MY-PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>'
48+ export INSTANCE_CONNECTION_NAME=' <PROJECT-ID>:<INSTANCE-REGION>:<INSTANCE-NAME>'
49+ export INSTANCE_UNIX_SOCKET=' /cloudsql/<PROJECT-ID>:<INSTANCE-REGION>:<INSTANCE-NAME>'
5650export DB_USER=' <DB_USER_NAME>'
5751export DB_PASS=' <DB_PASSWORD>'
5852export DB_NAME=' <DB_NAME>'
@@ -66,22 +60,22 @@ safe.
6660Then use the following command to launch the proxy in the background:
6761
6862``` bash
69- ./cloud_sql_proxy -dir=$DB_SOCKET_DIR --instances=$INSTANCE_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
63+ ./cloud_sql_proxy -dir=/cloudsql --instances=$INSTANCE_CONNECTION_NAME --credential_file=$GOOGLE_APPLICATION_CREDENTIALS &
7064```
7165
72- ### TCP mode
66+ ### Launch proxy with TCP
7367
7468To run the sample locally with a TCP connection, set environment variables and
7569launch the proxy as shown below.
7670
77- #### Linux / macOS
71+ #### Linux / Mac OS
7872
7973Use these terminal commands to initialize environment variables:
8074
8175``` bash
8276export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service/account/key.json
83- export INSTANCE_CONNECTION_NAME=' <MY- PROJECT>:<INSTANCE-REGION>:<INSTANCE-NAME>'
84- export DB_HOST =' 127.0.0.1'
77+ export INSTANCE_CONNECTION_NAME=' <PROJECT-ID >:<INSTANCE-REGION>:<INSTANCE-NAME>'
78+ export INSTANCE_HOST =' 127.0.0.1'
8579export DB_USER=' <DB_USER_NAME>'
8680export DB_PASS=' <DB_PASSWORD>'
8781export DB_NAME=' <DB_NAME>'
@@ -104,7 +98,7 @@ Use these PowerShell commands to initialize environment variables:
10498
10599``` bash
106100$env :GOOGLE_APPLICATION_CREDENTIALS=" <CREDENTIALS_JSON_FILE>"
107- $env :DB_HOST =" 127.0.0.1"
101+ $env :INSTANCE_HOST =" 127.0.0.1"
108102$env :DB_USER=" <DB_USER_NAME>"
109103$env :DB_PASS=" <DB_PASSWORD>"
110104$env :DB_NAME=" <DB_NAME>
@@ -141,7 +135,7 @@ To run on App Engine Standard, create an App Engine project by following the
141135setup for these
142136[instructions](https://cloud.google.com/appengine/docs/standard/php7/quickstart#before-you-begin).
143137
144- First, update ` app.standard.yaml` with the correct values to pass the
138+ First, update [ app.standard.yaml](app.standard.yaml) with the correct values to pass the
145139environment variables into the runtime.
146140
147141Next, the following command will deploy the application to your Google Cloud
@@ -156,17 +150,21 @@ To run on App Engine Flex, create an App Engine project by following the setup
156150for these
157151[instructions](https://cloud.google.com/appengine/docs/standard/php7/quickstart#before-you-begin).
158152
159- First, update ` app.flex.yaml` with the correct values to pass the environment
153+ First, update [ app.flex.yaml](app.flex.yaml) with the correct values to pass the environment
160154variables into the runtime.
161155
162156To use a TCP connection instead of a Unix socket to connect your sample to your
163- Cloud SQL instance on App Engine, make sure to uncomment the ` DB_HOST `
157+ Cloud SQL instance on App Engine, make sure to uncomment the ` INSTANCE_HOST `
164158field under ` env_variables` . Also make sure to remove the uncommented
165159` beta_settings` and ` cloud_sql_instances` fields and replace them with the
166160commented ` beta_settings` and ` cloud_sql_instances` fields.
167161
168- Then, make sure that the service account
169- ` service-{PROJECT_NUMBER}>@gae-api-prod.google.com.iam.gserviceaccount.com` has
162+ Then, make sure that the App Engine default service account
163+ ` <PROJECT-ID>@appspot.gserviceaccount.com` has
164+ the IAM role ` Cloud SQL Client` .
165+
166+ Also, make sure that the Cloud Build service account
167+ ` cloudbuild@<PROJECT-ID>.iam.gserviceaccount.com` has
170168the IAM role ` Cloud SQL Client` .
171169
172170Next, the following command will deploy the application to your Google Cloud
0 commit comments