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?
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='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
Use this, works like a charm.
https://github.com/oortcloud/heroku-buildpack-meteorite
To those having trouble with the bash: node: command not found issue, I went through that too and I solved it by deleting the Procfile.
Apparently, the Procfile indicates Heroku to run the app using node main.js but node is not a valid command since it is not included in the PATH varialbe, or similar.
By deleting the Procfile, Heroku detects that the app is a meteor app and runs it using the node binary with the full path.
Sorry for posting an answer instead of a comment, but my reputation doesn't let me comment.
Also, remember the ROOT_URL must be set begining with http://
I am running two Meteor applications on Heroku (both apps are connected to mongolab, so external MongoDB instances).
Here I have documented how I did it:
.../how-to-deploy-meteor-on-heroku-with.html
Related
I am using Heroku toolbelt:
Command line: >heroku create app1 (root application)
Delete app1 from Heroku Dashboard in the browser.
Command line: >heroku create app2 (from the same root application)
I wanted to add variable: heroku config:set MYVAR=value
Then I get the error:
Setting MYVAR and restarting app1... !
! Couldn't find that app.
How can I switch to the new app (app2) and remove app1 completely?
Try destroying the old app:
heroku apps:destroy app1
Note that this will permanently and irrevocably destroy app1.
You can change the app from app1 to app2 by using
heroku git:remote -a app2
heroku apps:destroy --app app1 --confirm app1
heroku git:remote -a app2
USE heroku git:remote which adds a git remote to an app repo
USAGE
$ heroku git:remote
OPTIONS
-a, --app=app the Heroku app to use
-r, --remote=remote the git remote to create
--ssh-git use SSH git protocol
DESCRIPTION
extra arguments will be passed to git remote add
EXAMPLES
set git remote heroku to https://git.heroku.com/example.git
`$ heroku git:remote -a example`
set git remote heroku-staging to https://git.heroku.com/example-staging.git
`$ heroku git:remote --remote heroku-staging -a example`
open your Dashboard and select the app you want to delete.
Now that you are in the desired application click on the Settings tab.
Scroll to the bottom of the page and click the "Delete app..." button.
Follow the onscreen instructions to confirm the apps deletion.
cradits:- Google search top result
I'm trying to set up Phoenix 1.2 so that I have two Heroku environments: one for dev/testing (which will keep the this-app-12345.herokuapp.com url), and a standard production environment.
Currently, I set up my app the usual way:
mix phoenix.new my_app
cd my_app
mix ecto.create
mix ecto.migrate
git init && git add . && git commit -m "Initial commit"
heroku create
This gives me a Heroku instance:
Creating app... done, ⬢ first-instance-12345
https://first-instance-12345.herokuapp.com/ | https://git.heroku.com/first-instance-12345.git
I then add the buildpacks, change the config/ files and run git push heroku master and everything works.
Now I'd like to create another Heroku instance, to which I can also deploy. If I run heroku create again, I get:
Creating app... done, ⬢ second-instance-23456
https://second-instance-23456.herokuapp.com/ | https://git.heroku.com/second-instance-23456.git
If I replace the url in prod.exs with the new instance...
config :my_app, MyApp.Endpoint,
http: [port: {:system, "PORT"}],
url: [scheme: "https", host: "second-instance-23456.herokuapp.com", port: 443], force_ssl: [rewrite_on: [:x_forwarded_proto]],
...and then commit and run git push heroku master, it will still deploy to first-instance-12345.herokuapp.com, which isn't what I want.
Re-running buildpacks doesn't help either.
$ heroku buildpacks:add https://github.com/HashNuke/heroku-buildpack-elixir
▸ The buildpack https://github.com/HashNuke/heroku-buildpack-elixir is already set on your app.
$ heroku buildpacks:add https://github.com/gjaldon/phoenix-static-buildpack
▸ The buildpack https://github.com/gjaldon/phoenix-static-buildpack is already set on your app.
Is there a standard method (or any method) to get Phoenix to deploy to multiple heroku environments? (And hopefully specify which one/s on deploy)
The standard way to deploy an app to multiple Heroku apps is to add multiple remotes to the repo and push to the one you want to deploy to. Making that change to config/prod.exs will have no effect on where the app is deployed.
Here's how to add the two remotes:
$ git remote add first https://git.heroku.com/first-instance-12345.git
$ git remote add second https://git.heroku.com/second-instance-23456.git
Now you can deploy to the first one using:
$ git push first master
and to the second using:
$ git push second master
Certainly the best way to do so is to have two different instances as #dogbert wrote.
Also remember about changing Procfile for heroku, because you want to run app using different environments eg.
# Procfile for prod
web: MIX_ENV=prod mix phoenix.server
# Procfile for dev
web: MIX_ENV=dev mix phoenix.server
For both environments you would need to apply migrations:
heroku run MIX_ENV=<env> ecto.migrate
I've an existing project that works fine on another machine, but I've just upgraded and from within the project development directory, everytime I run a heroku command I have to post-fix it with --app
I feel like I've missed an application setup stage, but I can't figure out what, as everytime it states:
Run this command from an app folder or specify which app to use with --app APP.
Help appreciated.
You can solve this by adding the Heroku app to your .git/config folder.
If you are in the root of your project, run the following command:
git remote add heroku git#heroku.com:appname.git
This will set a line in your .git/config file which the heroku command line tool uses to figure out what app you're using :)
In other words, your local repo doesn't have Heroku app URL configured against an app name
Similarly what we do with git remote add ( we pass git URL as a destination for push/pulling of code )
that how our git know which repo/URL to hit (push/pull from )
Heroku also follows the same method/process.
All you have to do is add Heroku app URL (so that ur Heroku command have a reference for app URL )
it will know against which URL you are running your command against
To confirm if remote named Heroku has been set for your app:
git remote -v
if not configured or if you want it for an existing app
heroku git:remote -a app_name
it's a way to link your folder to the Heroku app
The Heroku recommended way:
heroku git:remote -a my-heroku-app-id -r what-i-want-to-call-it
Source: https://devcenter.heroku.com/articles/git
Run this command from an app folder or specify which app to use with --app APP
The other answers address the first part of that statement, it is perfectly acceptable to run heroku commands in any directory. For example I have a customer facing front end project /front-end and a rails based /back-end project. I often work in the /front-end directory and if I have to connect to the production database I'll run heroku run rails c -a back-end. After I exit irb then I'm back in my desired directory.
How do you specify the app you want when you log in to Heroku from the command line?
I was trying to check the logs so when I first logged in I tried:
Heroku logs
this then told me:
! No app specified.
! Run this command from an app folder or specify which app to use with --app <app name>
I then tried:
heroku --app my-appname
but i get:
`--app` is not a heroku command.
I have tried all combinations.
You still need to include the command:
heroku logs --app app-name
You can also use -a instead of --app:
heroku logs -a app-name
Another option is to associate your (git) project to Heroku. From heroku open - no app specified:
$ cd app-dir
$ heroku git:remote -a app-name
$ heroku logs
Try this:
heroku git:remote -a [app_name]
This should allow you to call commands without having to specify which app you want them to be called on.
You could try adding --app app-name after you sentence.
Example: $ heroku domains:add your-domain --app app-name
Heroku CLI automatically detects the app name by scanning the git remotes for the current working copy.
If you're not in the app's local git clone, you need to specify the app name:
heroku logs --app app-name
or
heroku logs -a app-name
or by specifying the remote name:
heroku logs --remote production
You can reference this part of the Heroku documentation:
https://devcenter.heroku.com/articles/using-the-cli#app-commands
From my tests the Heroku CLI will infer the app from the current Git remote.
So to change to the "test" app:
git config heroku.remote test
And to come back to the default "heroku" application, which is probably your production app:
git config heroku.remote heroku
Not sure this is a good idea though...
For future solution seekers-
The error says a possible solution.
Run this command from an app folder
cd to the app directory root, then run your desired command.
I create a heroku app and then my machine crashed. I have a new machine. How do I attach my existing app to heroku app. When I visit heroku page the url for my app is like this
git#heroku.com:myapp.git
I can't do clone this app because I already have myapp from github. So I need to add heroku as remote to my existing github app. Anyone knows the syntax.
If you've heroku toolbelt:
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
Credits: user101289's solution
Else if you don't have heroku toolbelt:
First do this:
git remote add heroku git#heroku.com:{heroku-app-name}.git
Then do this:
git push heroku master
heroku open
If you're using the Heroku Toolbelt, the newer syntax is
heroku git:remote -a project
See this for more.
If you're using just Git without installing the Heroku Toolbelt, you can also create a new application.
Login to your account and go to this link
https://dashboard.heroku.com/apps
Look at the plus sign on the top right corner then select
Create new app
Leave the application name blank to let heroku choose one for you.
Let say your heroku app name is new-app-xxxxx, so to test on adding a file in to it you may try the following command:
git clone https://git.heroku.com/<new-app-xxxxx>.git
cd <new-app-xxxxx>
echo "my test file" > test.txt
git add .
git commit . -m "my test on commit"
git push
Put empty (blank) when the Git prompt for username, and your API Key for the password. You can get your API Key by showing it from the link below.
https://dashboard.heroku.com/account
Note: You cannot authenticate with the Heroku HTTP Git endpoint using your Heroku username (email) and password. Use an API key as described here.