Last active
August 29, 2015 14:16
-
-
Save liferealized/d5f7fa1e01bfc926c3f4 to your computer and use it in GitHub Desktop.
Insight Server Upstart Script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!upstart | |
description "Insight Server Daemon" | |
start on startup | |
stop on shutdown | |
# This line is needed so that Upstart reports the pid of the Node.js process | |
# started by Forever rather than Forever's pid. | |
expect fork | |
# Set the root path for all forever files | |
env FOREVER_ROOT=/etc/forever | |
# Make sure express is running in production mode | |
env NODE_ENV="production" | |
# The full path to the directory containing the node and forever binaries. | |
env NODE_BIN_DIR="/usr/local/bin" | |
# Set the NODE_PATH to the Node.js main node_modules directory. | |
env NODE_PATH="/usr/local/lib/node_modules" | |
# The application startup Javascript file path. | |
env SOURCE_DIR="/var/www/insight" | |
env WORKING_DIR="/var/www/insight" | |
env APPLICATION_PATH="node_modules/.bin/insight-bitcore-api" | |
# Process ID file path. | |
env PIDFILE="/var/run/insight.pid" | |
# Log file path. | |
env LOG="/var/log/insight.log" | |
# Forever settings to prevent the application spinning if it fails on launch. | |
env MIN_UPTIME="5000" | |
env SPIN_SLEEP_TIME="2000" | |
# Server specific environment variables to connect to bitcoind | |
env BITCOIND_USER="YOUR_BITCOIN_USER" | |
env BITCOIND_PASS="YOUR_BITCOIN_PASS" | |
env BITCOIND_DATADIR="/.bitcoin/" | |
# Insight specific variables | |
env INSIGHT_NETWORK="livenet" | |
env INSIGHT_DB="/.insight/" | |
env INSIGHT_PUBLIC_PATH="public" | |
# Plugins to enable, uncomment to enable | |
#env ENABLE_MAILBOX="true" | |
#env ENABLE_CLEANER="true" | |
#env ENABLE_MONITOR="true" | |
#env ENABLE_CURRENCYRATES="true" | |
#env ENABLE_RATELIMITER="true" | |
#env ENABLE_CREDSTORE="true" | |
#env ENABLE_EMAILSTORE="true" | |
#env INSIGHT_EMAIL_CONFIRM_HOST="YOUR_URL" | |
script | |
# Add the node executables to the path, which includes Forever if it is | |
# installed globally, which it should be. | |
PATH=$NODE_BIN_DIR:$PATH | |
exec forever \ | |
--pidFile $PIDFILE \ | |
-a \ | |
-l $LOG \ | |
--minUptime $MIN_UPTIME \ | |
--spinSleepTime $SPIN_SLEEP_TIME \ | |
--sourceDir $SOURCE_DIR \ | |
--workingDir $WORKING_DIR \ | |
start $APPLICATION_PATH | |
end script | |
pre-stop script | |
PATH=$NODE_BIN_DIR:$PATH | |
exec forever \ | |
--sourceDir $SOURCE_DIR \ | |
--workingDir $WORKING_DIR \ | |
stop $APPLICATION_PATH | |
end script |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment