heroku deploy and view a node.js app - node.js

I'm getting lost in the heroku documentation but I've basically finished the following steps and now I want to view the webpage showing the app (not on my local machine but on the web).
1) I've used package.json to specify the build of my node.js project
2) I've used a pipeline to connect my github project black-tomcat-dev/heroku-node-test to my main heroku app so once I update my own github repo it updates the main project.
3) Ive created express.js routing command to get to make a cool page that creates smileys.
**EDIT How does the pipeline work How can I push code from my black-tomcat-dev repo to the test environment in my main heroku app
This is a heroku, node.js and github question.

Pipelines in Heroku is basically a collection of individual Heroku apps. All the apps literally shares the same code between each other. It is similar to Continuous Delivery. Where it flows like
Review --> Development ---> Staging ----> Production
As you have connected GitHub with Heroku already, for every pull request, Heroku will automatically create an app (here, review app).
When you merge the pull request to master branch in GitHub, Heroku will automatically deploy the branch to Staging.
From the staging, you need to promote your app to production. This can be done either from Heroku environment or through command line - heroku pipelines:promote
Since you have only one app, this doesn't require pipeline. So, once you deploy to Heroku, you can directly open the app using command line:
heroku open -a <your_app_name_here>

Related

Should I deploy my Nuxt app directly to Google App Engine or should I use Gitlab CI/CD where my code is present in repository?

I want to deploy my nuxt app to App Engine. And I am confused which method I should go for.
I have tried deploying directly using gcloud app deploy command. It works. But when I make changes and deploy again it makes another version of my project in app engine. And I guess all the files are uploaded again instead of files modified or newly created. Correct me if I am wrong about this.
Or should I go for Gitlab CI and link my master branch with app engine so whenever I make changes in Gitlab the changes gets automatically reflected.
I want to know if Gitlab also makes new version of app whenever it is updated.
Both alternatives will be creating a new version.
This allows that the changes can be rolled back in an easier way in case something breaks your application.

Concurrently JS application pipeline install and build hangs (Express js for server, Create-React-App for Client)

Problem: I have a project with a server (Express Server that handles file uploading and deleting) and client (Front End Create-React-App). The project structure looks like follows:
Root Folder With Server
Client Folder
Each folder has it's own package.json. Server Package.json. Client package.json
I'm trying to build and deploy onto azure however the pipeline hangs on "npm install and build".
It seems like the build succeeds but this phase just hangs. Here is my server.js (the routes are not included) file and yaml file just in case.
I'd appreciate any kind of help. Thank you!
Troubleshooting suggestions:
In the case of ensuring that the code in github is consistent with the local code, if an exception occurs, it is recommended to replace the linux platform and redeploy.
It is recommended to use my suggestion to recreate the repository, and then check the Action status in github.
Sum up:
In general, it is more appropriate to use Linux in azure than windows. For example, Linux supports npx, and may also support other packages and commands.
When the local code can run normally, there is generally no problem when deploying to github, unless there may be modifications, which we have ignored. So make sure the code is consistent.
General correct deployment steps:
First in the portal, make sure to create a web app application (not a static web app), and select the node environment.
Make sure that the sever program can run normally locally. Create a new repository in github.
->git init
->git add.
->git commit -m'init'
->git remote add origin https://github.com/{your name}/newAppname.git
->git push -u origin master
Connect in the Portal's Deployment center.
Then check the status of Action in github.

Simple node.js app deployment on DigitalOcean from GitHub

I have a node.js application on my Github. Right now I am using Heroku for hosting it but I want to give DigitialOcean a try (the $5/month is more affordable).
I am used to using Heroku, where I just go create an app > connect it to my github account > deploy from the master branch > boom app deployed.
When I signed up for DO and started exploring it seemed way too much and too many steps to get my app deployed. I researched around to find a simpler way (similar to one I follow in Heroku) but all the blogs and YouTube videos go through the same tedious process.
I know I am being lazy but I just need a few clicks app deployment. Does anyone know a better (smarter) way I can deploy my app on DO from Github?
It will not be as easy with Heroku. It is always tempting to use cheaper services like Digital Ocean or Vultr and pay only fraction of the price (especially using coupon links that can make it free for months - Digital Ocean, Vultr) but having your own VPS means that you need to manage it yourself. Simplifying that process is what you pay for when you're using Heroku. But it doesn't have to be that bad.
Here is a good tutorial on how to do it:
https://www.distelli.com/docs/tutorials/build-and-deploy-nodejs-to-digitalocean/
And see this list of tutorials - search for those with "deploy" in the title:
https://www.digitalocean.com/community/tags/node-js?type=tutorials
Basically you have few options that I would consider here:
A semi-manual deploy with git - You can install a git server on your VPS and push to it whenever you want to deploy a new version
Automatic deploy with git - You can add a deployment process to you CI scripts that will do what you do manually in (1) but after all tests pass
You can trigger a pull from git on the server with ssh or a custom API
You can do (3) in your CI scripts
You can add a custom webhook in GitHub to notify your server about new version and your server may then pull the code and restart
You can add a custom webhook in CI and do the same as in (5)

Updating Parse Server Example in Heroku

I have managed to use Parse Server on Heroku for quite sometime now using this guide.
https://devcenter.heroku.com/articles/deploying-a-parse-server-to-heroku
however I would like to use the dashboard but my parse server is 1.6, is there a way to update my parse server from heroku?
I assume you deployed parse-server to Heroku simply by using the Deploy button on the Heroku website. If so you can manually fetch the changes of parse-server-example from the original repository onto you computer and push them back to heroku.
Clone the current deployment of parse-server from Heroku to your computer
Add the original parse-server-example as a remote repository from https://github.com/ParsePlatform/parse-server-example.git
Fetch the changes from the remote repository that you've added
Merge
Push to heroku
Note:
Parse Server is currently at 2.2.9. If you have a live app it would be recommendable to test if your app still works after the update in a test environment prior to the production environment .

Development server with Heroku?

I'm building a Node.js application and I'm using Heroku as my host. I want to be able to maybe have a development subdomain for my app where I can test changes before I push it into production. It'd be great if I could do something like git push heroku dev, and access my prerelease code at dev.myapp.heroku.com or something similar. Is something like that possible without having to set up an entirely separate app? If not, how would I configure the toolbelt to push to 2 different Heroku apps from different branches of the same repository?
I usually just create another app for staging
then add the remote for the new app like
git remote add staging https://git.heroku.com/staging.git
then you can push your development branch to the staging master branch like
git push staging development:master
i think it's actually kind of nice to have 2 different apps, so you can try out new settings or addons without messing with your production instance.
you can always add a dev.yourapp.com as a domain for this app, then point your dns to it. here is a link to a detailed way to do that
https://devcenter.heroku.com/articles/custom-domains#add-a-custom-domain-with-a-subdomain
Very easy. Use Heroku Pipelines.
You put your Dev app and your Production app in a pipeline (you might want to also add a Staging app in the pipeline - up to you).
The you push to your dev app from your development environment.
Test everything in the dev app, and when you're satisfied, you simply "Promote" the compiled slug to the next phase in the pipeline.

Resources