No DB connection because occ config:system:get doesn't always return a proper value
Closed this issue · 5 comments
Describe the bug
If Nextcloud's database config is done via environment variables (possible with variables named NC_<cfgvalue>, see PR 3966), occ config:system:get does not respect this and cloud_py_api can't connect to the database.
I opened a Nextcloud bug on this subject because I think the occ command should reliably return the configuration, but one could still argue that occ config:system:get should only complement the functionality of occ config:system:set and only operate on the config.php. Therefore you might want to explore other options on your side.
To Reproduce
See instructions in nextcloud/server#36126
Expected behavior
Working database connection, regardless of how it is configured.
Given that a config via environment variable is mainly used in container environments, there is another option to solve this. Doing things the "docker way" means to run dedicated containers for specific services.
So instead of spawning the MediaDC instance (or any other cloud_py_api based service) from mod_php or php-fpm, it could run in a dedicated container.
There's a similar discussion around Nextcloud's very own notify_push in nextcloud/docker#1422 with a simple container solution described in this comment.
Note that notify_push parses the config.php directly with a complicated PHP parsing logic in Go (🤦 ), so it neither accepts the NC_ variables nor does it respect additional config files. But it understands dedicated variables like DATABASE_URL, DATABASE_PREFIX and REDIS_URL.
Yes, PR #47 should resolve the current issue.
I'd still suggest to make projects that base on cloud_py_api docker-friendly. Should I open a new issue for such a feature?
Yes, it's better to do it in the new issue.