Comments (6)
@naziml Are there any plans to add support for looking for a start script in the package.json file as well? It would be ideal to have that behavior, to alleviate the need to set the startup file as an App Service setting.
from node.
Your start command can be set to either a PM2 process file (process.json) or just the startup script of your node app (e.g. bin/www). If your startup script is not set at all, we will try to auto-set in this order:
- Check if bin/www exists and set that if it does
- Check if server.js exists in site root
- Check if app.js exists in site root
If your startup script is not set and we don't find any of the above, we will go to a default splash page (hostingstart.js)
HTH,
from node.
👍 to what @lostintangent said. Checking main
and scripts.start
from package.json would cover most cases.
from node.
Is there any reason this logic isn't included in the image?
I noticed that the Ruby image offloads some things to a startup.sh script. This same kind of thing could be done here to determine the correct start file, exec args (i.e. experimental flags passed to the node bin parsed from env vars), or even to detect the start file.
PACKAGE_PATH=/home/site/wwwroot/package.json # Needs a recursive find instead.
MAIN=$(node -pe "require('$PACKAGE_PATH').main || ''" 2> /dev/null || true)
START=$(node -pe "require('$PACKAGE_PATH').scripts.start || ''" 2> /dev/null || true)
# Fall back to testing for local files.
# ...
There's a lot of potential here. :)
from node.
/cc @Hamster-Huey
from node.
Support for detecting scripts.start and running npm start
has been added. Closing this, although it won't be deployed to production for a while.
from node.
Related Issues (19)
- node/6.9.3-1/sshd_config RhostsAuthentication HOT 1
- [Feature Request] Add Node v8.x support HOT 14
- Use pm2-docker binary instead of pm2
- Documentation on using PM2
- npm version in bash shell extremely old, doesnt match npm version used in container.
- Node logging is unavailable?
- Deployment crash fix. HOT 1
- Custom deploy script not executed.
- Starting Pm2 in auto cluster mode HOT 4
- Make yarn available as an alternative package manager or provide a way to install it. HOT 16
- Node.js versions HOT 10
- Useless container logs HOT 7
- ERROR: Cannot find module '../constants.js' - if pm2 is run in start script HOT 1
- log stream no longer shows line breaks in between console logs? HOT 1
- [Discussion] Remove pre-LTS v6 containers HOT 3
- Log stream "clear" button barely works.
- Prompt PS1 value is wrong when ssh'ing HOT 1
- Remote debugging with custom package.json script
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node.