Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WJ-1187] Automatic reload on configuration change #1626

Merged
merged 34 commits into from
Sep 29, 2023
Merged

Conversation

emmiegit
Copy link
Member

cargo watch will rebuild deepwell when any watched files change. However this can take a bit even if no source files have changed, as it rebuilds the binary. I have implemented a feature, -w or --watch-files, which will restart the process (via self-exec) if the configuration TOML file or anything under locales changes. This option is CLI-only, and is not found in the configuration files. It only applies to a local feature flagged build only.

However, I cannot get this to work with Docker. None of the events are coming through like with a local instance.

For now, I have re-enabled the cargo watch approach for deploy, and changed to use the RecommendedWatcher (inotify on linux). (If you want to try to get this to work on Docker, keep in mind PollWatcher must be used, and you need to disable the -w [path] flags in cargo watch.) This works fine, but is slower. To use -w you can manually stop the container and then run deepwell locally on your host machine. This will restart on file change nearly instanteously, it's quite nice.

Also log command line before executing.
Gets absolute path from env::current_exe().
inotify isn't working with Docker mounts it seems. This also cuts out a
middleman crate.

I have to rename the feature to 'watch' for this to work.
PollWatcher isn't working across virtual mounts for some reason.
@emmiegit emmiegit self-assigned this Sep 29, 2023
@codecov
Copy link

codecov bot commented Sep 29, 2023

Codecov Report

Merging #1626 (3b50c6b) into develop (6fb106a) will decrease coverage by 41.29%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #1626       +/-   ##
===========================================
- Coverage    42.87%   1.58%   -41.29%     
===========================================
  Files          328     120      -208     
  Lines        10048    4603     -5445     
===========================================
- Hits          4308      73     -4235     
+ Misses        5740    4530     -1210     
Flag Coverage Δ
deepwell 1.58% <0.00%> (-0.03%) ⬇️
ftml ?
Files Coverage Δ
deepwell/src/api.rs 0.00% <0.00%> (ø)
deepwell/src/config/special_action.rs 0.00% <0.00%> (ø)
deepwell/src/main.rs 0.00% <0.00%> (ø)
deepwell/src/config/args.rs 0.00% <0.00%> (ø)
deepwell/src/config/object.rs 0.00% <0.00%> (ø)
deepwell/src/endpoints/misc.rs 0.00% <0.00%> (ø)
deepwell/src/config/file.rs 11.29% <0.00%> (-0.38%) ⬇️
deepwell/src/watch.rs 0.00% <0.00%> (ø)

... and 209 files with indirect coverage changes

In anticipation of WJ-1188.
@emmiegit
Copy link
Member Author

thanks @Zokhoi

@emmiegit emmiegit merged commit 2f5a7bd into develop Sep 29, 2023
@emmiegit emmiegit deleted the WJ-1187-reload branch September 29, 2023 13:16
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.

2 participants