Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy meteor 0.6.0 + to heroku

Tags:

heroku

meteor

Im trying to deploy my meteor 0.6.3 app to heroku i tried using https://github.com/jordansissel/heroku-buildpack-meteor.git it only supports meteor 0.5.9 i also tried bundling my app in a .tgz file as suggested by the meteor docs but was not able to deploy I kept getting the no cedar app detected?

like image 743
Moshe Avatar asked Dec 20 '22 04:12

Moshe


2 Answers

I had to do a bit of work to get Meteor 0.8.2 to deploy properly to Heroku. I'm posting the sequence of steps that worked for me. You could turn this into a parameterized Bash script, if you were so inclined.

# Define Meteor/Heroku app name:
export APP_NAME='Your-App-Name-Here'

# Create Meteor app:
meteor create --example leaderboard "${APP_NAME}"
cd "${APP_NAME}"
git init .
git add .
git commit -m 'Initial commit'

if ( heroku apps | egrep --silent "^${APP_NAME}$" )
then
    # If re-using an existing Heroku app:
    echo "Heroku app '${APP_NAME}' already exists; configuring..."
    git remote remove heroku
    heroku git:remote -a "${APP_NAME}"
    heroku config:set \
        BUILDPACK_URL=https://github.com/oortcloud/heroku-buildpack-meteorite.git
else
    # If creating the Heroku app for the first time:
    echo "Creating Heroku app '${APP_NAME}'..."
    heroku create --stack cedar --app "${APP_NAME}" \
        --buildpack https://github.com/oortcloud/heroku-buildpack-meteorite.git
fi

heroku config:add ROOT_URL="http://${APP_NAME}.herokuapp.com"

# Make sure you have a verified account to enable the mongohq:sandbox add-on
heroku addons:add mongohq:sandbox

# Visit: https://addons-sso.heroku.com/apps/${APP_NAME}/addons/mongohq:sandbox
open "https://addons-sso.heroku.com/apps/${APP_NAME}/addons/mongohq:sandbox"

# - Click 'add a database user'
# - Enter a user name and password, and click 'Add user'
# - Click 'Overview' tab

# Set the following variables appropriately, based on the user name, password, and
# values within the 'Mongo URI' string in the Overview tab
export MONGO_DB_HOST='kahana.mongohq.com'
export MONGO_DB_PORT='db-port'
export MONGO_DB_NAME='db-name'
export MONGO_DB_USER='db-user'
export MONGO_DB_PASS='db-pass'

# Calculate connection string and URL:
export MONGO_DB_CONN="${MONGO_DB_HOST}:${MONGO_DB_PORT}/${MONGO_DB_NAME}"
export MONGO_DB_URL="mongodb://${MONGO_DB_USER}:${MONGO_DB_PASS}@${MONGO_DB_CONN}"

# If you have mongo client installed, verify the connection:
export MONGO_CMD='mongo'
"${MONGO_CMD}" "${MONGO_DB_CONN}" -u "${MONGO_DB_USER}" -p"${MONGO_DB_PASS}"

heroku config:add MONGO_URL="${MONGO_DB_URL}"

# Verify configs look okay:
heroku config

# Configure a public/private SSH key pair in order to perform builds:
export HEROKU_RSA_NAME='[email protected]'
export HEROKU_RSA_FILE=~/.ssh/"${HEROKU_RSA_NAME}"

# If creating the keys for the first time:
[[ -f "${HEROKU_RSA_FILE}" ]] || {
    ssh-keygen -t rsa -f "${HEROKU_RSA_FILE}"
    ssh-add "${HEROKU_RSA_FILE}"
}

heroku keys:add "${HEROKU_RSA_FILE}.pub"

# Deploy the Meteor app via Git and the custom build pack:
git push heroku master

# Any errors?
heroku logs

# Make sure the Heroku app is running using one web dyno:
heroku ps:scale web=1

# Test the app
heroku open
like image 164
Dejay Clayton Avatar answered Jan 10 '23 01:01

Dejay Clayton


Use this, works like a charm.

https://github.com/oortcloud/heroku-buildpack-meteorite

like image 24
Kristoffer K Avatar answered Jan 10 '23 02:01

Kristoffer K