GoelBiju / Visualising-Optimisation-Data

COMP3000 Final Year Project - Visualising Optimisation Data
0 stars 0 forks source link

Fix Heroku deployment issues #43

Closed GoelBiju closed 3 years ago

GoelBiju commented 3 years ago

Description:

At the moment the build is failing due to the frontend package installation not finding the frontend-common library to install.

Acceptance criteria:

GoelBiju commented 3 years ago

One approach used to resolve the frontend-common not being found when Heroku runs install is by adding a heroku-postbuild which runs the build on all the workspaces. This is used in conjunction with the multi-procfile Heroku buildpack. Procfiles have been added to the frontend and frontend-plugin which sets the command to run on the web process on Heroku (which will serve the build).

GoelBiju commented 3 years ago

We serve the build folder for the frontend, similar to the way we serve for the plugin, instead of starting the frontend. If I start the frontend, the process exceeds the memory allocated. I am not sure why it exceeds the memory now and why it did not before when it runs npm start by default (unless it was serving the build?).

As a result of serving the build folder, we also need to specify the settings.json. The settings provided in the public folder needs to be copied over into the build folder when creating the build in Heroku.

GoelBiju commented 3 years ago

We serve the build folder for the frontend, similar to the way we serve for the plugin, instead of starting the frontend. If I start the frontend, the process exceeds the memory allocated. I am not sure why it exceeds the memory now and why it did not before when it runs npm start by default (unless it was serving the build?).

As a result of serving the build folder, we also need to specify the settings.json. The settings provided in the public folder needs to be copied over into the build folder when creating the build in Heroku.

I have added a REACT_APP_SETTINGS configuration variable in Heroku which will determine which of the settings files to use for production or development, depending on if it finds the config var.

GoelBiju commented 3 years ago

Deploying the application had another issue where the react-router link to the data page would not be recognised as we were serving a build. I have included a serve-build.js in the frontend to serve the build and redirect all requests to the index.html. This was indicated by looking through some similar problems.