Closed NicolasMahe closed 6 years ago
@antho1404 We should prioritize this issue as its a breaking change for services. Once done, I think we could release the v1.0.0
I think we could use directly the id of the image to start the service:
sha256:aeec6785cdcbf58c637b8381b291abdd103f015ecc54bba8bc5ffb393fabba62
So we don't even have to tag image.
Maybe we don't even need to store the tag of the image in the .mesg
. If the image is the same, docker should build with the same image id.
My idea was really to inject this directly and the user don't have to put anything in the mesg.yml
.
Of course we still need to be able to add extra dependencies or be able to customize the service dependency so i was thinking of something like that
name: 'xxx'
configuration:
volumesfrom:
- ethereum
dependencies:
ethereum:
image: ethereum/client-go
volumes:
- /root/.ethereum
command: --syncmode=light
and this will generate a service with the equivalent details
name: 'xxx'
dependencies:
service:
image: sha256:....
volumesfrom:
- ethereum
ethereum:
image: ethereum/client-go
volumes:
- /root/.ethereum
command: --syncmode=light
like that we keep the dependencies and we can inject the image but still have the possibility to customize everything if we want to but if it's a simple service we have nothing to do about dependencies or configurations
The only problem with this solution is that it is not a direct binding between the data in the database and the service file but for now we don't even plan to go from the database to a yml file so I don't think it's a problem and if it is there is simple ways to fix that.
Proposal
When building service image with the cmd, we should generate a unique tag that include a hash of the service, the
mesg/service-
prefix and the name of the service. Then this tag should be either injected in the mesg.yml or at least in the struct of the service before starting it. Maybe this tag can be inject in a.mesg
file and in themesg.yml
add a reference. We should also manage the version of the tag.Solution
Inject image tag in a
.mesg
file. Use a special variable/keywork to reference the tag in themesg.yml
Automatic 'replacement' when reading themesg.yml
with the value in the.mesg
.mesg.yml
:.mesg
Service struct after reading the
mesg.yml
and.mesg
: