-
Notifications
You must be signed in to change notification settings - Fork 185
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
feat(system-service-deployer): introduce new system service deployment system [fixes NET-487] #1623
Merged
Conversation
This file contains 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
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
folex
reviewed
Jun 5, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done!
Maybe remove |
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
reviewed
Jun 16, 2023
folex
approved these changes
Jun 16, 2023
This was referenced Jun 20, 2023
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.
system-service-deployer
. Installs all system services.Atm in the pr there are some after-testing stuff (like crates with "-test" suffix) that I didn't remove yet, but I'll do it.
Some description of the PR.
Service Configuration
Service configuration for
aqua-ipfs
anddecider
is moved to the node's config:UPD: added enabled services
We may additionally list the system services we want to be deployed. By default, we enable ALL system services.
Note that atm newly disabled services aren't removed yet
Default values that we use in our network are used as default values, so right now, we don't need
to change the config in the nox-distro.
However, configuration for
trust-graph
(fluence certificates) is distributed within the crate, sincewe decided that this configuration is part of the
trust-graph
and not of the node.Old ENVs are supported now and overrides the configuration file.
System Service Distribution
There's no unified approach for this atm since I don't know how to provide a unified library for it.
I come up with the following approach. These structures are now created at the system service deployer
It's a slightly more difficult situation for spells since we need somehow to provide initial values from the node's config
in the format for a spell to understand.
Atm for
decider
, we provide a structure with the config to the decider distro crate; the crate takes the valuesand returns us
SpellDistro
with spell-compatible KV init data.I also wanted to create a
PackageDistro
which would unite spells and services of one package (like withdecider
),but it doesn't unify properly because of the need to initialize
aqua-ipfs
andtrust-graph
.Running deployer
System services deployment happens after running the main node loop. This is required for subscribing
system spells.
There's no specific reason for it. Maybe we need to move it to the main node loop, to the initialization phase,
where all the node's subsystems are started. This will allow us to stop the node easily if the system service deployer
fails.
ATM if the deployer wasn't able to deploy everything on the first try, it will stop trying again, and will do nothing
I will change it in the following PR.
Deployment process
Atm we need to install 3 stand-alone services and 1 spell with an aux service:
aqua-ipfs
, requires initialization with local and external api multi addresses of an IPFS node, provided in the node config; note that these values aren't very much in use in our spells, maybe we can remove themregistry
trust-graph
, requires initialization with the Fluence certificates distributed with the servicedecider
and itsconnector
, require a load of initial values for the spell provided in the node config; theconnector
itself doesn't need any initializationDeployment of every service and spell happens similarly:
In the code, the 1 and 2 steps are united in one function,
deploy_system_service
anddeploy_system_spell
.Find existing services and spells
The rule is simple: two services/spells are the same if they share the same alias.
For services, if the new blueprint is different from the old one, install a new service
For spells, we don't compare blueprints, only scripts, and trigger configs. If the script or the config
is different, we update the spell.
Remove old service/spell
If we found existing service/sepll and detected that we need to update it, now first we will remove the old instance.
For services, we just plainly try to remove a service.
For spells, first, we try to unsubscribe them from the triggers. We use the same function as for
Spell.remove
. If removing fails,we try just to unsubscribe the spell and update its trigger config to an empty trigger config to avoid resubscribing on restart.
ATM we install a new service/spell despite how the removing processes ended
I think we will change it in the following PRs.
Service/Spell Deployment
Service installation doesn't require much:
For spells:
Spell.install
)System Service Owner
The owner of system services (aka controller) is the node itself, services are controlled by
HOST_PEER_ID
.Management PeerId is used only for assigning aliases.
This is done with way because
worker_id
andowner_id
in the current node implementation are considered to be the same entities.It would be nice to be able to control the system services with Management PeerId.
Initialization
Initialization happens after installation. It's not a unified process, it requires manual
implementation. For example,
aqua-ipfs
requires to set API multiaddr by calling two functionsset_local_api_multiaddr
andset_external_api_multiaddr
; on the other hand,trust-graph
wants us to call
set_root
with an address of a root node and also callinsert_cert
forevery provided certificate from the provided array.
Previously, service initialization was implemented via air scripts which were provided by the services.
We removed this for the node's simplification.
One of the approaches to unify this initialization step is to ask for the services to provide
setup
orinit
functions, so the system deployer could do smth likeCons:
Service Calls
During the deployment process, we use
as TTL for the service calls.
So, ATM if the service is too long to call, the whole initialization will fail. Good to know, right?
Questions
HOST_PEER_ID
asworker_id
for the system services? Can't assign Management PeerId.