mesg-foundation / engine

Build apps or autonomous workflows with reusable, shareable integrations connecting any service, app, blockchain or decentralized network.
https://mesg.com/
Apache License 2.0
130 stars 13 forks source link

Issue with the Instance create #1059

Closed antho1404 closed 5 years ago

antho1404 commented 5 years ago

Here is my service.json (got form the compiled command)

{"sid":"testservice","name":"test service","tasks":[{"key":"taskx","inputs":[{"key":"foo","type":"String","object":[]},{"key":"bar","type":"String","object":[]}],"outputs":[{"key":"result","type":"String",
"object":[]}]}],"events":[{"key":"event","data":[{"key":"x","type":"Any","object":[]}]}],"dependencies":[{"key":"nginx","image":"nginx","volumes":["/etc/nginx"]}],"configuration":{"volumes":["/volume/test/
"],"volumesFrom":["nginx"],"env":["ENVA=do_not_override","ENVB=override"]},"source":"Qmeuu7A7A8DERuRe8apL3kaHPaPtMrUrATcSDNuB2LW1bF"}

The deploy and start seems working

mesg-cli-dev service:newdeploy "$(cat service.json)"
mesg-cli-dev service:newstart testservice --env ENVB=1

but:

Logs on the service are not accessible because the engine cannot access the dependency.

mesg-cli-dev service:logs testservice

/Users/antho/prog/MESG/cli/node_modules/grpc/src/common.js:91
  let error = new Error(message);
              ^
Error: 2 UNKNOWN: Error response from daemon: service engine-d0a725b9672ae318983612c4913cade9fb58dfd9-nginx not found

The service is not running because the env variable (ENVB) needs to be changed when starting the instance (which should be done by mesg-cli-dev service:newstart testservice --env ENVB=1)

docker service logs mjddhxljgrv9

engine-c4f9f16d407ab5b6afd78ab052e221a988cb14a1-service.1.khfnci8o88nl@mesg-dev    | /app/src/index.ts:42
engine-c4f9f16d407ab5b6afd78ab052e221a988cb14a1-service.1.khfnci8o88nl@mesg-dev    | assert.notEqual(process.env.ENVB, 'override')
engine-c4f9f16d407ab5b6afd78ab052e221a988cb14a1-service.1.khfnci8o88nl@mesg-dev    |        ^
engine-c4f9f16d407ab5b6afd78ab052e221a988cb14a1-service.1.khfnci8o88nl@mesg-dev    | AssertionError [ERR_ASSERTION]: 'override' != 'override'
NicolasMahe commented 5 years ago

This issue was closed automatically but @antho1404 said it doesn't fix it completely in: https://github.com/mesg-foundation/engine/pull/1060#issuecomment-503837654

ilgooz commented 5 years ago

@antho1404 what's the not solved part with the previous PR? I tested that create with env vars is working well. The logs command doesn't work but it's just because it does rely on the old service api not instance