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

Configure services with envs #641

Merged
merged 14 commits into from
Dec 20, 2018
Merged

Configure services with envs #641

merged 14 commits into from
Dec 20, 2018

Conversation

krhubert
Copy link
Contributor

No description provided.

service/inject_definition.go Outdated Show resolved Hide resolved
service/start.go Outdated Show resolved Hide resolved
@antho1404
Copy link
Member

From @krhubert in discord:

  • parameter is not the best option for keeping env definition (as env is something different) it would be better to start it with array (name and optional as subkey)
  • due to parameter we need to introduce EnvValues in service.Dependency to keep values
  • it would be nice to have default so it could be easily deploy

I agree, seeing the dev, it adds a lot of complexity for nothing. I don't see any sufficient reasons to keep that.
Just having something like that would be enough

configuration:
  env:
    - FOO=bar

This is the same as docker compose https://docs.docker.com/compose/environment-variables/
I like the way they manage their env (and the substitutions)

@mesg-bot
Copy link
Member

This pull request has been mentioned on MESG Community. There might be relevant details there:

https://forum.mesg.com/t/configuring-services-with-deploy-time-or-run-time-arguments/124/11

api/deploy.go Show resolved Hide resolved
api/deploy.go Show resolved Hide resolved
commands/provider/service_deployer.go Show resolved Hide resolved
commands/provider/service_deployer.go Show resolved Hide resolved
commands/service_deploy_test.go Show resolved Hide resolved
@@ -244,6 +250,7 @@ message DeployServiceRequest {
string url = 2; // Git repo url of service. When url provided, stream will be closed after the first receive.
bytes chunk = 3; // Chunks of gzipped tar archive of service. If chunk provided, stream should be closed by client after all chunks sent.
}
map<string, string> env = 4; // Env used to deploy service.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs to be inside oneOf since it's not sent in every message.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why, can you explain more?

I don't want to put it inside one of as it's not one of option to deploy, but a separate parameter

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onOf syntax does not stand for optional values in gRPC. We need it exactly for the same reason explained in the docs. https://developers.google.com/protocol-buffers/docs/proto3#oneof. env variables needs to be in the oneOf section, they're not sent in the every message of the stream.

Copy link
Contributor

@ilgooz ilgooz Dec 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#641 (comment)

solved by 59b574f:

deploy api now has 3 fields(inside oneOf):

  • options
  • url
  • chunk

these fields should be sent to service in the following order.

  • options must be sent as 1th(not required to send when options aren't provided).
  • url or chunks must be sent as 2nd (if chunks chosen, client should close the stream after all chunks sent) or as 1th when options aren't provided.

this flow is much easier to implement by the server and gRPC clients(our consumers).

interface/grpc/core/deploy.go Outdated Show resolved Hide resolved
interface/grpc/core/deploy.go Outdated Show resolved Hide resolved
@ilgooz
Copy link
Contributor

ilgooz commented Dec 14, 2018

I recommend merging this PR first #642. It'll be used by this PR.

@krhubert krhubert force-pushed the feature/passing-env branch 3 times, most recently from 2e458e9 to 385671d Compare December 14, 2018 17:14
service/service.go Show resolved Hide resolved
service/service.go Outdated Show resolved Hide resolved
x/xos/env.go Show resolved Hide resolved
service/dependency.go Outdated Show resolved Hide resolved
service/service.go Outdated Show resolved Hide resolved
service/service.go Show resolved Hide resolved
service/service.go Outdated Show resolved Hide resolved
@ilgooz
Copy link
Contributor

ilgooz commented Dec 19, 2018

I've applied all the requested changes in a new PR #654. We should merge it to this one before continuing.

@NicolasMahe
Copy link
Member

@ilgooz I would like to merge this PR to dev as it is and improve it with multiple small PRs.

@mesg-bot
Copy link
Member

This pull request has been mentioned on MESG Community. There might be relevant details there:

https://forum.mesg.com/t/configuring-services-with-deploy-time-or-run-time-arguments/124/15

@ilgooz ilgooz merged commit 92c8c63 into dev Dec 20, 2018
@NicolasMahe NicolasMahe deleted the feature/passing-env branch December 20, 2018 12:03
@mesg-bot
Copy link
Member

This pull request has been mentioned on MESG Community. There might be relevant details there:

https://forum.mesg.com/t/configuring-services-with-deploy-time-or-run-time-arguments/124/17

@mesg-foundation mesg-foundation deleted a comment from mesg-bot Dec 27, 2018
@mesg-foundation mesg-foundation deleted a comment from mesg-bot Dec 27, 2018
@mesg-foundation mesg-foundation deleted a comment from mesg-bot Dec 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants