Skip to content

Instantly share code, notes, and snippets.

@jareiko
Last active March 6, 2016 00:03
Show Gist options
  • Save jareiko/260e4feaec2c4ee48052 to your computer and use it in GitHub Desktop.
Save jareiko/260e4feaec2c4ee48052 to your computer and use it in GitHub Desktop.
Deploying to Meteor with Codeship.io

Deploying to Meteor with Codeship.io

Project structure

You'll need to use a subdirectory within your git repo for the Meteor project. This allows you to clone Meteor into your repo without it trying to deploy itself. If you find a better way, please let me know.

Provide the name of the subdirectory to the deploy script with the SUBDIRECTORY environment variable.

Create a Codeship project

You can do that here. Connect it to your GitHub repo.

Configure Environment

Add these variables in the "Environment" section:

SUBDIRECTORY = yourapp [see project structure above]
METEOR_USERNAME = ...
METEOR_PASSWORD = ...
METEOR_TARGET = yourapp.meteor.com [or www.yourapp.com]

Add Script

Under the "Deployment" section, add this script:

expect -c "set timeout 600; spawn git clone -b release/$(cat $SUBDIRECTORY/.meteor/release) https://github.com/meteor/meteor.git --depth 1; expect eof; spawn meteor/meteor login; expect Username:; send $METEOR_USERNAME; expect Password:; send $METEOR_PASSWORD; expect eof; cd $SUBDIRECTORY; spawn ../meteor/meteor deploy $METEOR_TARGET; expect eof }"

You should NOT include newlines, but here it is expanded:

# DON'T INCLUDE NEWLINES, USE THE VERSION ABOVE!

expect -c " 
  set timeout 600;
  spawn git clone \
      -b release/$(cat $SUBDIRECTORY/.meteor/release) \
      https://github.com/meteor/meteor.git \
      --depth 1;
  expect eof;
  spawn meteor/meteor login;
  expect Username:;
  send $METEOR_USERNAME;
  expect Password:;
  send $METEOR_PASSWORD;
  expect eof;
  cd $SUBDIRECTORY;
  spawn ../meteor/meteor deploy $METEOR_TARGET;
  expect eof
}"

Push to GitHub

Push changes to your GitHub repo, and Codeship will deploy them automatically with Meteor!

@rhyslbw
Copy link

rhyslbw commented Sep 22, 2015

Thanks for the gist. Is this still current?

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