2 months ago
Hi Railway team,
I'm running SurrealDB (surrealdb/surrealdb:latest) on Railway using a scratch-based Docker image. The service works perfectly with the memory backend, but I'm unable to use a persistent volume due to a permission error.
Setup:
- Service image: surrealdb/surrealdb:latest (scratch-based, no shell)
- Volume mount path: /data
- Custom start command: /surreal start --bind 0.0.0.0:8000 --user <user> --pass <pass> --allow-all surrealkv:/data/brainx.db
Error:
```
ERROR surrealdb_server::cli: There was a problem with the datastore: IO error: Permission denied (os error 13)
```
I tried:
- Mount paths /mydata, /data, /tmp/mydata
- Storage engines surrealkv, rocksdb, file://
- Adding a pre-deploy chmod 777 /data — but the scratch image has no shell, so pre-deploy commands fail
- Deleting and recreating the volume
All combinations result in the same permission denied error. The volume appears to be mounted as root, but the SurrealDB process runs as a different user with no write access.
Question: Is there a way to configure the volume mount permissions for scratch-based images on Railway? Or is there a recommended workaround for running SurrealDB with persistent storage?
Thank you!
1 Replies
2 months ago
Your surrealdb service in the "glorious-surprise" project is hitting this because volumes are mounted as root, and the surrealdb/surrealdb:latest image runs as a non-root user. Add the environment variable RAILWAY_RUN_UID=0 to your surrealdb service to run the container as root, which will grant write access to the volume - see Volumes: Permissions.
Status changed to Awaiting User Response Railway • about 2 months ago
2 months ago
This thread has been marked as solved automatically due to a lack of recent activity. Please re-open this thread or create a new one if you require further assistance. Thank you!
Status changed to Solved Railway • about 2 months ago