2

I'm trying to setup Directus correctly and having issues with the database file and uploads folder. I can't write to both of them. The setup is pretty straight forward, fresh installed server, Docker on Ubuntu, running as root. I first created the folder localhost and run the docker there, it works without issues. Copied the folder to the server as the Directus documentation suggested.

This is the docker-compose file:

version: "3"
services:
directus:
image: directus/directus:latest
ports:
  - 8055:8055
volumes:
  - ./database:/directus/database
  - ./uploads:/directus/uploads
  - ./extensions:/directus/extensions
environment:
  SECRET: "itsasecret"
  ADMIN_EMAIL: "user"
  ADMIN_PASSWORD: "passw"
  DB_CLIENT: "sqlite3"
  DB_FILENAME: "/directus/database/data.db"
  WEBSOCKETS_ENABLED: "true"

The admin is reachable but once I'm trying to login, it gives a readonly failure:

Error: update `directus_sessions` set `next_token` =
'j8t5_CoKeRR7wCF5dc4k10uraO36fOFLuUzWGe31I64GqH2_SIFL1KYX0u_n5Nsm',
`expires` = '2024-06-26 10:17:36.856' where `token` =
'eOfOA0DTJyQT7c3LkkAT5VApa7UDOjDhFaWVWjw1vzmCKplvAfc_iBZF7FHbdtJE' and
`next_token` is null returning `next_token` - SQLITE_READONLY: attempt
to write a readonly database

I tried to change permission of database folder to 777 which worked (just to test) but once I upload a file, it gives a similar issue;

directus-1  | [23:28:26.805] WARN: EACCES: permission denied, open '/directus/uploads/e7a8bd40-3e7d-4fd2-aeff-aa45598f967f.png'
directus-1  |     err: {
directus-1  |       "type": "Error",
directus-1  |       "message": "EACCES: permission denied, open '/directus/uploads/e7a8bd40-3e7d-4fd2-aeff-aa45598f967f.png'",
directus-1  |       "stack":
directus-1  |           Error: EACCES: permission denied, open '/directus/uploads/e7a8bd40-3e7d-4fd2-aeff-aa45598f967f.png'
directus-1  |       "errno": -13,
directus-1  |       "code": "EACCES",
directus-1  |       "syscall": "open",
directus-1  |       "path": "/directus/uploads/e7a8bd40-3e7d-4fd2-aeff-aa45598f967f.png"
directus-1  |     }

It seems to me as a permisssion/user problem. I've added to root user to the docker group (sudo groupadd docker ,sudo usermod -aG docker $USER):

grep 'docker' /etc/group 
docker:x:987:root

I've also tried to level up the permissions to 755 for both database/upload folder. None of it worked, still the same issues.

What am I doing wrong?

1 Answer 1

0

Check ./database folder permissions. Setting permissions 777 helps.

Can't find other ways to fix this problem.

Also you may have problems with images inside admin interface. 777 permissions for ./upload folder helps

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.