Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. App Packaging & Development
  3. Problems with Postgres Addon

Problems with Postgres Addon

Scheduled Pinned Locked Moved App Packaging & Development
6 Posts 3 Posters 767 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ekevu123
    wrote on last edited by
    #1

    I have built an app in Elixir 1.17.2 and would love to use Cloudron's postgres addon, but I am facing some problems that I don't have on localhost, specifically the two below. I would appreciate some ideas how to debug this:

    11:16:27.216 [error] Postgrex.Protocol (#PID<0.437.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) too many connections for database "db72c357c2ba3f4121a9fc5d9be2cd97bb"
    11:16:27.216 [error] Postgrex.Protocol (#PID<0.425.0>) failed to connect: ** (Postgrex.Error) FATAL 53300 (too_many_connections) too many connections for database "db72c357c2ba3f4121a9fc5d9be2cd97bb"
    11:16:27.298 [error] Failed to start Ranch listener APP.Endpoint.HTTP in :ranch_tcp:listen([cacerts: :..., key: :..., cert: :..., port: 4001]) for reason :eaddrinuse (address already in use)
    
    11:16:27.304 [error] Running APP.Endpoint with cowboy 2.12.0 at http failed, port already in use
    11:16:27.306 [notice] Application APP exited: APP.Application.start(:normal, []) returned an error: shutdown: failed to start child: APP.Endpoint
        ** (EXIT) shutdown: failed to start child: {:ranch_listener_sup, APP.Endpoint.HTTP}
            ** (EXIT) shutdown: failed to start child: :ranch_acceptors_sup
                ** (EXIT) {:listen_error, APP.Endpoint.HTTP, :eaddrinuse}
    ** (exit) :terminating
        (kernel 10.0.1) application_controller.erl:511: :application_controller.call/2
        (kernel 10.0.1) application.erl:367: :application."-ensure_all_started/3-lc$^0/1-0-"/1
        (kernel 10.0.1) application.erl:367: :application.ensure_all_started/3
        (mix 1.17.2) lib/mix/tasks/app.start.ex:72: Mix.Tasks.App.Start.start/3
        (mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
        (mix 1.17.2) lib/mix/tasks/run.ex:129: Mix.Tasks.Run.run/5
        (mix 1.17.2) lib/mix/tasks/run.ex:85: Mix.Tasks.Run.run/1
        (mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    

    So, specifically:

    1. Postgres shows the max. connections are used
    2. The port appears to be occupied, but I don't understand where. I tried already using a different port.

    In accordance to the tutorial how to connect to your postgres database on Cloudron, I tried this:

    To connect via PostgreSQL CLI, open a Web Terminal and click the PostgreSQL button at the top. This will paste the CLI connection command into the Web Terminal. Press enter to execute the command and use the CLI.
    

    but it shows this: bash: psql: command not found

    The environment variables are set (check with env | grep CLOUDRON_POSTGRESQL)

    The cloudron manifest sets the postgres addon like this:

    "addons": {
      "localstorage": {},
      "postgresql": {}
    },
    

    I would appreciate some ideas how I could resolve this.

    1 Reply Last reply
    0
    • BrutalBirdieB Offline
      BrutalBirdieB Offline
      BrutalBirdie
      Partner
      wrote on last edited by BrutalBirdie
      #2

      Did you use the Cloudron base image for your app (Maybe post your repository URL or the Dockerfile)? It reads like you did not, and that is why the Cloudron default tools are missing.

      Like my work? Consider donating a drink. Cheers!

      E 1 Reply Last reply
      1
      • girishG Offline
        girishG Offline
        girish
        Staff
        wrote on last edited by
        #3

        Looks like maybe the app keeps crashing after keeping open connections to postgres. Postgres has an internal counter of connections and if they are not closed periodically, it will block that client. You can simply restart postgres (services -> postgres -> restart) and it will start accepting.

        Not sure about eaddinuse. But usually this means someone else is listening on that port (maybe again related to app restart/crash)

        1 Reply Last reply
        0
        • BrutalBirdieB BrutalBirdie

          Did you use the Cloudron base image for your app (Maybe post your repository URL or the Dockerfile)? It reads like you did not, and that is why the Cloudron default tools are missing.

          E Offline
          E Offline
          ekevu123
          wrote on last edited by ekevu123
          #4

          @BrutalBirdie said in Problems with Postgres Addon:

          Did you use the Cloudron base image for your app (Maybe post your repository URL or the Dockerfile)? It reads like you did not, and that is why the Cloudron default tools are missing.

          I did not think of that! However, using it didn't solve the problem either.

          @girish said in Problems with Postgres Addon:

          Looks like maybe the app keeps crashing after keeping open connections to postgres. Postgres has an internal counter of connections and if they are not closed periodically, it will block that client. You can simply restart postgres (services -> postgres -> restart) and it will start accepting.

          Not sure about eaddinuse. But usually this means someone else is listening on that port (maybe again related to app restart/crash)

          I can't see that the app keeps crashing. At least I can access its frontend normally, which also irritates me regarding the port error.
          I am pooling connections and I am well below the number of max connections allowed.

          I really don't know why the database error happens only on Cloudron but not locally.

          1 Reply Last reply
          0
          • E Offline
            E Offline
            ekevu123
            wrote on last edited by
            #5

            The database issue has been solved. I can't really say how, I made multiple changes.

            The port issue still persists, but doesn't seem to affect the behaviour of the application.

            1 Reply Last reply
            1
            • E Offline
              E Offline
              ekevu123
              wrote on last edited by
              #6

              I solved the port issue as well.
              The problem occured when I tried to start an interactive shell, which counted as starting a second application inside the cloudron app, that's where the port conflict came from.

              If someone else is working with Elixir on Cloudron, you can start an interactive shell like this:
              /app/_build/prod/rel/APP/bin/APP remote

              1 Reply Last reply
              1
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Bookmarks
              • Search