Establish a convention for optional/default settings in .env files #359
Open
opened 2022-11-11 19:30:49 +00:00 by 3wordchant
·
9 comments
Labels
Clear labels
abra
awaiting-feedback
backups
bug
build
ci/cd
community organising
contributing
coopcloud.tech
design
documentation
duplicate
enhancement
fedi
fedi-infra
finance
funding
good first issue
help wanted
installer
legal
performance
proposal
question
security
test
wontfix
Everything to do with abra
Ping/pong on comms
Something is not working
Go build related issues
Getting the robots into the mix
Opening this thing up
Contributors stuff
Our main website
Design thinking required
Let's write things together
This issue or pull request already exists
New feature
Democratic decision making
Money things
Anything related to grant funding
Easy start with development
Need some help
Installation related issues
Performance related
Large change which requires feedback & decisin making
More information is needed
Securing our shit
Unit or integration test suite
This won't be fixed
No labels
documentation
Milestone
No items
No Milestone
Projects
Clear projects
No projects
Assignees
3wordchant
aadil (Aadil Ayub)
abra-bot (Abra Bot)
ammaratef45
amras (Sarma)
Apfelwurm
BornDeleuze
Brooke
carla
cas (Cassowary)
coopcloud
cyrnel
decentral1se (d1)
dede
devydave
fauno (fauno)
iexos
jade (Jade Ambrose)
jjsfunhouse
jmakdah2 (Jackie Makdah)
joe-irving (Joe Irving)
kawaiipunk (KawaiiPunk)
knoflook
kolaente
lambdabundesverband
linnealovespie (April)
moosemower
moritz
notplants
oxaliq (sorrel)
p4u1
pharaohgraphy (Andrew 🐦🔥❤️🔥✴️)
renovate-bot (Comrade Renovate Bot)
ripclap
simon
sixsmith (Sixsmith)
stevensting
trav (Trav Fryer)
val (val (he/him))
yksflip
Clear assignees
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: toolshed/organising#359
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Tales from coop-cloud/plausible!1:
If a recipe has an optional setting called
DISABLE_AUTH, with an implicit default offalse, should the contents of the recipe's.env.samplefile be:DISABLE_AUTH=false(to make the default explicit)#DISABLE_AUTH=false(to make the default explicit, and also show that it's optional)#DISABLE_AUTH=true(to show the likely change someone would want to make by settingDISABLE_AUTH)#DISABLE_AUTH=(to make the actual default value, where the variable is completely un-set, explicit)All sound fine to me. Some people are also doing
#FOO=and leaving it empty completely. As recipe maintenance becomes more widespread / decentered, I'd imagine several practices will emerge.I agree that it is nice to have as little possible to configure in order to get a working deployment up-and-running. Maybe this is a documentation thing in general? Each env var should have some explanation? I'm not sure.
Oh yeah good call, adding to the issue description to round out the options.
Yeah, I feel an "advice for
.env.samplefiles section of the docs emerging 🧙Starting with "Files should include sensible defaults, as far as possible -- operators should ideally not need to change settings to get a basic instance of the recipe running"..
..and continuing with "Every option should include some explanation of what it does, ideally linking to upstream documentation"
I would favor this way.
Makes sense to me!
I added
c82437da8f👍Setting different default values for the recipe could be done in the compose.yml and the .env variable can still be commented.
- FPM_START_SERVERS=${FPM_START_SERVERS:-32}Attempted recap of some conversation in coop-cloud/gitea!36, and Matrix.
We should also have some advice for:
1. When we want to set a different default in a recipe than upstream does
e.g.
GITEA_DEFAULT_USER_VISIBILITY=limited, where the default ispublicMy suggestion here would be to add a text comment in
.env.sampleexplaining what the upstream default is, and why we recommend a different one.2. When we add a new mandatory option to a recipe
e.g.
NGINX_ACCESS_LOG_LOCATION, where this is required for a container to launchSuggestion is, for these variables only (i.e. not for ones included in
.env.samplefrom the start), to use${NGINX_ACCESS_LOG_LOCATION:-foobar}(compose.yml) or{{ or (env "NGINX_ACCESS_LOG_LOCATION") "foobar" }}(golang template, e.g. config) to provide a fallback value – thus avoiding the need for a new Major recipe release just for the new setting.Optionally, these defaults could be removed after some sensible deprecation period, or with the next major recipe release.
I would additionally recommend to add a release note comment for every new different default value.
OK, I think there is enough of a precedent for the backwards compat approach to start recommending it officially. I have done that in https://docs.coopcloud.tech/maintainers/upgrade/. Feedback welcome.
There are still some additional nuances in #359 (comment) which I don't believe are documented. I guess we can leave this open still. Perhaps creating a table with a bit of systematic overview of when/where/why in relation to environment variable updates, would be helpful for others diving in.