I am new to heroku and I am trying to create an app and deploy, but when i do heroku create on CLI this creates a random name for the application. So I used heroku app:create project-name which created the application with the project-name but how do i deploy my existing code to that application.
If you've already performed heroku create without specifying a name in your application folder then you will already have a git remote named heroku. You can confirm this by doing
git remote -v
in your project folder which will probably show something like
heroku git#heroku.com:stark-taiga-7738.git (fetch)
heroku git#heroku.com:stark-taiga-7738.git (push)
When you then create an application specifying an application name then the existing remote will not get updated with the new application details.
To fix this you will need to remove the existing git remote named heroku and then add a new one pointed to the correct application.
git remote rm heroku will remove the existing remote
heroku git:remote --app <new app name> will create a new heroku remote pointing at your new application will then let you do git push heroku master and deploy to the correct application.
Heroku uses Git to deploy. Navigate to the home directory of your application and simply do
git push heroku master
See the documentation for deploying a node.js application to Heroku for details.
Related
When I create a new Heroku app it gives me
https://obscure-plains-01212.herokuapp.com/
but this URL is not conventional to my app so I change the app name in the Heroku site buzzing-api and then Heroku gives me a new repository
https://git.heroku.com/buzzing-api.git
in stack its shows
Stack heroku-22 will replace Heroku-20 on the next deploy
So I try to re-deploy in my terminal but says
remote: ! No such app as obscure-plains-01212.
how can I add a new repository in the previous Heroku repository to avoid this error
You renamed the heroku app so your heroku repository url is also changed. But most probably you didn't change your heroku remote git url in your local project. Running these 2 commands should do the job:
git remote rm heroku
git remote add heroku https://git.heroku.com/buzzing-api.git
I'm trying to create two applications(NodeJS backend and ReactJS Frontend) using a VPS server with Dokku (mini Heroku) configured.
Basically, that's what i did so far:
Created a folder for the project on my VPS server for my project
Entered inside the folder previously created
Executed the following command:
git clone:<project_url_backend>
Then I entered the backend's folder created by the git clone command and then executed:
dokku apps:create backend-proj
git remote add dokku dokku#<my_ip>:backend-proj
git push dokku master
Everything looks fine until here and when I open the link that dokku created for the backend, it opens fine and I can use the backend correctly.
So I repeated the process for the frontend.
Inside the project's folder, i run:
git clone:<project_url_frontend>
I entered on the subfolder created by git and then run:
dokku apps:create frontend-proj
git remote add dokku dokku#<my_ip>:frontend-proj
git push dokku master
It builds fine, but when I open the created link for the frontend project, it opens the backend, not the frontend.
Ps: I had issues with the react project(frontend), so I had to fix the Procfile, and run the frontend project by a server.js with express.js, serving the react application. I don't know whether this might have some influence on the process but I had to say anyway
The problem was that I needed to put express.js as one of the required dependencies inside the package.json file. Then I recreated the application on Dokku and then it worked fine
I have a node.js app in a git repo that looks like this:
/docs
/server
.gitignore
The actual node app is in the 'server' folder, but both it and the docs are in the git repo seen above.
I went through heroku's instructions for creating an app, and have the heroku cli installed on my laptop.
I went into the server folder of my repo and ran heroku create and made sure there was a new remote for heroku afterward-- there was. I also made sure to run heroku buildpacks:set heroku/nodejs and it did so successfully. (I can see that in my heroku dashboard.)
But when I try git push heroku master I get the error in my post title.
Just for fun, I deleted my app on heroku and this time ran heroku create from the root folder, and not the server one. I also ran heroku buildpacks:set heroku/nodejs again. I double-checked the new heroku app name and remote and tried to push again. Unfortunately I got the same "App not compatible with buildpack" message.
Is all this because my git repo's root folder doesn't have a package.json file? Is there a way I can tell heroku, 'hey, look in the server folder for package.json when you're building'?
I have a great working website built with MEAN and works great locally.
i wish to deploy it on my server,
but i never deployed a website
other than uploading the files to my website ftp.
Tutorials anyone?
Another good starting point would be Digital Ocean, they offer a one click install MEAN stack, with tutorials. https://www.digitalocean.com/community/tutorials/how-to-use-the-mean-one-click-install-image
I have just deployed my MEAN Stack application on Heroku cloud application environment. The deployment steps are easy.
Steps to deploy:
Your mean stack project structure should be like this. This is very important step. The bottonline is your package.json and server.js should be under your root directory. Have a look at the link to know more about the structure.
Clone your remote repository locally i.e. git clone https://github.com/heroku/node-js-getting-started.git
Go inside the cloned repository e.g. cd node-js-getting-started
Run git add .
Run git commit -m "Sample"
Run Heroku login (It will ask you to press any key and then open up the browser and ask you to click login. After logged in closed the browser instance.
Run heroku create myApp --buildpack heroku/nodejs. Note: Buildpacks are responsible for transforming deployed code into a slug, which can then be executed on a dyno. More information
Run git push heroku master. Your deplyment will start.
Once deployment is done, you will see the complete deployment logs on command prompt terminal
The application is now deployed. Ensure that at least one instance of the app is running: heroku ps:scale web=1
Run heroku open. It will run your deployed instance.
Run heroku logs to view information about your running app. More information
You can find more details visiting following links:
https://devcenter.heroku.com/articles/getting-started-with-nodejs#prepare-the-app
https://devcenter.heroku.com/articles/deploying-nodejs
Start from here...
https://github.com/linnovate/mean#hosting-mean
What operating system do you plan to host it on?
I'm trying to deploy a simple Geddyjs (node.js) app to Heroku.
When I make a push a recive that error:
git push heroku master
Heroku receiving push
Heroku push rejected, no Cedar-supported app detected
What I have to do to that heroku detect the nodejs app?
couple of things did you do this for cedar you need to explicitly say this (I am sure you have done this but here for completeness)
heroku create --stack cedar
ensure that your package.json is at the root
heroku have a good article on this
You should now be able to
git push heroku master
Have you added Procfile and package.json to your local git repo. and committed them?
I had created them but forgot to add & commit them so when pushed these files weren't uploaded hence Heroku didn't know the type of app.
Adding, committing & re-pushing fixed this.
Obvious when you know:-)