Restart Compose stack after permission changes in run.sh #22

Merged
MHE merged 1 commit from fix-run-sh-force-container-restart into main 2026-11-01 18:37:41 +01:00
Owner

What changed

  • run.sh: when a run changes ownership of *_DIRECTORIES (initial run or --force) and the published stack has running services, the stack is stopped first. After publication it is started again with docker compose up -d.
  • If this run adds a new key to app.env or .env whose value is empty or contains CHANGE_ME, the stack stays stopped. The run then lists those keys and the start command at the end.
  • On failure, the previous deployment files are restored and the project is started again. A stack that was not running stays stopped. --skip-permissions and --dry-run do not stop the stack.
  • New helpers: snapshot_published_env_keys, collect_unconfigured_env_additions, report_unconfigured_env_additions, and start_compose_stopped_for_permissions.
  • Docs: the scripts rule (.openso/rules/20-scripts.md) and the README --force row describe the new behaviour.

Why

Recursive chown/chmod on bind-mounted directories while containers run can break services. Previously the stack was left down after --force, so operators had to restart it by hand. Now the stack returns automatically, except when new configuration is still missing, where stopping it avoids starting services with placeholder values.

## What changed - `run.sh`: when a run changes ownership of `*_DIRECTORIES` (initial run or `--force`) and the published stack has running services, the stack is stopped first. After publication it is started again with `docker compose up -d`. - If this run adds a new key to `app.env` or `.env` whose value is empty or contains `CHANGE_ME`, the stack stays stopped. The run then lists those keys and the start command at the end. - On failure, the previous deployment files are restored and the project is started again. A stack that was not running stays stopped. `--skip-permissions` and `--dry-run` do not stop the stack. - New helpers: `snapshot_published_env_keys`, `collect_unconfigured_env_additions`, `report_unconfigured_env_additions`, and `start_compose_stopped_for_permissions`. - Docs: the scripts rule (`.openso/rules/20-scripts.md`) and the README `--force` row describe the new behaviour. ## Why Recursive `chown`/`chmod` on bind-mounted directories while containers run can break services. Previously the stack was left down after `--force`, so operators had to restart it by hand. Now the stack returns automatically, except when new configuration is still missing, where stopping it avoids starting services with placeholder values.
Restart stopped Compose services after permission changes
All checks were successful
ci / compose (pull_request) Successful in 13s
ci / shellcheck (pull_request) Successful in 7s
ci / conventions (pull_request) Successful in 2s
ci / image (pull_request) Successful in 1s
326564af08
MHE merged commit 02e964080a into main 2026-11-01 18:37:41 +01:00
MHE deleted branch fix-run-sh-force-container-restart 2026-11-01 18:37:54 +01:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
openso/docker-templates!22
No description provided.