Mastodon

Clipable and a Postgres issue

Non-postgres DB users cannot create tables in a database unless they have full ownership.

Clipable and a Postgres issue

I wanted to have a lightweight self-hosted application to host my videos. I found Jellyfin, Clipable and Subatic, and I tried the latter two. They both provide a web interface where users can register, log in, and upload videos. User management and administrative information about videos is done through Postgres, while it stores the videos on S3 (Amazon or another S3, such as minio).

Overall, I did not succeed in using Clipable or Subatic. In the end, they were both running, but logging in as a user I had registered did not really work.

But one thing I wanted to note for myself is an issue I faced with Postgres 17. I believe the issue has existed since Postgres 15.

It's an issue you only get if you want an application like Clipable to use a non-root (i.e., non-postgres) DB user. The standard docker-compose configuration suggests that Clipable access Postgres as the DB root user, i.e. as postgres:

      DB_HOST: postgres
      DB_PORT: 5432
      DB_USER: postgres
      DB_PASSWORD: postgres
      DB_NAME: postgres

I didn't like that. I usually create dedicated DB users for each service that uses the DB, so I did this in pgsq -U postgres:

postgres=# create database clipable;
postgres=# create user clipable with password '...';
postgres=# grant all privileges on database clipable to clipable;

Unfortunately that did not suffice. When starting up Clipable, it left error messages in the Postgres log:

    2024-12-24 23:53:58.024 UTC [2948] ERROR:  permission denied for schema public at character 28
    2024-12-24 23:53:58.024 UTC [2948] STATEMENT:  CREATE TABLE IF NOT EXISTS "public"."schema_migrations" (version bigint not null primary key, dirty boolean not null)

Claude Sonnet 3.5 in a retrieval-augmented set up suggested that I grant the clipable DB user various permissions to the "public" schema:

postgres=# GRANT CREATE, USAGE ON SCHEMA public TO clipable;

But that still did not suffice. As pointed out in this Stackoverflow post, the key is to transfer full ownership of the clipable database to the clipable user:

postgres=# alter database clipable owner to clipable;

衣装を通販で探すときは、商品画像だけでなく実寸とセット内容も確認しておくと安心です。条件に合う選択肢を探す際は、男性向け コスプレ衣装を手掛かりに内容を確認できます。注文前に使用日と発送予定を照らし合わせ、試着や調整に使える時間も確保しておくと安心です。