Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mercmobily/naps
Simple script to manage several node apps behind an nginx reverse proxy
https://github.com/mercmobily/naps
Last synced: about 2 months ago
JSON representation
Simple script to manage several node apps behind an nginx reverse proxy
- Host: GitHub
- URL: https://github.com/mercmobily/naps
- Owner: mercmobily
- License: gpl-3.0
- Created: 2017-03-31T07:30:40.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-09-14T12:30:14.000Z (over 7 years ago)
- Last Synced: 2024-11-13T14:55:19.005Z (2 months ago)
- Language: JavaScript
- Homepage:
- Size: 43.9 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# naps (node apps)
A "node apps" management utility.
It assumes:* Nginx
* Mongo DB## Installation
npm install -g naps
## Configuration
Copy the example config file in /etc
## What it does
Naps is used to:
* Generate a config file suitable for Nginx as a reverse proxy
* Allocate local ports for the defined apps
* Set a sane (overridable) environment for the app to run into
* Set which user the app will run under
* Run and stop defined apps
* List all applications marked as startable
* Run and stop all defined apps
* Deploy a "development" environment, archiving the current "production" one away
* Ensure that all apps that are meant to be running actually are running, by
checking if the port they are meant to listen to are actually taken
* Copy the database from production to development
* Restart Nginx
* Run `mongo` on the right database given an `appName`
* Check the error logs constantly, sending an email with the new contents
to admins if they grow
* Restart automatically a server (in a debouncing fashion) if files are
modified, especially useful in development environments## Usage
Naps is the holy grail of node app management when used with NginX as reverse proxy.
Your init script will typically contain:
naps reset # Clean up
naps startall forever >> /var/log/naps.log & # Start all apps
naps watchall >> /var/log/naps.log & # Restart on change
naps logcheck >> /var/log/naps.log & # Email if error log growsUsage:
naps help
This help screenCONFIG OPTIONS
naps config or naps c
Display all of the config entriesnaps config write
Write the expanded nginx config onto the CONF fileMONITORING OPTIONS
naps reset
Cleans out all lock files in /var/naps used to know what apps are running
Typically run before 'naps startall forever' at boot timenaps list or naps l
List all apps, showing the ones that have startedSINGLE APP MANAGEMENT OPTIONS
(Output is always timestamped, log-like output)naps start [forever]
Start a specific app. NOTE: all console messages are timestamped and
paired to the started process.
If is passed, naps will monitor the app and make sure that
it's restarted when needed.
If the node server outputs one line with 'NAPS: DEAFENING', it's assumed
that it no longer listens to its assigned port.
Note that the node instance's logs are in $LOGDIR/$APPNAME-out.log
and $LOGDIR/$APPNAME-err.lognaps stop
Stop a specific app
naps kill [delay]
Kill a specific app by sending a SIGKILL
If is passed, naps will wait milliseconds before killingnaps watch
Will watch the app's directory, restart the app if anything changesBATCH APP MANAGEMENT OPTIONS
(Will run naps itself as a background process; will run one different
naps process per app)naps startall [forever]
Start all startable appsnaps stopall
Stop all startable appsnaps killall [delay]
kill all startable apps by sending a SIGKILLnaps watchall
Watch all startable apps marked as 'development'MONITORING OPTIONS
naps logcheck
Will check the error logs and inform the admin if more entries are added
Error logs are assumed to be in $LOGDIR/$APPNAME-err.logSYSADMIN OPTIONS
naps logs [err]
Will show node logs for that app. Will display stdout by default.
If 'err' is added, it will display the node instance's stderr
naps deploy
Will overwrite development app onto production one, archiving production
Files under public/f will be sparednaps dbprod2dev
Copy database from production app to development. DEVEL DB WILL BE ZAPPED.naps nginx-restart or naps nr
Restart nginxnaps dbadmin
Starts a mongo shell on 's database, passing the admin's password