Skip to content

Commit 08499a0

Browse files
antontranelisclaude
andcommitted
chore(infra): auto-fix uploads permissions via init-uploads service
A fresh checkout (or a 'sudo rm -rf data/' reset) hits an EACCES on /directus/uploads because the bind-mounted host directory is root-owned, while the Directus container runs as a non-root user. Add a one-shot 'init-uploads' service that runs before the backend and chmods ./data/uploads to 777, then make the backend depend on it via 'service_completed_successfully'. The matching 'sudo chmod 777 -R ./data/' step in the README is no longer needed. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent 59c6a28 commit 08499a0

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ docker compose up -d
3030
**Initialize backend**
3131

3232
```bash
33-
sudo chmod 777 -R ./data/
3433
cd backend/
3534
./push.sh
3635
./seed.sh

docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ services:
66
volumes:
77
- ./app/dist:/srv:ro
88

9+
# One-shot helper that runs before the backend starts.
10+
# Ensures ./data/uploads exists and is writeable by the Directus
11+
# container (which runs as a non-root user). Without this, a fresh
12+
# checkout fails on a permission-denied error.
13+
init-uploads:
14+
image: busybox
15+
command: ["sh", "-c", "mkdir -p /uploads && chmod -R 777 /uploads"]
16+
volumes:
17+
- ./data/uploads:/uploads
18+
919
database:
1020
image: postgis/postgis:13-master
1121
volumes:
@@ -41,6 +51,8 @@ services:
4151
condition: service_healthy
4252
cache:
4353
condition: service_healthy
54+
init-uploads:
55+
condition: service_completed_successfully
4456
ports:
4557
- 8055:8055
4658
volumes:

0 commit comments

Comments
 (0)