Skip to content

Instantly share code, notes, and snippets.

@jhgaylor
Last active May 27, 2016 10:56
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jhgaylor/ef5f2748b7b9b94ded46 to your computer and use it in GitHub Desktop.
Save jhgaylor/ef5f2748b7b9b94ded46 to your computer and use it in GitHub Desktop.
A script for deploying a meteor application to modulus.io using codeship.io for CI. Useful if your meteor app is not at the root of your repo.
#!/bin/sh
# assumes a clean install on a fresh linux box.
# for use w/ codeship.io
set -e
set -u
# a reference to the cloned repository's path
PWD=`pwd`
METEOR_APP_PATH="$PWD/MeteorApp"
MODULUS_PROJECT_NAME=_YOUR_PROJECT_NAME_
MODULUS_TOKEN=_YOUR_API_TOKEN_
### Install Meteor & Meteorite
# https://gist.github.com/mlocher/1f872bd9842a5c7ad136
curl https://install.meteor.com > ./install_meteor
# modify the install script to
sed -i'' -e 's/PREFIX=.*/PREFIX="$HOME"/g' ./install_meteor
chmod u+x ./install_meteor
./install_meteor
# add meteor to the path
export PATH=$PATH:"$HOME/.meteor"
# install meteorite
npm install -g meteorite
### Meteor finished installing
### Deply to modulus
npm install -g modulus
export MODULUS_TOKEN=$MODULUS_TOKEN
cd $METEOR_APP_PATH
modulus deploy -p $MODULUS_PROJECT_NAME
### Deploy to modulus finished
@chadokruse
Copy link

This is great, thank you!

Just an FYI to anyone else coming across this, Codeship now has a gui for their Modulus integration. However, you still need to add lines 14-27 (place in the Test section of the gui):

###  Install Meteor & Meteorite
# https://gist.github.com/mlocher/1f872bd9842a5c7ad136
curl https://install.meteor.com > ./install_meteor
# modify the install script to 
sed -i'' -e 's/PREFIX=.*/PREFIX="$HOME"/g' ./install_meteor 
chmod u+x ./install_meteor
./install_meteor

# add meteor to the path
export PATH=$PATH:"$HOME/.meteor"

# install meteorite
npm install -g meteorite
###  Meteor finished installing

@jhgaylor
Copy link
Author

The gui for the Modulus integration is great if your meteor app is in the root of your repo, but deploys as a node app if you have it in a subdirectory. Using this script you can keep your app anywhere in the repo.

@gary-menzel
Copy link

gary-menzel commented May 27, 2016

I see this script is a couple of year old. I have recently been trying to deploy a Meteor 1.3 app from CodeShip to Modulus. However, I am encountering the problem in this following forum post (despite having used a custom script to use the latest Modulus version as the post advises):

https://forums.meteor.com/t/modulus-deployment-error-mnt-input-meteor-directory-must-exist/22533

tl;dr: a /mnt directory is not available (which seems to be an issue with the Modulus tool)

I am able to deploy from my dev machine (OS X Mavericks) using the process described in the post but it still fails on CodeShip (ticket in with their service desk).

I am wondering if the above would resolve the issue if I were to use the above.

UPDATE:
Issue resolved. The latest Modulus deployment process (Version 6 - mentioned in the above link) requires your bundle to have the .meteor directory (which was not being included with my GitHub checkin). This now works: GitHub => CodeShip => Modulus (for Meteor 1.3). Details on:

http://blog.modulus.io/the-new-meteor-build-image

Specifically the section around FILE STRUCTURE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment