enhance(docker): template update on page refresh - #145
Conversation
dev to staging
staging to prod
Mounts ./service/templates into the authenticator container so templates can be edited and refreshed without rebuilding the image.
90763cf to
0f66b07
Compare
|
This alone didn't enable hot reload, I also had to add this at line 26 in models.py: |
|
@gcurbelo123, true. I shouldn't have said "live reload". I've renamed the PR to instead describe accurately what it does. My intent was not automatic reload, but just to make page refresh result in latest template. |
Mounting templates alone did not hot-reload them; Flask also needs TEMPLATES_AUTO_RELOAD enabled to re-read template files per request.
|
@gcurbelo123, sorry. Fixed now. I misunderstood your comment as a request for auto reload on file change, but it is a bug1 report. Footnotes
|
wesleyboar
left a comment
There was a problem hiding this comment.
Important
This is used on prod. Make it dev-only.
Technically that docker-compose is used to build in jenkins. So an extra
- ./service/templates:/home/tapis/service/templatescould introduce out-changes we don't want if it gets built on an unclean repo. And there could be local issues if a user directly publishes.
— @NotChristianGarcia
I'm not against the dev
docker-composechange. But it might be possible to add a new Makefile target calledmake devormake localfor the reload explicitly? The build job makesmake buildcurrently. So just something to be aware of.
— @NotChristianGarcia
Overview
When developing locally, template edits should be reflected on page after page refresh without needing to rebuild the image, so I mount the local
./service/templatesdirectory into theauthenticatorcontainer.Caution
This
docker-compose.ymlis used on production, so I must instead:docker-compose.local.pyChanges
./service/templatesvolume mount toauthenticatorservice indocker-compose.ymlTesting
service/templates/UI
Test.Docker.Volume.Mount.of.Templates.mov