Skip to content

docker: make settings fully configurable via env vars#3873

Merged
muxator merged 6 commits intoether:developfrom
sapkra:config-env-vars
Apr 21, 2020
Merged

docker: make settings fully configurable via env vars#3873
muxator merged 6 commits intoether:developfrom
sapkra:config-env-vars

Conversation

@sapkra
Copy link
Copy Markdown
Contributor

@sapkra sapkra commented Apr 16, 2020

  • Refactored docs for env vars using tables
  • Added new env vars for nearly all configuration options
  • Added possibility to set env setting to null using env vars

Please note: I was not able to test everything. Theoretically everything should work.

@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 16, 2020

Wow, nice work, thanks!

In the weekend I'll test it and merge ASAP.

@muxator muxator added the docker label Apr 16, 2020
@muxator muxator added this to the 1.8.3 milestone Apr 16, 2020
@flecno
Copy link
Copy Markdown

flecno commented Apr 17, 2020

Yeah! Very nice! Thank you so much 🎉 🙌

@flecno
Copy link
Copy Markdown

flecno commented Apr 17, 2020

What is wrong with the CI tests?

@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 19, 2020

Now that #3744 is merged I'll have to do a small rework.

@sapkra
Copy link
Copy Markdown
Contributor Author

sapkra commented Apr 19, 2020

@muxator I've updated the PR to include the skin variants.

Now every setting in the official Etherpad container will be configurable via
environment variables.
@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 19, 2020

@muxator I've updated the PR to include the skin variants.

Thanks, it's not common seeing such attention. Really appreciated.

Comment thread doc/docker.md Outdated
@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 19, 2020

Added possibility to set env setting to null using env vars

I am going to split this in a dedicated commit immediately before your change.

Comment thread src/node/utils/Settings.js Outdated
Comment on lines +445 to +452
if (stringValue === "null") {
/*
* There is already a way of setting a default value to null, and it is
* by using the syntax ${VAR_NAME}. This allows to use ${VAR_NAME:null} as
* well.
*/
return null;
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have split this modification in a dedicated commit (55dd44c) and tried to document it.

However, I am not sure if it's better to include this or not, because it introduces an edge case (the string "null" would become special, and a crazy admin would no longer be able to call his user "null").

In theory, there is already complete syntactic support for "null" values without introducing special strings. See for example:

https://github.com/ether/etherpad-lite/blob/70990afd6680045b9887559b18e8a380aabc814c/settings.json.docker#L59-L66

On the other side, I understand that ${VAR_NAME:null} is more explicit than ${VAR_NAME}.

My questions for you are:

  1. did you introduce this snippet because the documentation was not evident enough? In this case, I would prefer to drop this change & improve the documentation;
  2. or did you do it because you were aware of the existing support but found it uncomfortable? In this case, let's discuss. I do not like the edge case, but user ergonomics is important.

Copy link
Copy Markdown
Contributor

@muxator muxator left a comment

Choose a reason for hiding this comment

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

Super useful PR. I have a doubt about introducing coercition of ${VAR_NAME:null}, since we already support it via ${VAR_NAME}.

I'd prefer to improve the documentation without introducing a potential brittleness. But I understand the proposed syntax may seem more ergonomic.

muxator added 2 commits April 21, 2020 03:40
…"${VAR_NAME}"

Using "${VAR_NAME:null}", instead, would define the literal string "null".
…parameters

No functional changes.
This is in preparation of a future commit by Paul Tiedke.
@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 21, 2020

I am going without introducing the coercition "null" -> null.

I am adding this snippet in settings.json.template, hoping it clarifies what is supported and what is not.

If you want to use an empty value (null) as default value for a variable,
simply do not set it, without putting any colons: "${ABIWORD}".

The settings.json.docker file in this PR is going to be updated accordingly.

@muxator muxator force-pushed the config-env-vars branch 2 times, most recently from 4065d0b to c7a3ba5 Compare April 21, 2020 02:04
muxator added 3 commits April 21, 2020 04:24
…lude every single variable a driver may want
In this way, we also gain an explicit place for the default setting (still not
filled in).

No functional changes.
This is in preparation of a future commit by Paul Tiedke.
@muxator muxator changed the title docker: make configuration fully configurable via env vars docker: make settings fully configurable via env vars Apr 21, 2020
@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 21, 2020

Mentioned in DB_TYPE that the default is "not set, thus will fall back to DirtyDB (please choose one instead)"

@muxator muxator merged commit 85adaa4 into ether:develop Apr 21, 2020
@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 21, 2020

This PR is really useful.

Many thanks for taking the time to prepare and update it.

Pulled in.

@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 23, 2020

@sapkra: I have discovered that the documentation generator that Etherpad uses (https://github.com/markedjs/marked) is an ancient version, and does not render Markdown tables at all.

See what happens to your wonderful docker documentation:

image

Updating the library helps, but it's still horrible:

image

I stumbled on this issue while working on another documentation PR (#3921). If you are willing to help, you are welcome to drop a line there.

@sapkra
Copy link
Copy Markdown
Contributor Author

sapkra commented Apr 23, 2020

Sorry but I have to say that I'm not even using etherpad yet. But I may will in the future and will create a few PRs then.

I just created these PRs to cleanup the docker-jitsi-meet repository a bit.

@muxator
Copy link
Copy Markdown
Contributor

muxator commented Apr 23, 2020

Ok no problem, thanks!

Consider this just a follow-up while we are moving towards the release.

@sapkra
Copy link
Copy Markdown
Contributor Author

sapkra commented Apr 23, 2020

Maybe you can use something like docusaurus 2.0 to prettify the docs and/or website.

muxator added a commit that referenced this pull request Apr 24, 2020
This change is needed because in 1.8.3 we are going to introduce Markdown tables
in the documentation (#3873 and #3921), and the old marked version did not
support generating them.

Instead of committing the marked source code here, we live install from npm if
needed via the Makefile.

n.b.: at the time of this change, marked latest version is 1.0.0, released a few
      days ago. I am updating to the version immediately before that (0.8.2),
      because in 1.0.0 the hyperlinks in the Table of Contents do not work
      (probably a bug in that version).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants