mealie
mealie copied to clipboard
[BUG] - POSTGRES_URL_OVERRIDE requires an unnecessary `:` in the URI
First Check
- [X] This is not a feature request.
- [X] I added a very descriptive title to this issue (title field is above this).
- [X] I used the GitHub search to find a similar issue and didn't find it.
- [X] I searched the Mealie documentation, with the integrated search.
- [X] I already read the docs and didn't find an answer.
- [ ] This issue can be replicated on the demo site (https://demo.mealie.io/).
What is the issue you are experiencing?
The new POSTGRES_URL_OVERRIDE
environment variable requires that a colon must be present to separate the postgres database username and password fields:
https://github.com/mealie-recipes/mealie/blob/53a1f045622da441cbd80a7e5614c62231cd8082/mealie/core/settings/db_providers.py#L55-L57
However, if one is not using a password to connect to their postgres database (for instance, if they are using peer authentication), then they should be able to omit the password and the colon altogether. See this portion of the libpq documentation:
postgresql://[userspec@][hostspec][/dbname][?paramspec]
where userspec is:
user[:password]
In my case, I set my connection string to the following in order to get mealie to connect to my database:
POSTGRES_URL_OVERRIDE="postgresql://mealie:@/mealie?host=/run/postgresql";
Yet it should be possible to provide the following instead:
POSTGRES_URL_OVERRIDE="postgresql://mealie@/mealie?host=/run/postgresql";
note the lack of :
between postgresql://mealie
and @
.
Steps to Reproduce
- Set
DB_ENGINE=postgres
andPOSTGRES_URL_OVERRIDE=postgresql://mealie@/mealie?host=/run/postgresql
environment variables. - See mealie fail to start up due to being unable to extract the password. This causes a runtime exception (instead of being handled gracefully).
Please provide relevant logs
May 07 23:26:19 plonkie systemd[1]: Starting Mealie, a self hosted recipe manager and meal planner...
May 07 23:26:22 plonkie init_db[952]: Traceback (most recent call last):
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/config.py", line 573, in configure
May 07 23:26:22 plonkie init_db[952]: handler = self.configure_handler(handlers[name])
May 07 23:26:22 plonkie init_db[952]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/config.py", line 757, in configure_handler
May 07 23:26:22 plonkie init_db[952]: result = factory(**kwargs)
May 07 23:26:22 plonkie init_db[952]: ^^^^^^^^^^^^^^^^^
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/handlers.py", line 155, in __init__
May 07 23:26:22 plonkie init_db[952]: BaseRotatingHandler.__init__(self, filename, mode, encoding=encoding,
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/handlers.py", line 58, in __init__
May 07 23:26:22 plonkie init_db[952]: logging.FileHandler.__init__(self, filename, mode=mode,
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/__init__.py", line 1181, in __init__
May 07 23:26:22 plonkie init_db[952]: StreamHandler.__init__(self, self._open())
May 07 23:26:22 plonkie init_db[952]: ^^^^^^^^^^^^
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/__init__.py", line 1213, in _open
May 07 23:26:22 plonkie init_db[952]: return open_func(self.baseFilename, self.mode,
May 07 23:26:22 plonkie init_db[952]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
May 07 23:26:22 plonkie init_db[952]: PermissionError: [Errno 13] Permission denied: '/mnt/storagebox/mealie/mealie.log'
May 07 23:26:22 plonkie init_db[952]: The above exception was the direct cause of the following exception:
May 07 23:26:22 plonkie init_db[952]: Traceback (most recent call last):
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/scripts/install_model.py", line 3, in <module>
May 07 23:26:22 plonkie init_db[952]: from mealie.services.parser_services import crfpp
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/services/parser_services/__init__.py", line 1, in <module>
May 07 23:26:22 plonkie init_db[952]: from .ingredient_parser import *
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/services/parser_services/ingredient_parser.py", line 10, in <module>
May 07 23:26:22 plonkie init_db[952]: from mealie.db.models.recipe.ingredient import IngredientFoodModel, IngredientUnitModel
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/db/models/recipe/__init__.py", line 3, in <module>
May 07 23:26:22 plonkie init_db[952]: from .category import *
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/db/models/recipe/category.py", line 16, in <module>
May 07 23:26:22 plonkie init_db[952]: logger = root_logger.get_logger()
May 07 23:26:22 plonkie init_db[952]: ^^^^^^^^^^^^^^^^^^^^^^^^
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/core/root_logger.py", line 37, in get_logger
May 07 23:26:22 plonkie init_db[952]: __root_logger = configured_logger(
May 07 23:26:22 plonkie init_db[952]: ^^^^^^^^^^^^^^^^^^
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/core/logger/config.py", line 66, in configured_logger
May 07 23:26:22 plonkie init_db[952]: logging_config.dictConfig(config=__conf)
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/config.py", line 823, in dictConfig
May 07 23:26:22 plonkie init_db[952]: dictConfigClass(config).configure()
May 07 23:26:22 plonkie init_db[952]: File "/nix/store/lpi16513bai8kg2bd841745vzk72475x-python3-3.11.9/lib/python3.11/logging/config.py", line 580, in configure
May 07 23:26:22 plonkie init_db[952]: raise ValueError('Unable to configure handler '
May 07 23:26:22 plonkie init_db[952]: ValueError: Unable to configure handler 'file'
May 07 23:26:24 plonkie init_db[1523]: Traceback (most recent call last):
May 07 23:26:24 plonkie init_db[1523]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/db/init_db.py", line 13, in <module>
May 07 23:26:24 plonkie init_db[1523]: from mealie.db.db_setup import session_context
May 07 23:26:24 plonkie init_db[1523]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/db/db_setup.py", line 25, in <module>
May 07 23:26:24 plonkie init_db[1523]: SessionLocal, engine = sql_global_init(settings.DB_URL) # type: ignore
May 07 23:26:24 plonkie init_db[1523]: ^^^^^^^^^^^^^^^
May 07 23:26:24 plonkie init_db[1523]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/core/settings/settings.py", line 91, in DB_URL
May 07 23:26:24 plonkie init_db[1523]: return self.DB_PROVIDER.db_url if self.DB_PROVIDER else None
May 07 23:26:24 plonkie init_db[1523]: ^^^^^^^^^^^^^^^^^^^^^^^
May 07 23:26:24 plonkie init_db[1523]: File "/nix/store/0qx0wf0pr2w8fiilnlxh26sp22y347pq-python3.11-mealie-1.5.1/lib/python3.11/site-packages/mealie/core/settings/db_providers.py", line 55, in db_url
May 07 23:26:24 plonkie init_db[1523]: remainder = remainder.split(":", 1)[1]
May 07 23:26:24 plonkie init_db[1523]: ~~~~~~~~~~~~~~~~~~~~~~~^^^
May 07 23:26:24 plonkie init_db[1523]: IndexError: list index out of range
May 07 23:26:24 plonkie systemd[1]: mealie.service: Control process exited, code=exited, status=1/FAILURE
May 07 23:26:24 plonkie systemd[1]: mealie.service: Failed with result 'exit-code'.
May 07 23:26:24 plonkie systemd[1]: Failed to start Mealie, a self hosted recipe manager and meal planner.
Mealie Version
1.5.1
Deployment
Other (please specify below)
Additional Deployment Details
NixOS