-
Notifications
You must be signed in to change notification settings - Fork 22
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
chore(containers): refactor deployment #754
Draft
lusergit
wants to merge
8
commits into
edgehog-device-manager:feature/application-management
Choose a base branch
from
lusergit:chore/refactor-deployment
base: feature/application-management
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
chore(containers): refactor deployment #754
lusergit
wants to merge
8
commits into
edgehog-device-manager:feature/application-management
from
lusergit:chore/refactor-deployment
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
Tests will not pass for now as the infrastructure is not complete yet |
aeb462f
to
a7b9556
Compare
7d244f6
to
dbd3464
Compare
acd3ce3
to
4b1c9b7
Compare
21640d9
to
2680b1e
Compare
``` mix ash.gen.resource Edgehog.Containers.Image.Deployment \ --default-actions read,create,update,destroy \ --uuid-primary-key id \ --attribute pulled:boolean:required:public \ --relationship belongs_to:image:Edgehog.Containers.Image \ --relationship belongs_to:device:Edgehog.Devices.Device \ --timestamps ``` Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
``` mix ash.gen.resource Edgehog.Containers.Container.Deployment --default-actions read,create,update,destroy --uuid-primary-key id --attribute status:Edgehog.Containers.Container.Status:required:public --relationship belongs_to:container:Edgehog.Containers.Container --relationship belongs_to:device:Edgehog.Devices.Device --timestamps ``` Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
``` mix ash.gen.resource Edgehog.Containers.Network.Deployment --default-actions read,create,update,destroy --uuid-primary-key id --attribute created:boolean:required:public --relationship belongs_to:container:Edgehog.Containers.Network --relationship belongs_to:device:Edgehog.Devices.Device --timestamps ``` Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
``` mix ash.gen.resource Edgehog.Containers.Volume.Deployment --default-actions read,create,update,destroy --uuid-primary-key id --attribute created:boolean:required:public --relationship belongs_to:container:Edgehog.Containers.Volume --relationship belongs_to:device:Edgehog.Devices.Device --timestamps ``` Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
moving containers resources to appropriate subfolders, refactoring according to the rest of the project structure Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
Setting up generated resources Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
782716f
to
f4d7dc5
Compare
The new `*.Deployment` resources are being used Moves the deployment logic to the `*.Deployment` resources and sets them as state machines, signaling errors when single resources are not deployed correctly Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
generated migrations for the new structure and resources with ``` mix ash_postgers.gen_migrations deployment_refactor ``` Signed-off-by: Luca Zaninotto <luca.zaninotto@secomind.com>
6a686fa
to
f56110f
Compare
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.
During the development of the
containers
feature we were prioritizing speed over project structure. This PR aims to refactor the existing code to be more comprehensible and understandable. The main changes are the new*.Deployment
resources and thecontainers
resources placementContainers structure
Each resources represented in the db has its own folder in the
backend/lib/edgehog/containers
folder, containing the changes, the manual actions and all the things needed for that particular resource. Each resource now has aDeployment
module, representing the many to many relation between the resource and the devices.Deployment
sDeployment
module, which is themany_to_many
relation between the resource and the device.:state
attribute, representing the current state of the resource on the device. The state is updated trough the trigger handler and does not enforce a particular transition system between the states. This is done because we might lose some messages in the communication with the device and this way the backend can cope with the situation rather than throwing errors and not handling the situation correctly.:created
means the resources has been created in the database:sent
means that the backend has correctly sent to astarte the informations for the device to create the resource, will then be astarte responsible to actually send the informations to the device itself.