From 1968cc8b7cee4587cafa9a15d809bb61eeec367d Mon Sep 17 00:00:00 2001 From: Toan Date: Thu, 30 Apr 2020 17:28:37 -0700 Subject: [PATCH] updated node article --- ...n-production-build-on-app-service-linux.md | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/_posts/2020-04-30-run-production-build-on-app-service-linux.md b/_posts/2020-04-30-run-production-build-on-app-service-linux.md index 8e5caf89..d18dacea 100644 --- a/_posts/2020-04-30-run-production-build-on-app-service-linux.md +++ b/_posts/2020-04-30-run-production-build-on-app-service-linux.md @@ -16,34 +16,37 @@ toc_sticky: true date: 2020-04-30 00:00:00 --- -## Overview - When you create production build for your React, Angular, other Node framework the files will either be placed in a `build` or `dist` directory depending on the framework. App Service on Linux uses *Oryx* to detect, build, and start your application. For more information about how this is done, please go to the [Oryx](https://github.com/microsoft/Oryx/blob/master/doc/runtimes/nodejs.md) GitHub page for more info. In order to serve the built content, you can perform either of the following. ## PM2 Serve 1. In the Azure Portal, go to *Configuration*. 1. Select *General* and locate the *Startup Command* box. -1. If all of the items in the `build` directory are in wwwroot, change the path to /home/site/wwwroot. +1. If all of the items in the `build` directory are in `wwwroot`, change the path to `/home/site/wwwroot`. + ```bash + pm2 serve /home/site/wwwroot/build --no-daemon + ``` +1. If the content is under `dist`, make sure to use the following. + ```bash + pm2 serve /home/site/wwwroot/dist --no-daemon + ``` -```bash - pm2 serve /home/site/wwwroot/build --no-daemon -``` 1. Press Save. ## Process File -1. Create a process.json, process.yml, etc. In this example, I'm using a process.json file with the following content and add it to the wwwroot directory. +1. Create a process.json or process.yml and place it in `/home/site/wwwroot`. +1. In this example, I'm using a process.json file and my files are under the `build` directory. Make sure to change this to `dist` if your framework is outputing to the `dist` directory. -```bash - { - "script": "serve", - "env": { - "PM2_SERVE_PATH": './build' - } - "args": '--no-daemon' - } -``` + ```bash + { + "script": "serve", + "env": { + "PM2_SERVE_PATH": './build' + } + "args": '--no-daemon' + } + ``` 1. In the Azure Portal, go to *Configuration*. 1. Select *General* and locate the *Startup Command* box and enter `process.json`. 1. Press Save. \ No newline at end of file