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

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  
主站蜘蛛池模板: 商水县| 新邵县| 鄂托克前旗| 安达市| 双峰县| 乐业县| 屏南县| 溧水县| 金秀| 大邑县| 遂宁市| 岑溪市| 绍兴县| 锡林浩特市| 宁城县| 陈巴尔虎旗| 上饶市| 西盟| 三明市| 定结县| 辉县市| 扶余县| 岳普湖县| 渝北区| 永泰县| 贡嘎县| 界首市| 迁西县| 新乡市| 富川| 方正县| 垫江县| 龙江县| 靖江市| 屏南县| 曲阜市| 娄烦县| 武宁县| 英德市| 城口县| 龙门县|