Trying to access a Grist database with Metabase

Hello, as stated in the title I’m trying to access a .grist file with Metabase because that’s the tool we use for stats and analytics.

My environment is a Yunohost running mini PC with metabase and grist installed, so the database i’m trying to reach is located there : /home/yunohost.app/grist/docs/jbUM4xxna2uYPm8eu9M3zk.grist

Problem is : access permission is denied even with a (temporary) chmod 777.

Is there a trick that i’m missing ? Even after years of self hosting, debian permissions remain mysterious…

I asked the same question on the Yunohost forum by the way…

I don’t know. Maybe you can tell Grist to user some username/group that lines up well with metabase? @Spoffy there are environment variables for telling Grist to use a specific username/group, right? Can you remind me, I’m blanking on finding them in the README.

@paul-grist - you can use GRIST_DOCKER_USER and GRIST_DOCKER_GROUP when running the docker version, but it looks like Yunohost uses a bare-metal install script contributed by Florent.

@Enthouane - It looks like Yunohost does a lot of its own smart permissions management (probably for app security reasons). I’m afraid I’m not very familiar with how Yunohost handles permissions specifically - I think you might have more luck on their forums!

One thing you could try is using getfacl and setfacl to provide access to those files explicitly for the Metabase user.

There’s a quite a few threads on the Yunohost forums too about sharing files between apps, such as this one:

Hope that helps a bit!

1 Like

Tagging @Florent_F in case he has some insight.

1 Like

Thanks for the insights i’ll try a few tweaks then…
What i find weird is that i tried adding metabase to the grist group which is both creator and owner of the /home/yunohost.app/grist/docs/ directory. But still no access.

I just followed these steps (having already Grist installed):

# yunohost app install metabase
# sudo adduser metabase grist
# sudo -u metabase ls -la /home/yunohost.app/grist/docs

It could list my files correctly.

Have you taken a look at the right parent /home/yunohost.app/grist/ directory, to be sure it is owned by user grist?

ls -ld /home/yunohost.app/grist/
ls: cannot access '/home/yunohost.app/grist/docs/jbUM4xxna2uYPm8eu9M3zk.grist': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/jhTVcVqLdMkem547TXQk85.grist': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/rNwrBPuiaVP68hE1eYgNpp.grist': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/..': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/8G5pXwLRDX6a6yS1VqXFdp.grist': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/nu9tGMXKkmH7SHtAZ6Cvpx.grist': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/.': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/jbUM4xxna2uYPm8eu9M3zk~gJooJJDSRTxfcKfMMb5snc~5.grist': Permission denied
ls: cannot access '/home/yunohost.app/grist/docs/dPvPGWSSHMSYRWfHP2jhyK.grist': Permission denied
total 0
d????????? ? ? ? ?            ? .
d????????? ? ? ? ?            ? ..
-????????? ? ? ? ?            ? 8G5pXwLRDX6a6yS1VqXFdp.grist
-????????? ? ? ? ?            ? dPvPGWSSHMSYRWfHP2jhyK.grist
-????????? ? ? ? ?            ? jbUM4xxna2uYPm8eu9M3zk~gJooJJDSRTxfcKfMMb5snc~5.grist
-????????? ? ? ? ?            ? jbUM4xxna2uYPm8eu9M3zk.grist
-????????? ? ? ? ?            ? jhTVcVqLdMkem547TXQk85.grist
-????????? ? ? ? ?            ? nu9tGMXKkmH7SHtAZ6Cvpx.grist
-????????? ? ? ? ?            ? rNwrBPuiaVP68hE1eYgNpp.grist

sudo -u metabase ls -la /home/yunohost.app/grist/
drwxr-x--- 3 grist grist   4096 Oct  9 09:38 .
drwxr-xr-x 6 root  root    4096 Sep  5 10:07 ..
-rwx------ 1 grist grist    185 Sep  5 10:13 custom.env
drwxrw-r-- 2 grist grist   4096 Oct  9 09:36 docs
-rw-r--r-- 1 grist grist 307200 Oct  9 09:38 home.db

So no problem getting to the /home/yunohost.app/grist/ directory, but impossible to reach its /docs/ subdir, created and owned by the same user and group…

All those question marks got me wondering and i found a solution here :

To read a file, its read permission needs to be set. However, to read a directory and the listing of its files, both the read and the execute permissions need to be set. If they aren’t, you get weird errors like the ones you’re experiencing.

So i just used this command to set proper execute permissions to the directories.

sudo chmod -R a+X /home/yunohost.app/grist/

Ok now i face another issue, which is directly related to metabase and grist interfacing :

Metabase won’t update my database structure. In other words, whenever i add or remove columns in my grist database, metabase does not sync sees no change.

However, lines are still updated so any change i make to any existing data is seen.

I tried to add again the database into metabase, and to incriminated table is simply seen empty with no columns and no data.

Any suggestion on what i might try ? Where can i look to understand what’s going on ?