|
| 1 | +# gRPC for App Engine (standard) |
| 2 | + |
| 3 | +This app demonstrates how to run gRPC client libraries on App Engine Standard. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +- Install [`composer`](https://getcomposer.org) |
| 8 | +- Install dependencies by running: |
| 9 | + |
| 10 | + ```sh |
| 11 | + composer install |
| 12 | + ``` |
| 13 | + |
| 14 | +- Install the [Google Cloud SDK](https://developers.google.com/cloud/sdk/). |
| 15 | + |
| 16 | +## Deploy to App Engine |
| 17 | + |
| 18 | +### Run Locally |
| 19 | + |
| 20 | +These samples cannot be run locally with the Dev AppServer because gRPC has not |
| 21 | +been packaged with the Dev AppServer for PHP at this time. |
| 22 | + |
| 23 | +### Deploy with gcloud |
| 24 | + |
| 25 | +**The Cloud Monitoring sample** |
| 26 | + |
| 27 | +The monitoring sample will work out of the box by doing the following: |
| 28 | + |
| 29 | + |
| 30 | +``` |
| 31 | +gcloud config set project YOUR_PROJECT_ID |
| 32 | +gcloud app deploy |
| 33 | +gcloud app browse |
| 34 | +``` |
| 35 | +
|
| 36 | +The last command will open `https://{YOUR_PROJECT_ID}.appspot.com/` |
| 37 | +in your browser. Browse to `/monitoring` to see the sample. |
| 38 | +
|
| 39 | +**The Cloud Spanner sample** |
| 40 | +
|
| 41 | +You will need to create a [Spanner Instance][create_instance] and a |
| 42 | +[Spanner Database][create_database]. |
| 43 | +
|
| 44 | +Next, open up `spanner.php` in a text editor and change the values of |
| 45 | +`your-instance-id` and `your-database-id` to the Instance ID and Database ID you |
| 46 | +created. |
| 47 | +
|
| 48 | +Now you can deploy your application and it will work as expected: |
| 49 | +
|
| 50 | +``` |
| 51 | +gcloud config set project YOUR_PROJECT_ID |
| 52 | +gcloud app deploy |
| 53 | +gcloud app browse |
| 54 | +``` |
| 55 | +
|
| 56 | +The last command will open `https://{YOUR_PROJECT_ID}.appspot.com/` |
| 57 | +in your browser. Browse to `/spanner` to see the sample. |
| 58 | +
|
| 59 | +[create_database]: https://cloud.google.com/spanner/docs/quickstart-console#create_a_database |
| 60 | +[create_instance]: https://cloud.google.com/spanner/docs/quickstart-console#create_an_instance |
0 commit comments