From 1a9c1f89fac727b999fa4b6eba81523f3d9553d2 Mon Sep 17 00:00:00 2001 From: Greg Warner Date: Sat, 31 Oct 2015 11:28:14 -0700 Subject: [PATCH 1/2] allow override of docker image --- README.md | 6 ++++++ example/mup.json | 7 +++++-- lib/config.js | 10 +++++++--- lib/taskLists/linux.js | 3 ++- templates/linux/start.sh | 9 +++++---- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 6140215..2a89c57 100644 --- a/README.md +++ b/README.md @@ -219,6 +219,12 @@ Meteor Up uses Docker to run and manage your app. It uses [MeteorD](https://gith For more information see [`lib/taskLists.js`](https://github.com/arunoda/meteor-up/blob/mupx/lib/taskLists/linux.js). +#### Using a custom docker image + +The default docker image (MeteorD) can be overridden by setting `dockerImage` +in the settings.json file. This image should be based off of meteord to +ensure compatibility. + #### Multiple Deployment Targets You can use an array to deploy to multiple servers at once. diff --git a/example/mup.json b/example/mup.json index 4d19bfa..b374473 100644 --- a/example/mup.json +++ b/example/mup.json @@ -18,6 +18,9 @@ // Install MongoDB on the server. Does not destroy the local MongoDB on future setups "setupMongo": true, + // Docker image to use + "dockerImage": "meteorhacks/meteord:base", + // Application name (no spaces). "appName": "meteor", @@ -37,7 +40,7 @@ // Before mup checks that, it will wait for the number of seconds configured below. "deployCheckWaitTime": 15, - // show a progress bar while uploading. + // show a progress bar while uploading. // Make it false when you deploy using a CI box. "enableUploadProgressBar": true -} \ No newline at end of file +} diff --git a/lib/config.js b/lib/config.js index 0b931a1..b35637a 100644 --- a/lib/config.js +++ b/lib/config.js @@ -28,6 +28,10 @@ exports.read = function(configFileName) { mupJson.appName = "meteor"; } + if(typeof mupJson.dockerImage === "undefined") { + mupJson.dockerImage = "meteorhacks/meteord:base"; + } + if(typeof mupJson.enableUploadProgressBar === "undefined") { mupJson.enableUploadProgressBar = true; } @@ -94,12 +98,12 @@ exports.read = function(configFileName) { helpers.printHelp(); process.exit(1); } - + function rewritePath(location, errorMessage) { if(!location) { return mupErrorLog(errorMessage); } - + var homeLocation = process.env.HOME; if(/^win/.test(process.platform)) { homeLocation = process.env.USERPROFILE; @@ -127,4 +131,4 @@ exports.read = function(configFileName) { console.error(errorMessage.red.bold); process.exit(1); } -}; \ No newline at end of file +}; diff --git a/lib/taskLists/linux.js b/lib/taskLists/linux.js index 2bbbe0d..f5da5d8 100644 --- a/lib/taskLists/linux.js +++ b/lib/taskLists/linux.js @@ -72,6 +72,7 @@ exports.deploy = function(bundlePath, env, config) { dest: '/opt/' + appName + '/config/start.sh', vars: { appName: appName, + dockerImage: config.dockerImage, useLocalMongo: config.setupMongo, port: env.PORT, sslConfig: config.ssl @@ -189,4 +190,4 @@ function deployAndVerify(taskList, appName, port, deployCheckWaitTime) { port: port } }); -} \ No newline at end of file +} diff --git a/templates/linux/start.sh b/templates/linux/start.sh index 2645942..e47f551 100644 --- a/templates/linux/start.sh +++ b/templates/linux/start.sh @@ -6,6 +6,7 @@ BUNDLE_PATH=$APP_PATH/current ENV_FILE=$APP_PATH/config/env.list PORT=<%= port %> USE_LOCAL_MONGO=<%= useLocalMongo? "1" : "0" %> +DOCKERIMAGE=<%= dockerImage %> # Remove previous version of the app, if exists docker rm -f $APPNAME @@ -15,7 +16,7 @@ docker rm -f $APPNAME-frontend # We don't need to fail the deployment because of a docker hub downtime set +e -docker pull meteorhacks/meteord:base +docker pull $DOCKERIMAGE set -e if [ "$USE_LOCAL_MONGO" == "1" ]; then @@ -29,7 +30,7 @@ if [ "$USE_LOCAL_MONGO" == "1" ]; then --hostname="$HOSTNAME-$APPNAME" \ --env=MONGO_URL=mongodb://mongodb:27017/$APPNAME \ --name=$APPNAME \ - meteorhacks/meteord:base + $DOCKERIMAGE else docker run \ -d \ @@ -39,7 +40,7 @@ else --hostname="$HOSTNAME-$APPNAME" \ --env-file=$ENV_FILE \ --name=$APPNAME \ - meteorhacks/meteord:base + $DOCKERIMAGE fi <% if(typeof sslConfig === "object") { %> @@ -56,4 +57,4 @@ fi --publish=<%= sslConfig.port %>:443 \ --name=$APPNAME-frontend \ meteorhacks/mup-frontend-server /start.sh -<% } %> \ No newline at end of file +<% } %> From 5ce12827be0eb1be5f32c5172ae30047348c9c2b Mon Sep 17 00:00:00 2001 From: Greg Warner Date: Mon, 7 Dec 2015 21:46:18 -0700 Subject: [PATCH 2/2] docker image override documentation improvements --- README.md | 15 ++++++++++++--- example/mup.json | 3 --- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 2a89c57..551df0a 100644 --- a/README.md +++ b/README.md @@ -221,9 +221,18 @@ For more information see [`lib/taskLists.js`](https://github.com/arunoda/meteor- #### Using a custom docker image -The default docker image (MeteorD) can be overridden by setting `dockerImage` -in the settings.json file. This image should be based off of meteord to -ensure compatibility. +The default docker image ([meteorhacks/meteord](https://hub.docker.com/r/meteorhacks/meteord/)) +can be overridden by setting `dockerImage` in the mup.json file. This +image should be based off of meteord to ensure compatibility. ([Here](https://github.com/gdw2/docker-meteord-buzz) +is an example adding the `graphicsmagick` binary dependency to the docker image.) + +For example, add the following to `mup.json`: + +``` + // Docker image to use + "dockerImage": "dockeruser/custommeteord:latest", +``` + #### Multiple Deployment Targets diff --git a/example/mup.json b/example/mup.json index b374473..a7875b1 100644 --- a/example/mup.json +++ b/example/mup.json @@ -18,9 +18,6 @@ // Install MongoDB on the server. Does not destroy the local MongoDB on future setups "setupMongo": true, - // Docker image to use - "dockerImage": "meteorhacks/meteord:base", - // Application name (no spaces). "appName": "meteor",