官术网_书友最值得收藏!

Deploying to Google App Engine

To deploy to Google App Engine, use the app command group. The App Engine allows us to host websites developed in PHP, Java, Go, or Python in the standard environment. To deploy a sample app to the App Engine instance that was created in Chapter 1, Google Cloud and Google BigQuery, follow the steps listed here:

  1. Download the sample PHP file and app.yaml file from the GitHub URL (https://github.com/hthirukkumaran/Learning-Google-BigQuery/tree/master/chapter2/phpapp) to a folder on the local computer. This PHP code connects to the Cloud SQL instance of the same project, executes a sample query, and displays the result.
  2. Open the index.php file and modify the $dsn variable value to point to your Cloud SQL instance. To get the full qualified Cloud SQL instance name, open the Cloud SQL instance in your project. Copy the value of the instance connection name and paste that value instead of the following value into the PHP file. Change the dbname in the $dsn variable to your database name. Change the values of $username to the database username in Cloud SQL you want to use, and $password to the password of the user specified in the $username variable:
my-first-project-170319:us-central1:trainingdbserver
  1. Save the changes, open the Terminal, and go to the directory where the app.yaml and index.php are located. Type the following command to deploy your changes to the App Engine instance you created in the previous chapter. If asked for confirmation to deploy press Y:
gcloud app deploy
  1. Once the app is deployed, type the following command to open the app in the browser and view the screen. If you encounter any errors, you can see the error in the Error Reporting option of the menu:
gcloud app browse
  1. If you encounter any permission errors while the app is connecting to the Cloud SQL instance, check to make sure that permission is granted for the App Engine to connect to Cloud SQL under the section App Engine authorization, as shown in the following screenshot:
主站蜘蛛池模板: 和平县| 九台市| 丰台区| 南充市| 乌兰浩特市| 两当县| 武山县| 榕江县| 崇明县| 宁城县| 扬州市| 喀喇| 宾川县| 盐山县| 铜梁县| 临漳县| 青川县| 二连浩特市| 南丰县| 梅州市| 新和县| 蒲城县| 澄江县| 新邵县| 新泰市| 突泉县| 罗甸县| 西乌| 商水县| 肃宁县| 岐山县| 华容县| 阿克苏市| 沅陵县| 陕西省| 黄石市| 望都县| 抚顺市| 临猗县| 兴业县| 孟州市|