Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow override of docker image #728

Open
wants to merge 2 commits into
base: mupx
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,21 @@ 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 ([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

You can use an array to deploy to multiple servers at once.
Expand Down
4 changes: 2 additions & 2 deletions example/mup.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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
}
}
10 changes: 7 additions & 3 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -127,4 +131,4 @@ exports.read = function(configFileName) {
console.error(errorMessage.red.bold);
process.exit(1);
}
};
};
3 changes: 2 additions & 1 deletion lib/taskLists/linux.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -189,4 +190,4 @@ function deployAndVerify(taskList, appName, port, deployCheckWaitTime) {
port: port
}
});
}
}
9 changes: 5 additions & 4 deletions templates/linux/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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 \
Expand All @@ -39,7 +40,7 @@ else
--hostname="$HOSTNAME-$APPNAME" \
--env-file=$ENV_FILE \
--name=$APPNAME \
meteorhacks/meteord:base
$DOCKERIMAGE
fi

<% if(typeof sslConfig === "object") { %>
Expand All @@ -56,4 +57,4 @@ fi
--publish=<%= sslConfig.port %>:443 \
--name=$APPNAME-frontend \
meteorhacks/mup-frontend-server /start.sh
<% } %>
<% } %>