heroku: Deploying angular app inside spring boot app - heroku

I've one repo sunixi and it has two projects sun-angular(angular) and sun-admin(spring boot) in ts-admin i'm building ts-angular via executions and moving dist into resources/static of sun-admin project after that i'm building the sun-admin. On local enviroment it is working fine but how can i do same in heroku deployment.
structure of repo
sunixi
---sun-angular
---sun-admin
in sun-admin i'm setting workingDirectory as ../sun-angular but while deploying to heroku i'm getting
Cannot run program "npm" (in directory "/tmp/build_02607c07/sun-angular"): error=2, No such file or directory

If you are using a monorepository strategy, an option is to use subdir buildpack to select where is the path of your folder: https://github.com/timanovsky/subdir-heroku-buildpack
If you want to deploy backend and frontend in the same heroku app, the project folder should contains a npm package. Otherwise, i will not work.

Related

Laravel 9 replies "Vite manifest not found" on production server

When I deploy a Laravel 9 project to production, Laravel replies:
Spatie\LaravelIgnition\Exceptions\ViewException: Vite manifest not found at: /var/www/.../public/build/manifest.json in file /var/www/.../vendor/laravel/framework/src/Illuminate/Foundation/Vite.php on line 139
It turns out the files in /public/build folder are not committed in the git repository, thus missing on production server.
Should I?
Install npm on production server and run npm run build to generate the manifest files, or
Include the manifest files (e.g. manifest.json) of /public/build folder into my repository and pull them in production server ...
You can add buildpacks (scripts that are run when your app is deployed. They are used to install dependencies for your app and configure your environment) on Heroku which will allow you to run npm. Well, easy does it on Heroku.
But if you happen to be on Fortrabbit, where you can't run npm or vite in ssh. The simplest way is to build your assets locally (npm run build or vite build) and push them to production.
Make sure you comment the public/build folder in .gitignore before pushing it to production. This might work for a lot (almost) of servers including Heroku without adding buildpacks.
Should this fail, make sure your APP_ENV is set to production APP_ENV=production or anything else except local as the documentation of vite states.

Prevent building backend in Heroku when frontend is modified

Hello i have a repository with the following structure:
/backend
/frontend
I want to allow Heroku builds and deploy only when changes are made in backend subdirectory.
I have configured heroku build pack : https://github.com/timanovsky/subdir-heroku-buildpack.git
Adding the env PROJECT_PATH=backend
Heroku successfully builds the subdirectory "backend" (when pushing my branch) but the problem is that it is also building and deploying when a changes are made in the "frontend" subdirectory.

Bundling NuxtJS dist directory using go:embed

I have a web app using a NuxtJS frontend being served from a Golang web micro-service.
I am using go:embed dist to ship the frontend assets into the web binary and running it all in a Docker container. For non-Gophers, go:embed is a directive that bundles files or directories into the Go binary. It's a compile error to use go:embed on a directory that doesn't exist.
Usually, you don't commit the dist directory to VCS, but if I don't, then all my CI builds fail because I cannot compile the web service since dist doesn't exist.
I tried adding a .gitignore inside the dist folder like this:
*
!.gitigore
I was hoping this would commit the empty dist folder to VCS, but still not commit any of the assets. This worked fine, until I ran the NuxtJS build and it deleted the .gitignore. I assume it deletes the whole directory and recreates it.
Does anybody know whether there is a configuration option to keep the dist folder around between builds, or at least to not delete the .gitignore within it?

How to deploy an angularcli-meteor project on Galaxy?

Using angularcli-meteor, how to deploy an angularcli-meteor application on Galaxy since the meteor project itself is inside the "api" folder?
I have the same question in mind for a ionic 3 application, your API folder is a meteor project so you can deploy it on galaxy. And then host your Angular app else where if you make sure that your DDP_DEFAULT_CONNECTION_URL points to this galaxy server.
You can set it DDP_DEFAULT_CONNECTION_URL in bundler.config.json don't forget to re-generate your meteor-cliend-bundle.js file (npm run meteor-client:bundle) before deployment.

jhipster : angularjs files and browser cache

I am developping a Jhipster web app.
My problem is that when I update some angularjs files and then deploy the new war file in Tomcat7 the modifications are not taken into account, the clients pc is still reading the old angularjs file.
Is there a way(or a jhipster configuration) to tell the client pc to reload all angularjs file in order to be up to date?
Thanks you.
When you build your app with prod profile using mvn -Pprod package or gradlew -Pprod bootRepackage the web assets are minified and prefixed with a unique code in dist folder. An older version of same file has a different prefix so if it is cached it will not prevent the new one from being loaded.
If you don't see this behavior, it's probably because you didn't set the spring.profiles.active property to prod in Tomcat and so your app is running in dev mode and not using the files from dist.
If your frontend and backend are in the same war: 0.0.1-SNAPSHOT change this version in pom.xml before making a build to avoid angular caching issues.
If your frontend is split then go to: gulp/utils.js and change this version: '0.0.5-SNAPSHOT';

Resources