Configuration files, Environment Variables, or?

I deleted my earlier post on this matter, but continue to need assistance.

Seeking a way to set, to be persistent, the settings related to sending email from grampsweb, for password resets and such.

It appears to be “do-able” with Environment Variables and “config file” seemingly suited, but, there are many questions in my mind.

Gramps 5.1.6
Gramps Web API 1.5.1
Gramps Web Frontend 24.1.2
locale: en
multi-tree: false
task queue: true

The config files I have found, opening a shell in a container, appear empty. How to go about editing them, as vi, vim, edlin are not found?

The Environment variables are native OS or container variables?

Please check Server Configuration - Gramps Web and have a look at the example docker-compose files, where you can see examples of configuration environment variables.

1 Like

Those items I found earlier. I have no idea, clueless, as to where the config file is located and, if it is in a docker container, how to edit it.

To help illustrate my confusion, this section I find difficult to understand /my comments/:

Configuration file vs. environment variables

For the settings, you can either use a configuration file or environment variables.

When you use the Docker Compose based setup, you can include a configuration file by adding the following list item under the volumes: key in the grampsweb: block:

/Did not find that in the example config file/

      - /path/to/config.cfg:/app/config/config.cfg

/If I open a shell in the gramps container, I only find “config/config.cfg” which is empty. “ls /apps/config/config.cfg” produces “no such file or directory”/

where /path/to/config.cfg is the path to the config file in your server’s file system (the right-hand side refers to the path in the container and must not be changed).

/The left hand side is what then? What does the “-” character signify?/

If these are fundamental “docker” matters, fine, I can retreat a bit and splash in that pool for a bit.

Is docker-compose.yml where these alterations are to be performed?

Is one to add, for example -

GRAMPSWEB_ EMAIL_HOST some.IP.address
GRAMPSWEB_ EMAIL_PORT 123

And so forth?

But, then what? How would that take effect? “docker-compose up -d” once again?

If one chooses a “config file”, per the example further down in the doc, how does one define (hence store) the config file? The already defined items seem to be elusive to any tools I have attempted.

In the example: “- /path/to/config.cfg:/app/config/config.cfg”, where is one to create this “config.cfg” file, in root accessible directory in the “normal OS” or within a container (which seems beyond my skill level)?

Please humor my ignorance and leisurely grasp of “new stuff”. “gramps” can describe more that a project, you know. :face_with_diagonal_mouth:

Pursing one path, edited docker-compose.yml as follows
. . . .
environment:
GRAMPSWEB_TREE: “Gramps Web” # will create a new tree if not exists
GRAMPSWEB_CELERY_CONFIG__broker_url: “redis://grampsweb_redis:6379/0”
GRAMPSWEB_CELERY_CONFIG__result_backend: “redis://grampsweb_redis:6379/0”
GRAMPSWEB_RATELIMIT_STORAGE_URI: redis://grampsweb_redis:6379/1
GRAMPSWEB_EMAIL_HOST: “192.168.0.123”
GRAMPSWEB_EMAIL_PORT: 143
GRAMPSWEB_EMAIL_USE_TLS: False
GRAMPSWEB_FROM_EMAIL: “gramps@my-fam.com
. . .

Please note I had no clue regarding quote marks usage, so, let the vim editor guide me, with it’s pretty color formatting. On that note, not all the "redis url’s: are quoted. Is that correct? Does it matter? What are the rules?

Tried docker-compose down, then docker-compose up. Nothing seemed broken, but, neither did email work.

Tailing docker log for grampsweb_celery does show an attempt, with this snippet, which implies bodged values in my values?

Also, what guise does gramps/docker send mail?
--------------------------
Traceback (most recent call last):
** File “/usr/local/lib/python3.11/dist-packages/celery/app/trace.py”, line 477, in trace_task**
** R = retval = fun(args, kwargs)
** ^^^^^^^^^^^^^^^^^^^^
*
** File “/usr/local/lib/python3.11/dist-packages/gramps_webapi/util/celery.py”, line 20, in call**
** return self.run(args, kwargs)
** ^^^^^^^^^^^^^^^^^^^^^^^^^
*
** File “/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/tasks.py”, line 68, in send_email_reset_password**
** send_email(subject=subject, body=body, to=[email])**
** File “/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/util.py”, line 412, in send_email**
** raise ValueError(“Connection was refused.”)**
ValueError: Connection was refused.
------------------

Discovered how to display various things including Environment Variables.
The ones I specified in docker-compose.yml did not take effect.
Seems the quote marks have no effect on the environment variable values, apparently.

Still unable to send mail, logs say connection refused. So apparently it can send email. Dawned on me that perhaps it could not send except to localhost or locally bound, to host, IP, so changed the IP in docker-config.yml and did restart of container.

Much to my dismay, the environment variable did not change. Tried container stop then container start. Still no joy, systemctl restart docker.service, also not joy. Reboot VM. No joy.

Why?

When attempting to recover password via grampsweb login screen, the email does not arrive, appears to not even get out of the gramps container environment.
After installing telnet in the grampsweb_celery container determined I could connect on port 25 but not 143. Changed that but ran into an error attempting to change password: "IndexError: "

grampsweb_celery | [2024-02-01 19:00:24,985: INFO/MainProcess] Task gramps_webapi.api.tasks.send_email_reset_password[dbfba699-9829-476d-8f38-cf55631db7c0] received
grampsweb_celery | [2024-02-01 19:00:25,402: ERROR/ForkPoolWorker-1] Task gramps_webapi.api.tasks.send_email_reset_password[dbfba699-9829-476d-8f38-cf55631db7c0] raised unexpected: IndexError(‘list index out of range’)
grampsweb_celery | Traceback (most recent call last):
grampsweb_celery | File “/usr/local/lib/python3.11/dist-packages/celery/app/trace.py”, line 477, in trace_task
grampsweb_celery | R = retval = fun(*args, **kwargs)
grampsweb_celery | ^^^^^^^^^^^^^^^^^^^^
grampsweb_celery | File “/usr/local/lib/python3.11/dist-packages/gramps_webapi/util/celery.py”, line 20, in call
grampsweb_celery | return self.run(*args, **kwargs)
grampsweb_celery | ^^^^^^^^^^^^^^^^^^^^^^^^^
grampsweb_celery | File “/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/tasks.py”, line 68, in send_email_reset_password
grampsweb_celery | send_email(subject=subject, body=body, to=[email])
grampsweb_celery | File “/usr/local/lib/python3.11/dist-packages/gramps_webapi/api/util.py”, line 408, in send_email
grampsweb_celery | smtp.send_message(msg)
grampsweb_celery | File “/usr/lib/python3.11/smtplib.py”, line 956, in send_message
grampsweb_celery | from_addr = email.utils.getaddresses([from_addr])[0][1]
grampsweb_celery | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
grampsweb_celery | IndexError: list index out of range

Because . . . it appears “docker-control down”, followed by “docker-control up -d” is required to accomplish the changes. Using “docker control blah” does not seem to do it, despite what I took to be claims the docker client would accomplish that.