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. Support
  3. Can I access a postgres database of an app from outside?

Can I access a postgres database of an app from outside?

Scheduled Pinned Locked Moved Solved Support
mysqlpostgresql
19 Posts 5 Posters 5.5k Views 5 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.
  • D devtron

    @girish So the directus (tool) should support ssh tunnel or do you mean cloudron?

    girishG Offline
    girishG Offline
    girish
    Staff
    wrote on last edited by
    #8

    @devtron neither. I thought you wanted to access the database that directus uses from outside? If so, what tool are you going to use from the outside to connect? That tool should support ssh tunneling.

    D 1 Reply Last reply
    0
    • girishG girish

      @devtron neither. I thought you wanted to access the database that directus uses from outside? If so, what tool are you going to use from the outside to connect? That tool should support ssh tunneling.

      D Offline
      D Offline
      devtron
      wrote on last edited by
      #9

      @girish Ahh You mean the client (tool), where I connect to the database. I want to use TablePlus and I am sure it has ssh tunneling.

      S 1 Reply Last reply
      0
      • D devtron

        @girish Ahh You mean the client (tool), where I connect to the database. I want to use TablePlus and I am sure it has ssh tunneling.

        S Offline
        S Offline
        shrey
        wrote on last edited by shrey
        #10

        Hey @devtron .

        I was curious about it too, so just tried the same using DBeaver.

        I was able to successfully access Directus' Postgres database by:

        1. configuring SSH connection to the server that Cloudron is hosted on
        2. using:
        • host = value gotten from the host server by using `docker inspect postgresql | grep IPAddress
        • database = value gotten from Directus' 'terminal' (echo $CLOUDRON_POSTGRESQL_DATABASE)
        • username = value gotten from Directus' 'terminal' (echo $CLOUDRON_POSTGRESQL_USERNAME)
        • password = value gotten from Directus' 'terminal' (echo $CLOUDRON_POSTGRESQL_PASSWORD)
        girishG 1 Reply Last reply
        2
        • S shrey

          Hey @devtron .

          I was curious about it too, so just tried the same using DBeaver.

          I was able to successfully access Directus' Postgres database by:

          1. configuring SSH connection to the server that Cloudron is hosted on
          2. using:
          • host = value gotten from the host server by using `docker inspect postgresql | grep IPAddress
          • database = value gotten from Directus' 'terminal' (echo $CLOUDRON_POSTGRESQL_DATABASE)
          • username = value gotten from Directus' 'terminal' (echo $CLOUDRON_POSTGRESQL_USERNAME)
          • password = value gotten from Directus' 'terminal' (echo $CLOUDRON_POSTGRESQL_PASSWORD)
          girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #11

          @shrey Thanks, that motivated me to get started with a guide.

          I wrote the mysql guide first - https://docs.cloudron.io/guides/connect-mysql/ . Working on the postgres one (but it's really very similar).

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

            PostgreSQL guide is up as well - https://docs.cloudron.io/guides/connect-postgresql/

            1 Reply Last reply
            3
            • girishG girish marked this topic as a question on
            • girishG girish has marked this topic as solved on
            • D Offline
              D Offline
              devtron
              wrote on last edited by
              #13

              Thanks @shrey and @girish for the guides 👍

              1 Reply Last reply
              2
              • D Offline
                D Offline
                devtron
                wrote on last edited by
                #14

                In my case, it also works with table plus 🙂

                1 Reply Last reply
                1
                • S Offline
                  S Offline
                  shrey
                  wrote on last edited by
                  #15

                  Hi @girish .

                  I do have some feedback regarding the currently suggested method, as described in these new guides.

                  After using this method for quite a few days, finding the internal ip address of the db containers has almost become the Achilles heel for any operation that uses this feature. That's because, the internal ip address keeps on changing, every now and then.

                  And so far, i haven't been able to identify a way to connect to the db by a static name/ip/uri.

                  Would appreciate if a solution for that is posted as well!

                  Thanks.

                  girishG 1 Reply Last reply
                  1
                  • S shrey

                    Hi @girish .

                    I do have some feedback regarding the currently suggested method, as described in these new guides.

                    After using this method for quite a few days, finding the internal ip address of the db containers has almost become the Achilles heel for any operation that uses this feature. That's because, the internal ip address keeps on changing, every now and then.

                    And so far, i haven't been able to identify a way to connect to the db by a static name/ip/uri.

                    Would appreciate if a solution for that is posted as well!

                    Thanks.

                    girishG Offline
                    girishG Offline
                    girish
                    Staff
                    wrote on last edited by
                    #16

                    @shrey that's a good point. I think docker can give those containers a different IP on each restart. For the app containers, we solved this by giving them static IPs. Maybe we should do the same for addons then.

                    robiR 1 Reply Last reply
                    1
                    • girishG girish

                      @shrey that's a good point. I think docker can give those containers a different IP on each restart. For the app containers, we solved this by giving them static IPs. Maybe we should do the same for addons then.

                      robiR Offline
                      robiR Offline
                      robi
                      wrote on last edited by
                      #17

                      @girish ideally an internal DNS mapping if dynamic, and an IP pattern to use if static, both of which should be viewable from the UI as needed.

                      Conscious tech

                      girishG 1 Reply Last reply
                      0
                      • robiR robi

                        @girish ideally an internal DNS mapping if dynamic, and an IP pattern to use if static, both of which should be viewable from the UI as needed.

                        girishG Offline
                        girishG Offline
                        girish
                        Staff
                        wrote on last edited by
                        #18

                        @robi it already has internal names which is how apps access them with the current dynamic IP situation.

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

                          I have given these stable IPs now - https://git.cloudron.io/cloudron/box/-/commit/582994b9d646989b42e27dde1ae0c27bbb964834

                          1 Reply Last reply
                          3
                          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