mounted volume is not writable - how to debug?
zohar
TRIALOP

a year ago

  • I attached a volume to a service. Its mount point is /PATH_TO_WEB_ROOT/APP_RELATIVE_PATH/files (with real values in the service's settings)

  • The user trying to write to the mount is www-data

  • I've set a variable RAILWAY_RUN_UID=0 on the attached service per https://docs.railway.com/guides/volumes#permissions

The volume is still unwritable during run time.

  1. How can I debug this problem? (couldn't find anything meaningful in the logs)

  2. Should the directory (in my case files) should already exist before I mount a volume on it?)

Solved

59 Replies

zohar
TRIALOP

a year ago

665700e5-7078-4a17-bd42-00e3b59c1a0f


zohar
TRIALOP

a year ago

I tried setting RAILWAY_RUN_UID to 33 (actual www-data UID) - didn't work


brody
EMPLOYEE

a year ago

can you please provide us the actual mount point


zohar
TRIALOP

a year ago

sure: /opt/drupal/web/sites/default/files


zohar
TRIALOP

a year ago

fwiw, I was about to explicitly chmod 755 on this mount in my Dockerfile. (holding on that for now)


brody
EMPLOYEE

a year ago

what service id?


zohar
TRIALOP

a year ago

Drupal CMS Railway Template


brody
EMPLOYEE

a year ago

there are no logs in here, can you do whatever would be neeed to trigger some error logs?


zohar
TRIALOP

a year ago


brody
EMPLOYEE

a year ago

was this a template deploy?


zohar
TRIALOP

a year ago

No, I'm trying to build my own template.


brody
EMPLOYEE

a year ago

is there a template for drupal lol


zohar
TRIALOP

a year ago

I know - it has a bug 😉


zohar
TRIALOP

a year ago

It uses a non-existent root directory, but even so - I'm learning to use Railway so I'm taking the hard path


zohar
TRIALOP

a year ago

hard = long


brody
EMPLOYEE

a year ago

i think once this is solved it would be best to attempt to work with the current template owner


brody
EMPLOYEE

a year ago

duplicate templates just cause confusion


zohar
TRIALOP

a year ago

yeah, I'll refrain from publishing it for now - really this is just learning the edges of Railway


brody
EMPLOYEE

a year ago

any reason why you are using a dockerfile instead of the image?


zohar
TRIALOP

a year ago

Maybe - I want to initialize the installation with a config file which already has the DB credentials. The image doesn't have it


zohar
TRIALOP

a year ago

(web/sites/default/settings.php)


zohar
TRIALOP

a year ago

And I'm also using a different flavor of Drupal than what the image provides, but now you get me thinking whether i left something behind..)


zohar
TRIALOP

a year ago

in any case, for the sake of educating myself - regardless of the specific template - how should I achieve a writable mount in such a setup?


brody
EMPLOYEE

a year ago

RAILWAY_RUN_UID=0 - its just a question of why thats not working


zohar
TRIALOP

a year ago

Am I right to assume that this variable is needed because internally it is www-data who tries to write to the mount?


brody
EMPLOYEE

a year ago

root@e0bea80480b5:/opt/drupal/web/sites/default# ls -la
total 100
drwxr-xr-x 1 www-data www-data  4096 Jan 21 16:35 .
drwxr-xr-x 1 www-data www-data  4096 Jan 21 16:12 ..
-rw-r--r-- 1 www-data www-data 10656 Jan 21 16:12 default.services.yml
-rw-r--r-- 1 www-data www-data 35786 Jan 21 16:12 default.settings.php
drwxr-xr-x 3 root     root      4096 Jan 21 14:56 files
-rw-r--r-- 1 www-data www-data 35786 Jan 21 16:35 settings.php

zohar
TRIALOP

a year ago

aha!


zohar
TRIALOP

a year ago

the power of ssh!


brody
EMPLOYEE

a year ago

did you add RAILWAY_RUN_UID after the first install?


zohar
TRIALOP

a year ago

to be honest I don't remember as I did many changes.
I'm fine with deleting and recreating the services if that would help debugging


zohar
TRIALOP

a year ago

but it's very much possible


brody
EMPLOYEE

a year ago


zohar
TRIALOP

a year ago

yey!


brody
EMPLOYEE

a year ago

the power of chown


brody
EMPLOYEE

a year ago

just do a chown in your start command


zohar
TRIALOP

a year ago

So - to be a good student - I will try the whole installation from Zero using this order:

  1. set up a new service from my repo

  2. add a start up command

  3. attach a mount

  4. deploy.
    ?


brody
EMPLOYEE

a year ago

i think, but what start command?


zohar
TRIALOP

a year ago

the chown


brody
EMPLOYEE

a year ago

yeah but whats the full start command?


zohar
TRIALOP

a year ago

oh - chown www-data:www-data /opt/drupal/web/sites/default
?


brody
EMPLOYEE

a year ago

but if you set that as the start command its just going to run chown and never start the web server


zohar
TRIALOP

a year ago

LOL 🤦‍♂️


zohar
TRIALOP

a year ago

a post-deploy command should work too


brody
EMPLOYEE

a year ago

it wouldn't, even if we supported that lol


zohar
TRIALOP

a year ago

So I'll need to add some apachectl start or the likes I guess


brody
EMPLOYEE

a year ago

whatever the default start command is


zohar
TRIALOP

a year ago

ok - I'll keep on learning. Will update here if there's any public interest to it


brody
EMPLOYEE

a year ago

i'd like to see your thought process on the correct start command


zohar
TRIALOP

a year ago

cool. I'll update.


brody
EMPLOYEE

a year ago

then we can compare our start commands


zohar
TRIALOP

a year ago

This one seems to be working:
/bin/sh -c "exec apache2-foreground && chown www-data:www-data /opt/drupal/web/sites/default"


brody
EMPLOYEE

a year ago

/bin/sh -c "chown -R www-data:www-data /opt/drupal/web/sites/default/files && exec apache2-foreground"

brody
EMPLOYEE

a year ago

you where close


brody
EMPLOYEE

a year ago

exec is a good idea, updated mine


zohar
TRIALOP

a year ago

Thanks a million @Brody 🙏
I'll keep on learning


brody
EMPLOYEE

a year ago

no problem!


brody
EMPLOYEE

a year ago

am i good to mark this as solved?


zohar
TRIALOP

a year ago

sure!


brody
EMPLOYEE

a year ago

!s


Status changed to Solved brody about 1 year ago


Loading...