Add URL configuration to Docker images#674
Add URL configuration to Docker images#674nrichers merged 4 commits intomainvalidmind/documentation:mainfrom nrichers/sc-8752/investigate-passing-in-environment-variablesvalidmind/documentation:nrichers/sc-8752/investigate-passing-in-environment-variablesCopy head branch name to clipboard
Conversation
02a303f to
458bca1
Compare
7c43a2a to
9d7a08e
Compare
PR SummaryThis pull request introduces several enhancements to the Docker configuration for the ValidMind documentation site. The key changes include:
These changes allow for more flexible deployment of the documentation site, enabling dynamic configuration of URLs based on the deployment environment. Test Suggestions
|
PR SummaryThis pull request introduces several enhancements to the Docker configuration for the ValidMind documentation site. The key changes include:
These changes aim to improve the flexibility and maintainability of the documentation site deployment, particularly in containerized environments. Test Suggestions
|
nibalizer
left a comment
There was a problem hiding this comment.
One note and one question.
Q: What are the startup time implications? Just a couple seconds or more? Does failing to template hard crash the server or just some links are broken?
@nibalizer just checked and the script adds <10 seconds to the startup on my Mac with whatever default resources Docker Desktop assigns.
We should fall back to the public defaults but if even this fails, you just get some URLs that 404. I verified this during script development. |
…ronment-variables
validbeck
left a comment
There was a problem hiding this comment.
This looks good to me, but the last time I checked any self-hosted stuff was not to be exposed to users/in general docs release notes, and the way this PR is tagged will have the notes show up in our collation.
|
A PR preview is available: Preview URL |
This is a good point — but the Docker image also has uses beyond self-hosting. I rewrote the release notes to mention testing during development, similar to how you can run the frontend on localhost, or accessing the full docs site locally. |
Internal Notes for Reviewers
This PR lets you configure the Docker image for our static docs site via Kubernetes manifest or a config file.
Two parameters can be configured, documented in URL configuration for Docker:
Configure via Kube manifest: <<< SPENCER, VERIFY THIS WORKS BEYOND MY BASIC TESTING? 🐹
Configure via
config.json, generated with the Docker image:How it works
A new
_quarto-docker.ymlprofile includes pre-render and post-render steps to generate a documentation site with configurable URL placeholders. When Docker starts the container image built from this docs site, the placeholder URLs are then replaced with the URLs you specify (or safe fallback URLs), making the site configurable.Pre-render
We replace the relevant URLs in
_variables.ymlwith unique placeholders that containconfigurable-urland generate aconfig.jsonwith the default URLs:Found URLs in _variables.yml: VALIDMIND_URL: https://app.prod.validmind.ai JUPYTERHUB_URL: https://jupyterhub.validmind.ai Successfully generated config.json from _variables.yml Modified _variables.yml with placeholder values: VALIDMIND_URL: https://app.prod.validmind-configurable-url.ai JUPYTERHUB_URL: https://jupyterhub.validmind-configurable-url.aiPost-render
We restore _variables.yml.
Docker startup
When you start Docker after building the image, an entrypoint script configures the site using:
config.jsonHow to test
gh pr checkout 674 cd site make docker-buildOutput in
site/_siteshould now show placeholder URLs that containconfigurable-url. For example:Next, start the Docker image:
Opening up the site on http://localhost:4444/ in your browser should show the actual, correct URLs specified in
config.json.Inspect http://localhost:4444/developer/get-started-validmind-library.html:
Inspect http://localhost:4444/developer/samples-jupyter-notebooks.html:
External Release Notes
You can now configure the Docker image for our static docs site via Kubernetes manifest or a config file. Two parameters can be configured:
This feature lets you configure the site’s Docker image to match your specific requirements, simplifying deployment in your own infrastructure.
You can set these URLs using one of the following supported methods: URL configuration for Docker