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

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  
主站蜘蛛池模板: 古丈县| 江门市| 阳新县| 新丰县| 资源县| 巴彦县| 确山县| 防城港市| 诸城市| 商丘市| 威海市| 永和县| 衢州市| 阿城市| 宜宾县| 天气| 七台河市| 花垣县| 屏东市| 康平县| 定安县| 西丰县| 江源县| 寿光市| 长寿区| 汾西县| 家居| 利川市| 寿光市| 龙山县| 阳西县| 东方市| 会理县| 红原县| 福清市| 武山县| 连南| 西乌珠穆沁旗| 布拖县| 错那县| 陆良县|