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

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:
主站蜘蛛池模板: 枣阳市| 南京市| 临江市| 信阳市| 乐清市| 英吉沙县| 米林县| 五常市| 昌乐县| 京山县| 平舆县| 许昌市| 清水县| 女性| 南丰县| 元阳县| 泽普县| 泸西县| 个旧市| 色达县| 屏山县| 勐海县| 安仁县| 青阳县| 香河县| 嘉义市| 沧源| 九龙县| 汝南县| 台湾省| 上栗县| 赞皇县| 大关县| 崇左市| 南昌县| 阿合奇县| 周宁县| 曲靖市| 高唐县| 炉霍县| 于田县|