Cant deploy app to Heroku node modules too big - heroku

My node modules by itself take up 500MB.
Heroku only allows 500MB. My complete app is about 700MB. What do web developers do to deploy their app and bypass this problem? It seems create-react-app downloads so much node modules to where it is almost impossible to deploy the app.

Try adding /node_modules to your .gitignore.

Related

How do Node Modules get added when deploying after pulling project from GitHub

I have never deployed a Laravel app before and am trying to figure something out.
I have a project that has Node Modules. Of course, when I push to Github, the Node Modules are not included. I have seen some videos on YouTube where someone uses Forge and pulls their GIthub project which doesn't include their Node Modules. Forge automatically runs composer install and runs the migrations. But, they never run npm install. I must be missing something. How do the Node Modules get into the deployed project? Or, are the Node Modules simply used to compile the assets and therefore are not needed on the production server?

installing electron app is too slow because of native dependencies that need installing into user end pc

I have an electron app with 2 package.json files.
The root/package.json has all devDependencies, and the root/app/package.json has all dependencies which is necessary for app running.
So I package app folder using electron-packager, then build installer for windows using inno setup.
But when I install the app, because the node_modules in app has too many dependencies, the installer is so slow in order to extract all contents from node_modules.
Other apps cost 3-10s for installing, but mine 25-35s.
So what should I do for this? Maybe I can bundle the js using webpack before packaging?
Thanks.
You should absolutely use something like webpack (or equivalent) to bundle your application. Webpack does an excellent job at tree-shaking your dependencies and only keeping the resultant necessary modules.
I have already posted a possible solution for electron projects, including a build process approach that leads to installation building. My particular recommendation leaned on utilizing Wix for MSI deployment but the build process items are still applicable (steps 1-6) for anyone wanting to understand a possible process for the items important to doing this work (even if you use another installer). Hope this helps:
https://stackoverflow.com/a/46474978/3946706
Are you packaging a web app into electron? The slow packaging time is probably because of bundling web node modules into the electron app which is not necessary.
https://medium.com/#hellobharadwaj/electron-plus-angular-react-why-use-2-different-package-json-files-361ae47d07f3

How do you deploy build artifacts to Heroku from Codeship?

In starting a new project, I put together the skeleton for a Node app that has tests and generates some build artifacts, like asset compilation and compression. I have the tests running in Codeship so successful builds initiate a deploy to Heroku. They've made it all super easy, except I can't find any way to deploy built files, just a copy of what's in the repo.
Has anyone done this successfully? I feel like writing a custom deploy script to rebuild the assets after the tests and manually deploy them would be working against the existing toolset, and I know can't possibly be the first person to want to do this...
Turns out that Codeship doesn't keep anything, in fact, different servers do the deployment than the testing. It seems that the best-practice here is to recreate the assets on the Heroku side with a custom buildpack, which, directly after the git pull, does the dependency installation and compiles the app slug.

Deploying clean meteor 0.9 to heroku

I am creating a very small and clean meteor app and have recently updated to v0.9 of meteor to be able to get rid of meteorite as "package manager".
For me it is really important in a way not to have any deployment specific stuff wired up into the sourcecode if it is possible.
What I am trying to do in a way is to have a good and clean Continuous Integration running. Right now I am using Codeship to run the tests and then push to heroku. But since I updated top meteor v0.9 there not seems to be a working buildpack.
Is it a reasonable way to create a buildpack on my own? That one would not have to do more than just install node, npm and meteor. Or is there another way to have the app bundled on a "build server" (can codeship do that?) and then have it somehow pushed to heroku as normal node.js app with all the necessities and dependencies?
Concerning the buildpack way:
I have been trying to install meteor via
curl https://install.meteor.com | /bin/sh
But when I run
meteor deploy --directory deploy
I get
bundle: You're not in a Meteor project directory.
This buildpack (which I authored) works for meteor >0.9 using meteor's native packager; no meteorite:
https://github.com/AdmitHub/meteor-buildpack-horse
You could start off with the existing buildpack (or one of the many forks of it).
It should be relatively easy without meteorite since you would no longer have to worry about it, its just getting rid of meteorite and updating the version of node. https://github.com/oortcloud/heroku-buildpack-meteorite
Regarding deploying to heroku. meteor deploy is meant to deploy to *.meteor.com or via Meteor's upcoming commercial product. Deploying to heroku is also relatively easy.
Deploying to heroku is setting up the buildpack, adding the git remote and git pushing to it. Also easy, perhaps easier, than meteor deploy.
During the git push process heroku will take your meteor app, bundle it, download node and run it (as in the buildpack). It's quite easy that way. One nice thing without meteorite is I imagine the build process is much faster.

How to install plugins on Redmine hosted on Heroku.com

Just pushed redmine to the heroku platform,
though I can't get the backlog-plugin to work, it works just fine locally.
I have pushed the local database to heroku aswwell.
Heroku's public directory is not writable. But a default Redmine assumes/requires so, as on start of the app server it copies static assets from the plugins (like images, javascripts, css) to the public/plugin_assets directory. On Heroku, this obviously fails. And as backlogs relies heavily on javascript, it's really noticeable.
A common work-around is to copy these assets manually before deploying. This can be done by running your config locally once and checking the copied assets into source control which is then deployed to Heroku.
Notice that public/plugin_assets is included into the default .gitignore, so you need to remove that from there obviously.

Resources