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

Issue on service deletion with alias #618

Closed
NicolasMahe opened this issue Dec 4, 2018 · 5 comments
Closed

Issue on service deletion with alias #618

NicolasMahe opened this issue Dec 4, 2018 · 5 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@NicolasMahe
Copy link
Member

NicolasMahe commented Dec 4, 2018

Here is a scenario that doesn't make sense:

➜  core git:(dev) ./dev-cli service deploy /Users/nico/Developments/MESG/services/service-bitcoin
✔ Service context received with success
✔ Image built with success
✔ Service deployed with ID: d95a83b25b51be82c38ee793ed15614d08b5b51d
To start it, run the command:
        mesg-core service start d95a83b25b51be82c38ee793ed15614d08b5b51d
➜  core git:(dev) ./dev-cli service list
ID                                          ALIAS                                        NAME       STATUS
d95a83b25b51be82c38ee793ed15614d08b5b51d    bitcoin                                      Bitcoin    stopped

I change something on the bitcoin service, then deploy again.

➜  core git:(dev) ./dev-cli service deploy /Users/nico/Developments/MESG/services/service-bitcoin
✔ Service context received with success
✔ Image built with success
✔ Service deployed with ID: 06e0d1c14c142b58de2b1ded3bad63bd4fe02948
To start it, run the command:
        mesg-core service start 06e0d1c14c142b58de2b1ded3bad63bd4fe02948
➜  core git:(dev) ./dev-cli service list
ID                                          ALIAS                                        NAME       STATUS
d95a83b25b51be82c38ee793ed15614d08b5b51d    bitcoin                                      Bitcoin    stopped
06e0d1c14c142b58de2b1ded3bad63bd4fe02948    bitcoin                                      Bitcoin    stopped
➜  core git:(dev) ./dev-cli service delete bitcoin
✔ service "bitcoin" deleted
➜  core git:(dev) ./dev-cli service list
ID                                          ALIAS                                        NAME       STATUS
d95a83b25b51be82c38ee793ed15614d08b5b51d    bitcoin                                      Bitcoin    stopped
➜  core git:(dev) ./dev-cli service delete bitcoin
⨯ can't delete service "bitcoin": rpc error: code = Unknown desc = database: service bitcoin not found
there was a problem with deleting some services
exit status 1

Alias should be unique.
Few ideas on how to solve it:

  • 1
    When deploying a new service, we should generate a new alias for the service that have the same alias. The new problem is the old service (now with a different alias) cannot access its volumes (it will have new volumes).
  • 2
    When deploying a service where its alias already exist in the db, we should remove the old service (and of course ask user to confirm).

I think idea 2 was the first implementation of anthony with the error "same alias".

@NicolasMahe NicolasMahe added this to the v0.5.0 milestone Dec 4, 2018
@NicolasMahe
Copy link
Member Author

I suggest to go with idea 2. But with new flag in the command deploy to force the deletion of the previous service. For the command dev, it could delete the previous service by default.

@NicolasMahe
Copy link
Member Author

NicolasMahe commented Dec 4, 2018

If we go with idea 2, it doesn't make sense to call it alias as it need to be unique.
I suggest the names UUID (Universally unique identifier) or SID (Service Identifier). And the current ID rename to Hash.

Of course, we will keep the possibility to use service without SID, because we will generate the SID with the Hash. (but i would not mind to do a breaking change and force service to set a SID).

I like SID, because with we could have different name every type of ID: UID for user, NID for node, etc.. it could be easier in the codebase to have different name for different data.

@NicolasMahe
Copy link
Member Author

By implement idea 2:

When deploying a service where its alias already exist in the db, we should remove the old service (and of course ask user to confirm).

Then SID / Alias can be use also for a basic versioning.
If a dev want to update previous version of its service and keep the volumes, then it should not change the SID / Alias. Only one version of the service could run at a time.
If a dev want to run the previous and the new version at the same time and also use new volume, then he needs to change the SID / Alias.
Eg:

sid: "bitcoin.v1"
// with a reverse domain name
sid: "com.mesg.service.bitcoin.v1"
sid: "com.mesg.service.bitcoin.v2"

And with the futur network, we could force the Service ID to have the public key of the developer :)

sid: "PUBLIC_KEY_OF_DEV.bitcoin.v2"

Also, we could implement in the futur a Version parameter, based on semantic versioning, and implement some rules (MAJOR.MINOR.PATCH):

  • if Major change, the volumes change. The previous major version of the service could still run at the same time as the new version
  • if minor or patch change, then the volume are the same. A previous minor or patch version of the service CANNOT run at the same time as the new version

@mesg-foundation/core what do you think?

@antho1404
Copy link
Member

antho1404 commented Dec 5, 2018

I don't understand why we should have unique alias, the goal is to have a single alias to help for the development but if now the alias need to be different for every deployment that's going back.

For me the problem here is that we have 2 versions of the same service (same alias).
The service is the same but the versions are not.
So for me there is two solutions:

  • Totally overwrite the previous service (and remove the ID associated to the alias that we want to add when we deploy a new version)
  • Keep all the versions and instead of having one alias for one id we would have one alias for multiple ids

I like the second version, @krhubert was talking about that here

It would be great if we can provide versioning along with alias.

and this was part of the initial proposal here

Key: ID (as defined in the mesg.yml file)
Value: Array of services hashes deployed, the first one is the latest deployment so it's easy to get the latest version and we don't necessary care about the old ones.

With versioning the workflow is the following:
If deleting an alias, we delete all the ids and the alias
If deleting an id, we delete the id but not the alias except if the list if ids attached to this alias is empty

I don't see how unique alias will be helpful here, it will be two different service but they are the same for the developer, it's just two different versions

@NicolasMahe NicolasMahe added bug Something isn't working high priority labels Dec 5, 2018
@NicolasMahe
Copy link
Member Author

Fix in #619

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants