How to stop heroku build in progress - node.js

I accidentally added npm start in the heroku post build process so now the build progress is stuck.
I did git push heroku master the build started normal and my server started as it should when running npm start, but because the npm start was in the post build it never finished. Because I'm on free account I only have one concurrent build process and because of the one stuck I can't build new version.
I already tried heroku ps -a APP_NAME and then heroku ps:kill web.1 for the single process that was running, but it didn't help.
ty

Heroku has a CLI Plugin with which you can manage your builds.
heroku builds -a example-app # take note of the build ID you'd want to display
heroku builds:cancel <id> -a example-app
In case anybody reading this might still need it!

Related

deploying node application on existing heroku app

I'm trying to deploy me node application which is running sucessfully running on localhost. For this, I have installed heroku cli on my machine, and I'm opening GIT cli to do the following:
Heroku Login -- successful
git push heroku master -- trying to push to an existing heroku app.
I've already deleted the heroku app it is refering to. Still it is pointing to the same app.
Even after reopening the git cli, it is pointing me to that and push is failing (git push heroku master)
Here the question is,
How to point my git to a newly created heroku app (everytime I'm creating a new app not knowing the command to point to the existing app)
Thanks in advance.
The easier way to add your heroku app remote reference is running the command below from your git folder:
heroku git:remote -a name-of-your-heroku-app
to verify if the remote heroku ref was correctly added you can run:
git remote -v
When running the application using the heroku open command, facing the following issue. Any clue where i went wrong..?
2018-11-12T18:59:19.888307+00:00 app[api]: Scaled to web#1:Free by user *********#email.com
2018-11-12T18:59:19.867050+00:00 app[api]: Deploy 77ec2d50 by user *************#email.com
2018-11-12T18:59:25.456322+00:00 heroku[web.1]: Starting process with command node mp3.js
2018-11-12T18:59:29.846039+00:00 heroku[web.1]: State changed from starting to crashed
2018-11-12T18:59:29.848349+00:00 heroku[web.1]: State changed from crashed to starting
2018-11-12T18:59:29.804086+00:00 heroku[web.1]: Process exited with status 127
2018-11-12T18:59:29.620089+00:00 app[web.1]: bash: node: command not found

Heroku, triggering a deploy, after installing buildpacks [duplicate]

I would like to deploy a Heroku app which will be done ideally using git push -u heroku master. However this will only work if there are any pending commits to be pushed to master.
How can I redeploy the app while there is nothing to push ? I tried git push -u heroku master -f and still get the same below
Branch master set up to track remote branch master from heroku.
Everything up-to-date
PS: I also want to retain the existing app, which means I cannot make use of this answer https://stackoverflow.com/a/22043184/968442
Normally setting a config var causes your application to be restarted. In most situations there should be no need to redeploy after doing this.
If you really do need to trigger a new deployment you can add a new empty commit, then push to Heroku again:
git commit --allow-empty -m "Trigger Heroku deploy after enabling collectstatic"
git push heroku master
The new empty commit is a regular commit. It has a hash, an author, a timestamp, etc. It will have the same tree as its parent. This should cause Heroku to build your app slug again using the same code as the previous commit.
It's a bit awkward, but it works.
You can do it from UI as well!
Login to your Heroku dashboard and go to deploy section
Find Manual deploy option
Hit Deploy Branch button!
Note: you must have your app connected to GitHub for this option to be available (see comment from Derek below).
There is now also a plugin for the Heroku command-line that allows you to re-release the most recently deployed slug.
See https://www.npmjs.com/package/heroku-releases-retry
It turns out there is a neat plugin for Heroku called heroku release retry that lets you retry the last deploy without resorting to adding bad commits to your repository.
// install plugin
heroku plugins:install heroku-releases-retry
// retry release
heroku releases:retry --app {your-app}
Source: https://www.darraghoriordan.com/2019/03/02/heroku-push-failed-force-rebuild
You can run heroku restart --app app_name and you are good to go.
This worked for me, it did an actual build and release without any commit, contrary to one other post that only does a release:
heroku plugins:install heroku-builds
heroku builds:create --source-url https://user:token#api.github.com/repos/<username>/<repo name>/tarball/master/ --app <app-name>
Source: https://help.heroku.com/I3E6QPQN/how-do-i-force-a-new-deploy-without-adding-a-commit-to-my-github-repo
For stop the heroku app uses :
$ heroku ps:scale web=0
And for start it uses :
$ heroku ps:scale web=1

How to Deploy MEAN stack to my hosted server?

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?

how to deploy nodejs on heroku

Hi I developed a small application in nodeJs and angular using the angular-fullstack generator for grunt, following the instruction on: https://npmjs.org/package/generator-angular-fullstack, when I finished the developement run:
3) yo angular-fullstack:deploy heroku
4) cd heroku && git push heroku master
my application now is on heroku and the dynos starts, but when I visit the domain where heroku put my application: http://dollsdresses-gnosis.herokuapp.com/
I can see that some files are missing: main.css, script.js , all I can see is a white page with my favicon, when I use my application on my computer, running: grunt server, it works, so I think there is something that I do not know or do wrong on deploying on heroku.
You may not have added main.css, script.js et al to git, so they are not pushed to Heroku when you run git push heroku master. Make sure to git add them.

What is Procfile? and Web and Worker

Is it necessary to give 'worker' information in Procfile? If yes then what it is actually? I have already added web: node server/server.js detail in the Procfile.
Procfile is a mechanism for declaring what commands are run by your application’s dynos on the Heroku platform.
From Process Types and the Procfile, which is a good introduction, but basically you use the Procfile to tell Heroku how to run various pieces of your app. The part to the left of the colon on each line is the process type; the part on the right is the command to run to start that process.
Process types can be anything, although web is special, as Heroku will route HTTP requests to processes started with the web name. Other processes, such as background workers, can be named anything, and you can use the Heroku toolbelt to start or stop those processes by referring to its name.
So, in short, worker is not necessary, unless you want to run some other process in the background by controlling process with the heroku ps command.
You would only need a 'worker' entry in your Procfile if you plan on using some sort of background job system (i.e. queuing long running tasks for later). Heroku has more information here:
https://devcenter.heroku.com/articles/procfile
I was following Udemy course regarding nestjs and aws Elastic Beanstalk to deploy however it keeps failing to deploy until I created Procfile with following:
web: npm install && npm run-script build && npm run-script start:prod

Resources