diff --git a/lib/config.js b/lib/config.js index 0b931a1..6e139f3 100644 --- a/lib/config.js +++ b/lib/config.js @@ -17,6 +17,7 @@ exports.read = function(configFileName) { //initialize options mupJson.env = mupJson.env || {}; mupJson.env['PORT'] = mupJson.env['PORT'] || 80; + mupJson.env['BIND'] = mupJson.env['BIND'] || "0.0.0.0"; if(typeof mupJson.setupNode === "undefined") { mupJson.setupNode = true; diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index 2bbbe0d..de4fbe3 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -74,6 +74,7 @@ exports.deploy = function(bundlePath, env, config) { appName: appName, useLocalMongo: config.setupMongo, port: env.PORT, + bind: env.BIND, sslConfig: config.ssl } }); diff --git a/templates/linux/start.sh b/templates/linux/start.sh index 2645942..c540135 100644 --- a/templates/linux/start.sh +++ b/templates/linux/start.sh @@ -5,6 +5,7 @@ APP_PATH=/opt/$APPNAME BUNDLE_PATH=$APP_PATH/current ENV_FILE=$APP_PATH/config/env.list PORT=<%= port %> +BIND=<%= bind %> USE_LOCAL_MONGO=<%= useLocalMongo? "1" : "0" %> # Remove previous version of the app, if exists @@ -22,7 +23,7 @@ if [ "$USE_LOCAL_MONGO" == "1" ]; then docker run \ -d \ --restart=always \ - --publish=$PORT:80 \ + --publish=$BIND:$PORT:80 \ --volume=$BUNDLE_PATH:/bundle \ --env-file=$ENV_FILE \ --link=mongodb:mongodb \ @@ -34,7 +35,7 @@ else docker run \ -d \ --restart=always \ - --publish=$PORT:80 \ + --publish=$BIND:$PORT:80 \ --volume=$BUNDLE_PATH:/bundle \ --hostname="$HOSTNAME-$APPNAME" \ --env-file=$ENV_FILE \ @@ -53,7 +54,7 @@ fi --volume=/opt/$APPNAME/config/bundle.crt:/bundle.crt \ --volume=/opt/$APPNAME/config/private.key:/private.key \ --link=$APPNAME:backend \ - --publish=<%= sslConfig.port %>:443 \ + --publish=$BIND:<%= sslConfig.port %>:443 \ --name=$APPNAME-frontend \ meteorhacks/mup-frontend-server /start.sh <% } %> \ No newline at end of file