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

How to do it...

With the MongoDB server up and running, we'll make a few configurational changes and deploy the application to the App Engine:

  1. Logging into the Cloud Platform Console, create an App Engine application, select the region where the application will be hosted and enable billing. You can follow along with the interactive tutorial provided by Google to host your first Node.js application to the App Engine.
  1. In the development machine, copy the Chapter01/mysite folder to a new folder called Chapter01/mysite-ae from where we'll push the code to the App Engine:
$ cp mysite/ mysite-ae/ -r 
  1. Navigate to the mysite-ae folder. Open the .env file and update the path for MONGO_URI to point to our VM:
MONGO_URI=mongodb://<External IP>:27017/mysite 
  1. Verify that all the packages are installed and launch the application on the development machine, pointing to the database on the Cloud:
$ npm install
$ npm start  
  1. The application's configurations are governed by a file called app.yaml. Create a new file with the following content:
# Basic configurations for the NodeJS application 
runtime: nodejs 
env: flex
  1. Now, we can deploy the application to the App Engine:
$ gcloud app deploy
  1. Once the application is deployed, the URL to access the application is provided. Fire up your favorite browser and navigate to the appspot URL and verify that the KeystoneJS application is running properly:
  .....
5cbd6acfb] to complete...done. Updating service [default]...done. Deployed service [default] to [https://<project-id>.appspot.com]
  1. You can stream logs from the command line by running:
$ gcloud app logs tail -s default
  1. To view your application in the web browser run:
$ gcloud app browse  
主站蜘蛛池模板: 永定县| 吴旗县| 三原县| 泸水县| 陆河县| 临沂市| 特克斯县| 湖州市| 仁布县| 涟水县| 武穴市| 墨江| 高淳县| 海淀区| 黄骅市| 利辛县| 阳山县| 泽库县| 文化| 孝昌县| 新干县| 友谊县| 平昌县| 石泉县| 原平市| 丽水市| 湖州市| 长春市| 凉城县| 江山市| 新源县| 塔城市| 涪陵区| 龙南县| 林芝县| 临朐县| 临安市| 汤阴县| 扶余县| 革吉县| 绥芬河市|