Skip to content

Commit 7836ccc

Browse files
committed
Initialize hosted audit volume ownership
Signed-off-by: Jeremi Joslin <jeremi@joslin.fr>
1 parent 5456759 commit 7836ccc

6 files changed

Lines changed: 84 additions & 1 deletion

‎compose.coolify.agriculture.yaml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ x-relay-common: &relay-common
1616
platform: ${REGISTRY_STACK_PLATFORM:-linux/amd64}
1717
restart: unless-stopped
1818
environment: *relay-environment
19+
depends_on:
20+
volume-permissions:
21+
condition: service_completed_successfully
1922
healthcheck:
2023
test: ["CMD", "/usr/local/bin/registry-relay", "healthcheck"]
2124
interval: 30s
@@ -33,10 +36,23 @@ x-notary-common: &notary-common
3336
timeout: 10s
3437
retries: 3
3538
depends_on:
39+
volume-permissions:
40+
condition: service_completed_successfully
3641
redis:
3742
condition: service_healthy
3843

3944
services:
45+
volume-permissions:
46+
image: ${VOLUME_INIT_IMAGE:-busybox:1.36}
47+
command:
48+
- sh
49+
- -c
50+
- chown -R 65532:65532 /relay/* && chown -R 65534:65534 /notary/*
51+
volumes:
52+
- nagdi-agriculture-cache:/relay/nagdi-agriculture-cache
53+
- nagdi-agriculture-audit:/relay/nagdi-agriculture-audit
54+
- nagdi-notary-state:/notary/nagdi-notary-state
55+
4056
redis:
4157
image: ${REDIS_IMAGE:-redis:7.4-alpine}
4258
command: ["redis-server", "--save", "", "--appendonly", "no"]

‎compose.coolify.citizen-services.yaml‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,21 @@ x-notary-common: &notary-common
1818
timeout: 10s
1919
retries: 3
2020
depends_on:
21+
volume-permissions:
22+
condition: service_completed_successfully
2123
redis:
2224
condition: service_healthy
2325

2426
services:
27+
volume-permissions:
28+
image: ${VOLUME_INIT_IMAGE:-busybox:1.36}
29+
command:
30+
- sh
31+
- -c
32+
- chown -R 65534:65534 /notary/*
33+
volumes:
34+
- citizen-notary-state:/notary/citizen-notary-state
35+
2536
redis:
2637
image: ${REDIS_IMAGE:-redis:7.4-alpine}
2738
command: ["redis-server", "--save", "", "--appendonly", "no"]

‎compose.coolify.interior.yaml‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,28 @@ x-relay-common: &relay-common
99
platform: ${REGISTRY_STACK_PLATFORM:-linux/amd64}
1010
restart: unless-stopped
1111
environment: *relay-environment
12+
depends_on:
13+
volume-permissions:
14+
condition: service_completed_successfully
1215
healthcheck:
1316
test: ["CMD", "/usr/local/bin/registry-relay", "healthcheck"]
1417
interval: 30s
1518
timeout: 10s
1619
retries: 3
1720

1821
services:
22+
volume-permissions:
23+
image: ${VOLUME_INIT_IMAGE:-busybox:1.36}
24+
command:
25+
- sh
26+
- -c
27+
- chown -R 65532:65532 /relay/*
28+
volumes:
29+
- cra-civil-cache:/relay/cra-civil-cache
30+
- cra-civil-audit:/relay/cra-civil-audit
31+
- nia-population-cache:/relay/nia-population-cache
32+
- nia-population-audit:/relay/nia-population-audit
33+
1934
postgres:
2035
image: ${SOLMARA_POSTGRES_IMAGE:?set digest-pinned Solmara Postgres image}
2136
entrypoint: ["/bin/sh", "/usr/local/bin/solmara-postgres-entrypoint.sh"]
@@ -66,6 +81,8 @@ services:
6681
NIA_CITIZEN_SOURCE_HASH: ${NIA_CITIZEN_SOURCE_HASH}
6782
PORTAL_RELAY_TOKEN_HASH: ${PORTAL_RELAY_TOKEN_HASH}
6883
depends_on:
84+
volume-permissions:
85+
condition: service_completed_successfully
6986
postgres:
7087
condition: service_healthy
7188
volumes:

‎compose.coolify.labour-pensions.yaml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ x-relay-common: &relay-common
1616
platform: ${REGISTRY_STACK_PLATFORM:-linux/amd64}
1717
restart: unless-stopped
1818
environment: *relay-environment
19+
depends_on:
20+
volume-permissions:
21+
condition: service_completed_successfully
1922
healthcheck:
2023
test: ["CMD", "/usr/local/bin/registry-relay", "healthcheck"]
2124
interval: 30s
@@ -33,10 +36,23 @@ x-notary-common: &notary-common
3336
timeout: 10s
3437
retries: 3
3538
depends_on:
39+
volume-permissions:
40+
condition: service_completed_successfully
3641
redis:
3742
condition: service_healthy
3843

3944
services:
45+
volume-permissions:
46+
image: ${VOLUME_INIT_IMAGE:-busybox:1.36}
47+
command:
48+
- sh
49+
- -c
50+
- chown -R 65532:65532 /relay/* && chown -R 65534:65534 /notary/*
51+
volumes:
52+
- sipf-pensions-cache:/relay/sipf-pensions-cache
53+
- sipf-pensions-audit:/relay/sipf-pensions-audit
54+
- pension-notary-state:/notary/pension-notary-state
55+
4056
redis:
4157
image: ${REDIS_IMAGE:-redis:7.4-alpine}
4258
command: ["redis-server", "--save", "", "--appendonly", "no"]

‎compose.coolify.social-development.yaml‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ x-relay-common: &relay-common
1616
platform: ${REGISTRY_STACK_PLATFORM:-linux/amd64}
1717
restart: unless-stopped
1818
environment: *relay-environment
19+
depends_on:
20+
volume-permissions:
21+
condition: service_completed_successfully
1922
healthcheck:
2023
test: ["CMD", "/usr/local/bin/registry-relay", "healthcheck"]
2124
interval: 30s
@@ -33,10 +36,25 @@ x-notary-common: &notary-common
3336
timeout: 10s
3437
retries: 3
3538
depends_on:
39+
volume-permissions:
40+
condition: service_completed_successfully
3641
redis:
3742
condition: service_healthy
3843

3944
services:
45+
volume-permissions:
46+
image: ${VOLUME_INIT_IMAGE:-busybox:1.36}
47+
command:
48+
- sh
49+
- -c
50+
- chown -R 65532:65532 /relay/* && chown -R 65534:65534 /notary/*
51+
volumes:
52+
- sro-social-cache:/relay/sro-social-cache
53+
- sro-social-audit:/relay/sro-social-audit
54+
- programme-mis-cache:/relay/programme-mis-cache
55+
- programme-mis-audit:/relay/programme-mis-audit
56+
- child-benefit-notary-state:/notary/child-benefit-notary-state
57+
4058
redis:
4159
image: ${REDIS_IMAGE:-redis:7.4-alpine}
4260
command: ["redis-server", "--save", "", "--appendonly", "no"]

‎scripts/test_quality_scripts.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,19 @@ def test_coolify_services_mount_durable_audit_state(self) -> None:
120120
compose = yaml.safe_load((ROOT / compose_name).read_text(encoding="utf-8"))
121121
declared_volumes = set((compose.get("volumes") or {}).keys())
122122
services = compose["services"]
123+
init_service = services["volume-permissions"]
124+
init_volume_names = {mount.split(":", 1)[0] for mount in init_service.get("volumes") or []}
123125

124126
for service_name, mounts in service_mounts.items():
125127
service = services[service_name]
126128
service_volumes = set(service.get("volumes") or [])
129+
self.assertIn("volume-permissions", service.get("depends_on") or {})
127130
for mount in mounts:
128131
with self.subTest(service=service_name, mount=mount):
132+
volume_name = mount.split(":", 1)[0]
129133
self.assertIn(mount, service_volumes)
130-
self.assertIn(mount.split(":", 1)[0], declared_volumes)
134+
self.assertIn(volume_name, declared_volumes)
135+
self.assertIn(volume_name, init_volume_names)
131136

132137
def test_story_preview_smoke_passes_current_tree(self) -> None:
133138
result = subprocess.run(

0 commit comments

Comments
 (0)