The image creates SWW_STATE_DIR when it is missing (closes #337)
check / check (push) Waiting to run
check / check (push) Waiting to run
Before `waf` starts, the image's `run` script now makes `SWW_STATE_DIR` if it is missing (`mkdir -p`), gives it to `sww:sww` and sets its mode to `0700`, as it already does for the cache directory's owner. A value that is not an absolute path, or an unreadable `SWW_STATE_DIR_FILE`, still changes nothing, and `waf` stops naming the setting. The `Dockerfile` comment, `docs/image.md`, `docs/settings.md` and `SPEC.md` say the image makes the directory. `script/example-app` checks that a missing `SWW_STATE_DIR` is made, owned by `sww` with mode `0700`. - `chmod 0700` also applies to an existing directory, a mounted volume included, at every start of `waf`. Model: opus-5-5
This commit was merged in pull request #351.
This commit is contained in:
1 parent
b93bad5842
commit
697c2225d9
6 files changed
+40
-32
No files matched your search
+13
-5
@@ -18,8 +18,8 @@
|
||||
# client;
|
||||
# - that a waf container with its state files on a new volume mounted at
|
||||
# the directory SWW_STATE_DIR_FILE names becomes healthy;
|
||||
# - that one whose SWW_STATE_DIR does not exist logs waf's message
|
||||
# about it.
|
||||
# - that the run script makes a SWW_STATE_DIR that does not exist, owned
|
||||
# by sww with mode 0700, and that waf then becomes healthy.
|
||||
# waf runs with SWW_LOOKUP_SOURCE=off, so that no address is sent to
|
||||
# GeoJS. The containers, the network, the volumes and both images are removed
|
||||
# however the script ends. Building the app needs network access, for nixpkgs'
|
||||
@@ -159,6 +159,12 @@ owner_of() {
|
||||
docker exec "$1" stat --format '%U' "$2"
|
||||
}
|
||||
|
||||
# owner_and_mode_of <container> <dir>: print who owns dir there, and its
|
||||
# mode in octal.
|
||||
owner_and_mode_of() {
|
||||
docker exec "$1" stat --format '%U %a' "$2"
|
||||
}
|
||||
|
||||
main() {
|
||||
cd "$ROOT"
|
||||
trap cleanup EXIT
|
||||
@@ -251,9 +257,11 @@ main() {
|
||||
--env SWW_STATE_DIR=/srv/missing \
|
||||
--env SWW_LOOKUP_SOURCE=off \
|
||||
"$IMAGE" >/dev/null
|
||||
wait_for "waf did not report the missing state directory" \
|
||||
logged "$WAF" "SWW_STATE_DIR cannot be written"
|
||||
echo "example-app: waf reports a state directory that does not exist"
|
||||
wait_for "waf's health check did not pass" healthy "$WAF"
|
||||
[ "$(owner_and_mode_of "$WAF" /srv/missing)" = "sww 700" ] ||
|
||||
fail "the run script did not make SWW_STATE_DIR for sww with mode 0700"
|
||||
echo "example-app: the run script makes a missing SWW_STATE_DIR for sww" \
|
||||
"with mode 0700"
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Reference in new issue
Block a user