Feat(12-factor): Extensions are updated to let charms use non-root users
Metadata
Current evaluation
Merged after review and CI completion. Updates 12-factor extensions to support non-root charm containers by fixing file permissions, adding a logging part, and setting ownership to daemon for Flask and Django extensions.
Suggested action: —
No scores available.
Issue body
As of [Juju 3.6](https://discourse.charmhub.io/t/juju-3-6-0-released/16027) Charms can have [non-root users](https://canonical-charmcraft.readthedocs-hosted.com/en/stable/reference/files/metadata-yaml-file/#charm-user). We want to make use of the non-root charm containers. We had some issues with some file/folder permissions because we are creating/modifying some files from the charm code.
This PR fixes these permission issues by creating the folders inside the rockcraft.yaml file and setting the user as `_daemon_`. Adds a new part into all 12 Factor extensions called `logging`. This part creates the folders necessary for logging and sets their user to `_daemon_` so that the non-root charms can interact with them.
For Flask and Django extensions, it also sets the `gunicorn.conf.py` file and its parent folder to `_daemon_` user.
Again for Flask and Django extensions, it creates the `/var/log/django` and `/var/log/flask` folders and sets their user to `_daemon_`.
Reviewers:
@javierdelapuente
@gregory-schiano
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
---
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged after review and CI completion. Updates 12-factor extensions to support non-root charm containers by fixing file permissions, adding a logging part, and setting ownership to daemon for Flask and Django extensions. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged after spread tests. Updates 12-factor extensions for non-root charm users by fixing permissions and adding a logging part that sets directory ownership to daemon. Configures Flask and Django extensions accordingly. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged after spread tests passed. Updates 12-factor extensions to support non-root charms by fixing file permissions and adding a logging part that sets directory ownership to daemon. Flask and Django extensions also configure gunicorn and log paths. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2556 fix: charmcraft templates for flask and django extensions | charmcraft | merged | Merged external contribution adding the missing platforms key to charmcraft.yaml templates for Flask and Django 12-factor extensions. Approved by two reviewers, passed CI checks, and updated documentation. |