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. Feature Requests
  3. Postgresql multiple databases support

Postgresql multiple databases support

Scheduled Pinned Locked Moved Feature Requests
postgresqlmulti-database
13 Posts 6 Posters 2.4k Views 6 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.
  • vladimir.dV Offline
    vladimir.dV Offline
    vladimir.d
    wrote on last edited by
    #1

    Hi,

    Any plans to make multipleDatabases option available for postgresql add-on in the same was as it's for mysql add-on?

    Thanks!

    1 Reply Last reply
    2
    • nebulonN Offline
      nebulonN Offline
      nebulon
      Staff
      wrote on last edited by
      #2

      Hi vladimir, as of now you are the first one asking for that. I also think so far we had no app which required this setup. What is the app or use-case you have in mind?

      1 Reply Last reply
      0
      • vladimir.dV Offline
        vladimir.dV Offline
        vladimir.d
        wrote on last edited by
        #3

        I'm building a custom app for Chirpstack as All-in-One application container.
        It requires two postgresql databases: one for the application server and another for the network server (or maybe even more for other services). I've managed to create two databases for the app user manually and set appropriate access privileges, but not sure if it would be persistent after the cloudron host reboot.
        I hoped multipleDatabases option was available for postgresql add-on but it's not.

        1 Reply Last reply
        1
        • marcusquinnM Offline
          marcusquinnM Offline
          marcusquinn
          wrote on last edited by
          #4

          Related: https://forum.cloudron.io/topic/4258/chirpstack-for-lorawan?_=1619796077885

          Web Design https://www.evergreen.je
          Development https://brandlight.org
          Life https://marcusquinn.com

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

            Maybe a workaround if possible would be to package the network server and application server separately. I can look into adding the multipleDatabases flag in the meantime, should be straight forward.

            infogulchI 1 Reply Last reply
            0
            • girishG girish

              Maybe a workaround if possible would be to package the network server and application server separately. I can look into adding the multipleDatabases flag in the meantime, should be straight forward.

              infogulchI Offline
              infogulchI Offline
              infogulch
              wrote on last edited by
              #6

              @girish Perhaps a specific implementation of this would allow the postgresql addon manifest to indicate the number of databases required (default: 1) to provide to the app. And then CLOUDRON_POSTGRESQL_DATABASE could be a comma-separated list of db names?

              That seems to be the most flexible nearby strategy. That wouldn't solve an app that needs a variable number of databases (like a db per user or something), but that use-case seems pretty exotic imo. Anyways, just ideas.

              girishG 1 Reply Last reply
              1
              • infogulchI infogulch

                @girish Perhaps a specific implementation of this would allow the postgresql addon manifest to indicate the number of databases required (default: 1) to provide to the app. And then CLOUDRON_POSTGRESQL_DATABASE could be a comma-separated list of db names?

                That seems to be the most flexible nearby strategy. That wouldn't solve an app that needs a variable number of databases (like a db per user or something), but that use-case seems pretty exotic imo. Anyways, just ideas.

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

                @infogulch We already have the flag for MySQL - https://docs.cloudron.io/custom-apps/addons/#mysql . So, it will just follow the same pattern. We will inject a CLUODRON_POSTGRESQL_DATABASE_PREFIX and the app can create databases with that prefix. The question is of course if postgres allows this sort of role management i.e if a user can be given access to a "prefix". In MySQL, you can do it with GRANT ALL PREVILIGES ON and a prefix. If it doesn't, we have to design this differently. Do you know postgresql? If so, suggestions welcome!

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

                  Something like this maybe - https://stackoverflow.com/questions/22684255/grant-privileges-on-future-tables-in-postgresql

                  infogulchI 1 Reply Last reply
                  0
                  • girishG girish

                    Something like this maybe - https://stackoverflow.com/questions/22684255/grant-privileges-on-future-tables-in-postgresql

                    infogulchI Offline
                    infogulchI Offline
                    infogulch
                    wrote on last edited by infogulch
                    #9

                    @girish No, I don't have a lot of experience with postgresql. The strategy you describe aligns with my understanding of mysql's philosophy, but postgresql seems to require admins be more explicit. E.g. granting permissions to an arbitrary quoted LIKE pattern is documented in mysql, but postgresql's GRANT docs don't mention anything of the like and look like they require the specific object to exist (by nature of being a valid identifier) before granting permissions. Though I could be mistaken.

                    1 Reply Last reply
                    0
                    • LanhildL Offline
                      LanhildL Offline
                      Lanhild
                      App Dev
                      wrote on last edited by
                      #10

                      Bumping this old thread. I have a custom application that can make use of multiple databases. It would be useful to have such a flag for the PostgreSQL addon.

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

                        @Lanhild we haven't worked on it. I think last time around atleast I found this was quite hard to do in postgres. I haven't found a way to give access to future databases with a "prefix" in postgres.

                        Maybe an alternate for postgres is to implement something with a "count" instead . Would that work for your usecase? What's the use case to have multiple databases?

                        (Not saying we are planning to work on this 🙂 Just putting out some ideas).

                        LanhildL 1 Reply Last reply
                        0
                        • girishG girish

                          @Lanhild we haven't worked on it. I think last time around atleast I found this was quite hard to do in postgres. I haven't found a way to give access to future databases with a "prefix" in postgres.

                          Maybe an alternate for postgres is to implement something with a "count" instead . Would that work for your usecase? What's the use case to have multiple databases?

                          (Not saying we are planning to work on this 🙂 Just putting out some ideas).

                          LanhildL Offline
                          LanhildL Offline
                          Lanhild
                          App Dev
                          wrote on last edited by Lanhild
                          #12

                          @girish said in Postgresql multiple databases support:

                          Maybe an alternate for postgres is to implement something with a "count" instead . Would that work for your usecase?

                          I'm not sure to understand?

                          What's the use case to have multiple databases?

                          I have some applications that make use of multiple databases that act as environments (e.g.: prod, test, etc.) So instead of having multiple copies of the code running, you only have multiple databases.

                          Also, multiple databases could benefit to the use of the addon as a "standalone" app - that could act as a simple PostgreSQL cluster.

                          girishG 1 Reply Last reply
                          0
                          • LanhildL Lanhild

                            @girish said in Postgresql multiple databases support:

                            Maybe an alternate for postgres is to implement something with a "count" instead . Would that work for your usecase?

                            I'm not sure to understand?

                            What's the use case to have multiple databases?

                            I have some applications that make use of multiple databases that act as environments (e.g.: prod, test, etc.) So instead of having multiple copies of the code running, you only have multiple databases.

                            Also, multiple databases could benefit to the use of the addon as a "standalone" app - that could act as a simple PostgreSQL cluster.

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

                            @Lanhild said in Postgresql multiple databases support:

                            I'm not sure to understand?

                            What I meant is maybe the manifest can use "postgreSQL": { "prefixCount": 10 } and it creates 10 databases or something like that.

                            Also, multiple databases could benefit to the use of the addon as a "standalone" app - that could act as a simple PostgreSQL cluster.

                            I think it will be nice to create PostgreSQL as an app and with a small frontend to add/remove databases and maybe manage roles. Maybe this app can not use existing addon. Of course, this app has to be developed!

                            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