Which Meteor-Up for which Meteor?
I wrote this so I will remember how to deploy the next time I’ll upgrade Meteor. I published it because it might help others in the same situation.
When time came to deploy my new Meteor app in early 2015, I was very happy to learn about Meteor-Up. I installed mup on my development laptop, created a mup.json, and happily deployed.
A year or so later, when I tried to deploy from a different laptop (on which I freshly installed mup), I couldn’t get deployment to work anymore. In the end, somehow I managed; I think this involved upgrading to a new version of Meteor.
Similar story another half year later. New machine. I get mup. I can’t deploy.
What happened? Well, Meteor changed, and mup changed. And not every release of mup works with every release of Meteor. And it’s not entirely clear which release goes with which. And for mup, it’s not even so clear which releases there are (there’s mup, there’s mupx, and there are two different Git repos).
Here is a list of the different releases of mup/mupx (found via npm view mup and npm view mupx):
- arunoda/mup — upstart-based approach — available in npm as mup releases 0.1.2 (Dec. 4, 2013) to 0.11.3 (Sept. 25, 2015)
- arunoda/mupx — the mupx branch in the above Git repo, existed concurrently with the above and was used to develop of a docker-based approach — available in npm as mupx releases 1.0.0 (May 4, 2015) to 1.5.3 (Sept. 25, 2015)
- kadirahq/mup — docker-based approach — available in npm as mup release 1.0.0 (August 3, 2016) or later
Meteor to Meteor-Up Release Mapping
Here is a mapping showing my guess of which release of meteor works fine with which release of mup:
- Meteor 1.2 — arunoda/mup 0.11.3 ?
- Meteor 1.3 — kadirahq/mup 1.0.1 ?
- Meteor 1.4 — as of August 6, 2016, no mup support yet ?
Note that it could be that one can also deploy Meteor 1.2 applications with mup 1.0.1 (docker-based), or Meteor 1.3 applications with mup 1.0.1 (upstart-based).
Old Mup — Upstart-based
If you have a Meteor 1.2-based application (I have 1.2.1) and want to postpone migrating to docker-based deployment (because using docker-based mup entails, e.g., figuring out how to import the database into the MongoDB docker container, and figuring out what to do with your code that stores something on the server’s file system that now exists within a Meteor docker container), you may want to keep using Meteor 1.2 and mup 0.11.3. If you don’t have mup 0.11.3 already, install it with npm install -g firstname.lastname@example.org.
This old mup deploys the application into /opt/<appName>, where /opt/<appName>/app contains a Meteor application bundle, and /opt/<appName>/config/env.sh contains the environment variables (e.g., ROOT_URL, PORT, MONGO_URL, a combination of variables provided by mup itself and variables specified in various places of mup.json).
The application’s log goes into /var/log/upstart/<appName>.log, which is the file read by mup logs.
The old mup creates /etc/init/<appName>.conf to start/stop the application.
For setup (and if mup.json specifies “setup<component>”: true), the old mup also installs the following components by running some scripts:
- install-node.sh to install Node (mup 0.11.3 will install Node version 0.10.36, or the Node version that is specified under “nodeVersion” in mup.json — I specified 0.10.40). It downloads the node distribution from nodejs.org and unpacks it in /opt/nodejs and creates softlinks /usr/bin/node and /usr/bin/npm.
- install-phantomjs.sh to install PhantomJS (mup 0.11.3 will install PhantomJS version 1.9.8). It downloads the distribution from bitbucket and installs it in /usr/local/share, creating soft links /usr/local/share/phantomjs, /usr/local/bin/phantomjs, and /usr/bin/phantomjs.
- install-mongodb.sh to install MongoDB via apt-get (it installed mongodb 2.6.7 for me). Note that this creates an /etc/mongod.conf that does not enable the oplog, and thus causes bad Meteor performance; read how to set up oplog tailing to fix this. The install-mongodb.sh script also generates /etc/mongodb.conf (which is different from /etc/mongod.conf, and which seems not to be used: mongod runs with --config /etc/mongod.conf).
This (and some more) is implemented in mup in /usr/local/lib/node_modules/mup/lib/taskLists/linux.js.
New Mup — Docker-based
If you start from scratch, you probably want to use Meteor 1.3 and mup 1.0.1, which will deploy using docker. I haven’t tried this yet.