Configuring asciinema-server to Connect to PostgreSQL via Unix Domain Socket

Hello everyone,

I’m currently exploring how to configure asciinema-server to connect to PostgreSQL using a Unix domain socket, but I’m facing some challenges. Despite searching extensively, I couldn’t find any documentation or discussions specifically addressing this setup.

I’ve already posted an issue on GitHub regarding this matter, and while I appreciate the developer’s response, I’m still seeking guidance on how to achieve this configuration.

Has anyone here successfully configured asciinema-server to utilize a Unix domain socket for PostgreSQL connections? If so, could you please share your insights or point me in the right direction?

Any help or suggestions would be greatly appreciated. Thank you in advance!

asciinema server uses Ecto and Postgrex libraries for Postgres connections. It looks like there’s a way to configure the connection to use UNIX socket:

https://hexdocs.pm/ecto_sql/Ecto.Adapters.Postgres.html#module-connection-options

You can try with this custom config file (adjust dir to your setup):

config :asciinema, Asciinema.Repo, socket_dir: "/var/run/postgresql"

See Configuration - asciinema docs for info how to use a custom config file.

I hope this helps. Let me know how to goes :crossed_fingers:

Hello,

I have solved this problem. The configuration files are as follows:

    environment:
      - DATABASE_URL=postgresql://postgres@localhost/asciinema?socket_dir=/var/run/postgresql
      - …
    volumes:
      - postgres:/var/run/postgresql
      - …

It goes well. Thank you for your help.