Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pleroma pleroma
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 671
    • Issues 671
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 101
    • Merge requests 101
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Artifacts
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
    • Model experiments
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PleromaPleroma
  • pleromapleroma
  • Issues
  • #2056

OTP migrations fail to connect to Postgres with SSL

Environment

  • Installation type (OTP or From Source): OTP
  • Pleroma version (could be found in the "Version" tab of settings in Pleroma-FE): 2.0.50-2385-g47698fc3-develop
  • Elixir version (elixir -v for from source installations, N/A for OTP): N/A
  • Operating system: Alpine (in Docker), macOS
  • PostgreSQL version (psql -V): 11

Bug description

Running Pleroma migrations fails with the following when connecting via SSL:

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

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

        (postgrex 0.15.5) lib/postgrex.ex:554: Postgrex.ensure_deps_started!/1
        (postgrex 0.15.5) lib/postgrex.ex:496: Postgrex.child_spec/1
        (ecto_sql 3.4.5) lib/ecto/adapters/sql.ex:459: Ecto.Adapters.SQL.init/3
        (ecto 3.4.5) lib/ecto/repo/supervisor.ex:178: Ecto.Repo.Supervisor.init/1
        (stdlib 3.12.1) supervisor.erl:295: :supervisor.init/1
        (stdlib 3.12.1) gen_server.erl:374: :gen_server.init_it/2
        (stdlib 3.12.1) gen_server.erl:342: :gen_server.init_it/6
        (stdlib 3.12.1) proc_lib.erl:249: :proc_lib.init_p_do_apply/3

There's a related issue and PR against Postgrex.

To replicate:

  1. Run Postgres with SSL
  2. Build a new release via MIX_ENV=prod mix release
  3. Set ssl: true in prod.secret.exs
  4. Run ./bin/pleroma_ctl migrate. This should fail with the error above.

It looks like a reasonable patch for this is adding:

Application.ensure_all_started(:ssl)

to lib/mix/tasks/pleroma/ecto/migrate.ex.

The above snippet has fixed it in my case, so I'll raise a PR shortly. Raised: !2894 (merged)

I'm still a little confused why having :ssl in mix.exs in extra_applications doesn't fix this to begin with..

Edited Aug 16, 2020 by Hugo
Assignee
Assign to
Time tracking