Skip to content

Prebuild webpage in Docker and load VUE_APP_CESIUM_TOKEN dynamically#465

Open
bedaberner wants to merge 2 commits intoArduPilot:masterfrom
bedaberner:master
Open

Prebuild webpage in Docker and load VUE_APP_CESIUM_TOKEN dynamically#465
bedaberner wants to merge 2 commits intoArduPilot:masterfrom
bedaberner:master

Conversation

@bedaberner
Copy link
Copy Markdown
Contributor

This PR is based in my desire to host this app in a low ressource (k8s) environment.

Currently the prebuilt docker uses npm run dev to host the app which triggers a very ressource intense rebuild of the page.
My goal was to precompile the app during the docker build process to get around this wasteful process.
To achieve this I had to:

  1. Use npm run build during the docker build process and set npm start up so it serves the precompiled page.
  2. As we don't recompile on every start anymore, VUE_APP_CESIUM_TOKEN has to be loaded dinamically on startup. This is the bunch of the changes in this PR.
  3. Add an error message if no VUE_APP_CESIUM_TOKEN is loaded as It took me a while to find out this was a problem.
  4. Change the Cesium asset as mentioned here How to load hi res imagery? #463 (comment) to and I think this fixes How to load hi res imagery? #463.
  5. Adapt the Documentation

Sorry for not splitting the changes nicely in multiple commits, I thought this would be a very easy fix but had to change more and more things

@bedaberner
Copy link
Copy Markdown
Contributor Author

@Williangalvani, could you take a look? I think this improves the deployment quite a bit.

@Williangalvani
Copy link
Copy Markdown
Collaborator

Hi. Will this break the current deployment workflow? With the current system, we can just deploy static files, no docker or backend required. The token is embedded into the build step, and we just rsync the files to the server.

@bedaberner
Copy link
Copy Markdown
Contributor Author

bedaberner commented Apr 3, 2026

Well yes and no:
In this proposed system, when you excecute npm run start generate-runtime-config.js is called which then creates a runtime_config file with the embedded token. While the generate runtime config script is obviously not static, the generated runtime_config file should be. You would therefore be able to generate it once and then copy the files.

I would however have to test this and document the procedure.

While I don't want to question how you host the Tool, I think deploying a docker Image is a much more modern approach and since there Is a dockerfile in this repository, I assumed that's how it is being done.

If this is not the case, It would be very helpful to document the constraints of the deployment of the code, as any contributer needs to keep these constraints in mind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

How to load hi res imagery?

2 participants