Dynamic Subpath Support for Deployment#197
Merged
BryonLewis merged 3 commits intomainfrom Jun 30, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This update should allow for dynamic subpath values that can be used for deploying the application.
Deployment Notes:
SUBPATH- New Environment Variable that needs to be added to the .env.prod.docker-compose or other deployment sections. If this is empty (SUBPATH=) it will fall back to old behavior. If it has a subpath it will be added to the client and django for all applications to provide a newexample.com/subpathfor all values./dev/.env.prod.docker-composeyou need to run the following command before building:source ./dev/export-env.sh ./dev/.env.prod.docker-composedocker compose -f docker-compose.prod.yml configto confirm that the client: build arguments have the SUBPATH setDev/Review Notes:
SUBPATHif empty it will use default deployment. If it has a value it updates the client build and the django runtime environment variables to support having a subpathsettings.pynow has two new settings that are changed based on the SUBPATH environment varaibleSTATIC_URL- dynamically set to make sure that static assests in swagger/login are updated to the newer subpathLOGIN_URL- the login page goeas to/oauthwhich redirects to/accounts/loginthis makes it so it redirects to{SUBPATH}/accounts/logininsteadurls.py- This is updated to prefix a path to all the endpoints that are used based on the SUBPATH environment variableSUBPATHasVITE_APP_SUBPATHbefore building so the vite knows what the subpath is.vite-config.js- Updates the base for vite config. This makes it so all assets reference/{Base}/assetinstead of direction referencing the asset so the system can handle a subpathrouter/index.tsthe routes need to have the same base value so they append thme to the beginning and sharing the url leads to the proper location.nginx.subpath.templatethat has templated values forsubpathin it that can be replaced using a shell script. This file is only used if the subpath is a non-empty valuesourcedusing the./dev/export.env.shscript before building. That is how these values are properly passed into the system.env.productionfile${SUBPATH}with the value and uses that as the /etc/nginx/nginx.conf. Then the dist directory is copied to /usr/share/nginx/html/{SUBPATH}/ to be served.