我试图将我的流星0.6.3应用程序部署到heroku我尝试使用https://github.com/jordansissel/heroku-buildpack-meteor.git它只支持流星0.5.9我还尝试将我的应用程序捆绑在.tgz文件中,如流星文档所建议但不是能够部署我不断检测到无雪松应用程序?
答案 0 :(得分:6)
我必须做一些工作才能让Meteor 0.8.2正确部署到Heroku。我发布了适合我的一系列步骤。如果您愿意,可以将其转换为参数化的Bash脚本。
# 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='id_rsa@herokuapp.com'
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
答案 1 :(得分:4)
答案 2 :(得分:1)
对于那些遇到bash: node: command not found
问题的人,我也经历了这个问题,我通过删除Procfile解决了这个问题。
显然,Procfile指示Heroku使用node main.js
运行应用程序,但节点不是有效命令,因为它不包含在PATH varialbe中,或者类似。
通过删除Procfile,Heroku检测到该应用程序是一个流星应用程序,并使用具有完整路径的节点二进制文件运行它。
很抱歉发布了答案而非评论,但我的声誉不允许我发表评论。
另外,请记住ROOT_URL
必须以http://
答案 3 :(得分:0)
我在Heroku上运行两个Meteor应用程序(两个应用程序都连接到mongolab,因此外部MongoDB实例)。
我在这里记录了我是如何做到的: .../how-to-deploy-meteor-on-heroku-with.html