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

Refactor osparc stack env-var handling #3635

Closed
3 tasks done
Tracked by #177
mrnicegyu11 opened this issue Dec 2, 2022 · 8 comments
Closed
3 tasks done
Tracked by #177

Refactor osparc stack env-var handling #3635

mrnicegyu11 opened this issue Dec 2, 2022 · 8 comments
Assignees
Labels
t:enhancement Improvement or request on an existing feature t:maintenance Some planned maintenance work
Milestone

Comments

@mrnicegyu11
Copy link
Member

mrnicegyu11 commented Dec 2, 2022

  • @pcrespov : Dump currently used env-vars for local oSparc [list of unset & total list] .
    • json-schemas of all service settings are produced as artifacts system-test-swarm-deploy_services_settings_schemas.zip on every build. SEE gh-actions in master.
  • @mrnicegyu11: Add osparc.local full variable configuration (including what is now known as optional / default values) for all deployments. repo.config of a deployment overwrites the (osparc.local) defaults.
  • @pcrespov : Change: All oSparc services fail if variables are unset
    • service fails to start if faulty config
    • adds a warning if settings field defaults to null (prevents situations in which typos in env-vars lead to null plugin settings that lead to shutting down plugins)
  • @mrnicegyu11 Remove env_file: - ../.env from services/docker-compose.yml in osparc-simcore and capture every single necessary env-var in the environment: section

Tasks

  1. t:maintenance
    pcrespov
  2. 5 of 5
    a:infra+ops a:services-library t:enhancement t:maintenance
    GitHK matusdrobuliak66
    pcrespov sanderegg
  3. p:mid-prio t:enhancement
    YuryHrytsuk
@mrnicegyu11 mrnicegyu11 self-assigned this Dec 2, 2022
@pcrespov pcrespov self-assigned this Dec 2, 2022
@pcrespov pcrespov changed the title Refactor env-var handling Refactor osparc stack env-var handling Dec 13, 2022
@pcrespov pcrespov mentioned this issue Mar 23, 2023
31 tasks
@pcrespov pcrespov added t:enhancement Improvement or request on an existing feature and removed enhancement labels Apr 12, 2023
@pcrespov pcrespov added the t:maintenance Some planned maintenance work label Jun 9, 2023
@pcrespov pcrespov added this to the Watermelon milestone Jun 12, 2023
@pcrespov
Copy link
Member

@mrnicegyu11 , my part is in principle done here. Let me know if you need extra from me.

@mrnicegyu11
Copy link
Member Author

thanks a lot

@mrnicegyu11
Copy link
Member Author

@pcrespov
Copy link
Member

Image

Image

@GitHK
Copy link
Contributor

GitHK commented Nov 10, 2023

I have some questions as a developer. When dealing with env vars, I usually end up with in the following situations.

  1. I define and env var in the settings of a service for internal usage. Does not require OPS value. I'd say that I will not expose/define it somewhere else. We have lots of these already
  2. I define an env var in the settings of a service and it is mandatory. This means that it requires a value from OPS.
    • Q1 where do I define it exacly?
    • Q2 where do I put my default for development?
  3. I define an env var in the settings of a service but it has a default in the code.
    • Q3 in theory I don't have to do anything else, do I still have to define it?
    • Q4 where do I put my default for development?

@pcrespov @sanderegg @YuryHrytsuk @mrnicegyu11 @matusdrobuliak66 thanks for you help in clearing this up.

@mrnicegyu11
Copy link
Member Author

re 1: ideally, no env-var should have defaults. So, to do it properly in this scenario, you should always NOT allow defaults and actually set the desired value as (what you call) "OPS value", always, even if it is considered internal usage.
re 2: This is the normal case. You put it in according to the docs made by @YuryHrytsuk . Your development default for now goes in the .env-devel of osparc-simcore
re 3: This should never happen, default values are not good practice.

@YuryHrytsuk please comment what I missed :--)

@sanderegg
Copy link
Member

sanderegg commented Nov 10, 2023

@GitHK
My understanding:

  1. not sure what is the point of having ENV variables for internal usage. what does this mean? why not just create some constant in the code then?
1. you need to define it in the osparc-simcore/services/docker-compose.yml file (such as MY_VAR=${MY_VAR})
2. you need to define it in .env-devel so that developers can work, and that osparc-simcore is **self-consistent**
3. you need to define that value in gitlab osparc-ops-environment-configuration (or whatever its name becomes @mrnicegyu11 @YuryHrytsuk ), in all the subfolders for all the deployments
  1. see 2. even if you define a default, please define it otherwise

@mrnicegyu11
Copy link
Member Author

This is done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t:enhancement Improvement or request on an existing feature t:maintenance Some planned maintenance work
Projects
None yet
Development

No branches or pull requests

5 participants