asciinema / asciinema-server

Platform for hosting and sharing terminal session recordings
https://docs.asciinema.org/manual/server/
Apache License 2.0
2.29k stars 263 forks source link

Missing SSL for psql connection when using image #411

Closed SNB-hz closed 1 year ago

SNB-hz commented 1 year ago

I'm trying to run asciinema-server in Kubernetes, and having it connect to a psql database using ssl.

This used to work when using the image asciinema/asciinema-server:latest from Dockerhub, but using the new images on ghcr, the container goes into Error state right after startup and logs this:

Running db migrations...
** (EXIT from #PID<0.96.0>) an exception was raised:
    ** (RuntimeError) SSL connection can not be established because `:ssl` application is not started,
you can add it to `extra_applications` in your `mix.exs`:

  def application do
    [extra_applications: [:ssl]]
  end

        (postgrex 0.16.5) lib/postgrex.ex:680: Postgrex.ensure_deps_started!/1
        (postgrex 0.16.5) lib/postgrex.ex:622: Postgrex.child_spec/1
        (ecto_sql 3.9.2) lib/ecto/adapters/sql.ex:743: Ecto.Adapters.SQL.init/3
        (ecto 3.9.4) lib/ecto/repo/supervisor.ex:185: Ecto.Repo.Supervisor.init/1
        (stdlib 4.2) supervisor.erl:330: :supervisor.init/1
        (stdlib 4.2) gen_server.erl:851: :gen_server.init_it/2
        (stdlib 4.2) gen_server.erl:814: :gen_server.init_it/6
        (stdlib 4.2) proc_lib.erl:240: :proc_lib.init_p_do_apply/3

This happens with both ghcr.io/asciinema/asciinema-server:latest as well as ghcr.io/asciinema/asciinema-server:develop

I noticed that https://github.com/asciinema/asciinema-server/issues/378 is essentially the same issue, so I tried the fix suggested there. We already mount /opt/app/etc/custom.exs , so I appended

config :asciinema, Asciinema.Repo,
   ssl: true,
   pool_size: 2

This did not change the behavior though.

ku1ik commented 1 year ago

Can you try pulling ghcr.io/asciinema/asciinema-server:develop now ? It includes this latest commit 0bfb919396a9dee17e8b5cf53f7ebe485c7a20ce which may help.

SNB-hz commented 1 year ago

unfortunately the error is still the same, using this image: Image ID: ghcr.io/asciinema/asciinema-server@sha256:52b6462d4f7f1b6d65c826823cab865033cd02defa09432e9bbad6ebdffb82ad

ku1ik commented 1 year ago

Try ghcr.io/asciinema/asciinema-server:develop again. I reproduced the problem and fixed it :crossed_fingers:

SNB-hz commented 1 year ago

Can confirm the issue is now resolved. Thanks!

ku1ik commented 1 year ago

@SNB-hz FYI I've published the fix to ghcr.io/asciinema/asciinema-server:latest, so you may want to switch now from :develop to :latest tag as it's more stable in the long term.