feat(swarm): register templates on startup automatically if not already registered #1185
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.
Description
At startup we check for every registered and active templates, then compare with what we have in templates folder and then we will register automatically all the missing templates. If any new template in the meantime added to the folder and not registered, at the next startup they will be registered automatically as well.
We have a new parameter to be able to pass to
start
command which is--disable-template-auto-register
which disables the automatic registration of templates from the templates directory (by default this feature is on).Motivation and Context
When we start from a fresh swarm (by deleting
<base_dir>/processes
folder) all the previously registered templates are gone and not registered again. We need to have the previously uploaded and registered templates already in place, so any test or anything can use them.How Has This Been Tested?
Prepare
<base_dir>/processes
folder (base_dir is mostly./data
)<base_dir>/templates
folder there is the previously uploaded.wasm
file (example:counter-wasm-e8bd952191282de51ecec1bfdcea1260db3c08bf3ff3b3b072484db4da7fe0c2.wasm
)Test
http://localhost:12072/templates
)Also tested the scenarios when I skip registration by passing the param above and checked also when I start multiple times without touching data directory whether the template is registered multiple times (it's not).
What process can a PR reviewer use to test or verify this change?
See test.
Breaking Changes