Best practices for Heroku deploy if you have an actual build process? - node.js

I have a build process involving templating and file copying, which produces what I would like to deploy to Heroku.
But Heroku requires to push your source from a git repository.
What I currently see as my only option is to have a separate git repository, that only holds my build history.
My project is a NodeJS server application.
Is there a better approach?
Thanks.

I have create a grunt-init project template that simplifies the develop-build-deploy cycle of NodeJS server apps deployed on Heroku.
Here it is: https://github.com/nicroto/grunt-init-heroku
This will allow you to have a single repository for your server & client apps, AND do actual build work.
I am basically creating an ignored by git build dir, which I synch-up with your Heroku app. And of course scaffold the project with sample init, build and deploy scripts.
I hope this will be helpful to the community. :)

Related

trouble deploying full stack application on heroku

I have made a full-stack app with react js and node js with express and MongoDB but I am having a little bit of difficulty deploying I first tried to deploy the front end but I was getting the invalid host header coming up when I tried to deploy in Heroku its been tested and works fine in the dev environment.
But also my application has two separate git repos one for the back and one for the front end and every tutorial I have seen to deploy they always have the client in the same folder as the server.
Can someone either tell me how to deploy or point me in the right direction on how to deploy.
What you have to do for React/Express/Node/MongoDB is,
build your frontend app first by using "npm run build". This will create a build folder under your app folder.
move your "build" folder to backend app folder.
update your backend app to use "app.use(express.static('build'))".
Then you can push your code to git and Heroku and try to deploy it.
There should be some tutorials available on Heroku website.

How to deploy React app to Prod and how to manage version control

Quick background: I'm a java web developer. I deploy my apps in EARs. I'm not familiar with how the build process works for the new JS frameworks like ReactJS. I have been using WebPack as a build tool but only in dev. I'm trying to keep up with the growing tech because my company is slowly adapting to it.
Question 1
How does the build process work when deploying a React app to a prod app server (or any server at that)?
I'm guessing Node will have to be installed on the app server with WebPack as a globally installed package so when the app is ready to be built, WebPack will kick off its build script in the package.json file that will create your bundle.
Question 2
If the above ^^ is somewhat correct, how do you kick off the WebPack build script?
My company uses IBM's Rational Team Concert as version control. RTC uses Ant scripts as their build so I'm guessing since we have a Spring Boot API that uses Gradle, we can tell the Ant script in RTC to run the Gradle script so the Spring API will build. Right before the Gradle build ends, Gradle can kick off the WebPack build script that will create the bundle.js. And from there you should have a full functioning frontend service just like you would when developing it.
This whole process has a been a headache to wrap my mind around and would like to get some clarification because there's only so much I can research without pulling all of my hair out. I hope I'm somewhat close to the correct way this process works.
In new version webpack (>=4) added new options mode for set environment. For get more information read this tutorial
webpack conf for production
and about deploy (ci,cd), webpack required before build, after build you don't need any js tools (SSR other case). Just create archive (project_${branch_name}.zip) and upload some store like gitlab, awsS3, etc and download when deploy.
I'm recommend don't mixing ui with backend if it possible split project other repository.
Note that RTC has multiple build definition templates. ANT is just one of them. You can also use the Maven build template, the Command Line as well if using the Jazz build engine. If its connected to Hudson/Jenkins for its build functions, you can use those as well.

Deploy meteor app with git / repository?

I've been searching around the web to see what's the best/simplest way to deploy a meteor app, and have found that Meteor Up has been the easiest way to do this.
However, I've been noticing that this works pretty awesome on small apps, now that one of our apps has grown larger than 250mb, Meteor Up has to build and deploy the whole 250mb app again and again for even the smallest change.
With other node applications we have on digital ocean, a simple git pull does the trick without having to re-upload the entire application.
Is there a way to maintain a meteor application with a github/bitbucket repository?
Thanks!
Well, I have found a solution for this.
Reference: PM2 + Meteor Environment Setup
Using meteor build and following the README that it generates, I was able to run the bundle without using meteor up.
This helps at deploying since it skips the process of uploading the entire bundle to the server, instead, just use git pull in the server to pull your code changes and use meteor build to create the build and run it with pm2.

Node Application on Azure using Teamcity?

How can I deploy Node application on Azure. I was reading this article, however my deployment scenario is different.
My node applicaiton is using git as version control. Gulp as task automation. Teamcity as continuous integration server.
When I checkin, teamcity runs all the build steps defined using gulp, which include unit tests and creating optimised (js minify, concatenation, angular template cache etc.) build for node applicaiton. The optimised build created by Teamcity need to be deployed on Azure under iisnode. Can't deploy using git push as the generated build isn't a git repository.
Anything to point in the right direction is appreciated.
Thanks

How to deploy nodejs, express, socket.io application

I have worked on a project and its in my local.
I have used express framework with socket and other packages.
I'm new to this and not sure what deployment options we have.
I see some options like AWS, Heroku and etc.
Heroku looks simple.. but at one of the step they are asking to publish to git and clone from there..
I was wondering why do we need to publish to git to deploy it to production.
Currently I have my app in my machine and I run usually by node app.js.
I'm not using any data bases. Can any one guide me how do I go about it?

Resources