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. MySQL and Postgresql as standalone apps

MySQL and Postgresql as standalone apps

Scheduled Pinned Locked Moved Feature Requests
26 Posts 12 Posters 3.5k Views 16 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.
    • ChristopherMagC Offline
      ChristopherMagC Offline
      ChristopherMag
      wrote on last edited by ChristopherMag
      #1

      I need to run a copy of some database engine where I can create custom tables, access the data from multiple tools like Excel, n8n, NocoDB, and Redash.

      I would prefer Postgresql but MySQL would probably work fine for me as well.

      In the past I would have run a Microsoft SQL Express instance but most everything else we use has now been standardized on Cloudron and I would rather use that platform instead of having to setup a separate self maintained system.

      Cloudron hosts both of these databases along with MongoDB already internally accessible to specific apps that would like to use them but I would like to consume them as first class apps themselves that are not related to any other app or container running on cloudron.

      I have a feeling I could probably make a very simple cloudron app that simply proxies the connection to the database exposed to that app but it would be really nice to have this as a directly supported scenario when, as in this case, the app I really want to use is the database itself.

      ChristopherMagC 1 Reply Last reply
      12
      • ChristopherMagC ChristopherMag

        I need to run a copy of some database engine where I can create custom tables, access the data from multiple tools like Excel, n8n, NocoDB, and Redash.

        I would prefer Postgresql but MySQL would probably work fine for me as well.

        In the past I would have run a Microsoft SQL Express instance but most everything else we use has now been standardized on Cloudron and I would rather use that platform instead of having to setup a separate self maintained system.

        Cloudron hosts both of these databases along with MongoDB already internally accessible to specific apps that would like to use them but I would like to consume them as first class apps themselves that are not related to any other app or container running on cloudron.

        I have a feeling I could probably make a very simple cloudron app that simply proxies the connection to the database exposed to that app but it would be really nice to have this as a directly supported scenario when, as in this case, the app I really want to use is the database itself.

        ChristopherMagC Offline
        ChristopherMagC Offline
        ChristopherMag
        wrote on last edited by
        #2

        @ChristopherMag PS, this would be perfectly fine/better if the "app" version had nothing to do with the version used behind the scenes for apps.

        I would prefer that they really have nothing to do with each other and so that the app version could auto upgrade with new versions of the database being released just like any other app and such.

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

          Interesting... I wonder if the database app should have the database OR if it should just be a frontend to our existing addons. The former approach has advantage that we can have databases with different versions. We can also have database settings which are more flexible that with our addons (the addons are restricted by what all the apps can support).

          ChristopherMagC T 2 Replies Last reply
          1
          • girishG girish

            Interesting... I wonder if the database app should have the database OR if it should just be a frontend to our existing addons. The former approach has advantage that we can have databases with different versions. We can also have database settings which are more flexible that with our addons (the addons are restricted by what all the apps can support).

            ChristopherMagC Offline
            ChristopherMagC Offline
            ChristopherMag
            wrote on last edited by
            #4

            @girish Definitely think the first option is the way to go, can have different versions, plugins, etc. and not have any negative impact on addons infrastructure which works great and I would hate to make that harder to maintain.

            1 Reply Last reply
            1
            • girishG girish

              Interesting... I wonder if the database app should have the database OR if it should just be a frontend to our existing addons. The former approach has advantage that we can have databases with different versions. We can also have database settings which are more flexible that with our addons (the addons are restricted by what all the apps can support).

              T Offline
              T Offline
              timka
              wrote on last edited by
              #5

              @girish I had the same need and was surprised that there's no option. So I Would really appreciate it! PostgreSQL /MySQL, MongoDB and REDIS would be perfect 😉 🙂

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

                So much yes to all of this. I keep thinking I'm doing something wrong because it MUST be there, right?! and then I read https://forum.cloudron.io/topic/2630/lamp-stack-with-postgres and realise I don't understand enough, and give up. Which is sad.

                So massive +100000 to this.

                jan.reinhardtJ 1 Reply Last reply
                1
                • E eddowding

                  So much yes to all of this. I keep thinking I'm doing something wrong because it MUST be there, right?! and then I read https://forum.cloudron.io/topic/2630/lamp-stack-with-postgres and realise I don't understand enough, and give up. Which is sad.

                  So massive +100000 to this.

                  jan.reinhardtJ Offline
                  jan.reinhardtJ Offline
                  jan.reinhardt
                  wrote on last edited by
                  #7

                  @eddowding said in MySQL and Postgresql as standalone apps:

                  So much yes to all of this. I keep thinking I'm doing something wrong because it MUST be there, right?! and then I read https://forum.cloudron.io/topic/2630/lamp-stack-with-postgres and realise I don't understand enough, and give up. Which is sad.

                  So massive +100000 to this.

                  And another +1000000 from my side 🙂

                  1 Reply Last reply
                  2
                  • T timka

                    @girish I had the same need and was surprised that there's no option. So I Would really appreciate it! PostgreSQL /MySQL, MongoDB and REDIS would be perfect 😉 🙂

                    M Offline
                    M Offline
                    msbt
                    App Dev
                    wrote on last edited by
                    #8

                    @timka said in MySQL and Postgresql as standalone apps:

                    @girish I had the same need and was surprised that there's no option. So I Would really appreciate it! PostgreSQL /MySQL, MongoDB and REDIS would be perfect 😉 🙂

                    also Elastic/OpenSearch 😉

                    1 Reply Last reply
                    2
                    • F Offline
                      F Offline
                      felixwttr
                      wrote on last edited by
                      #9

                      +10000 from me too. A standalone database app would be very useful.

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

                        Agreed, even just for random testing or data analysis/DB schema testing, having a standalone PostgreSQL/MongoDB, etc. app would be quite useful

                        1 Reply Last reply
                        1
                        • ChristopherMagC Offline
                          ChristopherMagC Offline
                          ChristopherMag
                          wrote on last edited by
                          #11

                          Fyi, what I have ended up doing is creating a custom cloudron app with the postgresql feature and then hosting a nodejs app that communicates directly with the database to alleviate the need for generic direct access to postgresql.

                          @Lanhild If you want direct access to a postgresql database for testing and DB analysis stuff then you can use a custom app with the postgresql feature enabled and girish's post here to connect pgadmin to that custom app's postgresql instance.

                          LanhildL 1 Reply Last reply
                          4
                          • ChristopherMagC ChristopherMag

                            Fyi, what I have ended up doing is creating a custom cloudron app with the postgresql feature and then hosting a nodejs app that communicates directly with the database to alleviate the need for generic direct access to postgresql.

                            @Lanhild If you want direct access to a postgresql database for testing and DB analysis stuff then you can use a custom app with the postgresql feature enabled and girish's post here to connect pgadmin to that custom app's postgresql instance.

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

                            @ChristopherMag Thanks for the info!

                            Do you mind sharing your custom application code? I'm very interested in that.

                            1 Reply Last reply
                            1
                            • ChristopherMagC Offline
                              ChristopherMagC Offline
                              ChristopherMag
                              wrote on last edited by
                              #13

                              @Lanhild I don't think I can share the full code but here is a relevant snippet if you wanted to get stated with using postgresql from within a nodejs cloudron app:

                              import Koa from 'koa'
                              import cors from '@koa/cors'
                              import Router from '@koa/router'
                              import { koaBody } from 'koa-body'
                              import postgres from 'postgres'
                              
                              var sql = postgres(process.env.CLOUDRON_POSTGRESQL_URL)
                              
                              let app = new Koa()
                              let router = new Router()
                              
                              app.use(cors());
                              
                              router.get('/',(ctx, next) => {
                                ctx.body = "Health Check Success";
                              })
                              .get('/someurltogetdatafrom', async (ctx, next) => {
                                ctx.body = JSON.stringify((await sql`
                                  select somePostgresqlFunction( SomeParameterName => ${ctx.request.query.someparameternamefromquerystringparameter}) as SomeName
                                  ;
                                `)[0].somename)
                              })
                              
                              app
                                .use(router.routes())
                                .use(router.allowedMethods());
                              
                              app.listen(8234);
                              
                              LanhildL 1 Reply Last reply
                              2
                              • ChristopherMagC ChristopherMag

                                @Lanhild I don't think I can share the full code but here is a relevant snippet if you wanted to get stated with using postgresql from within a nodejs cloudron app:

                                import Koa from 'koa'
                                import cors from '@koa/cors'
                                import Router from '@koa/router'
                                import { koaBody } from 'koa-body'
                                import postgres from 'postgres'
                                
                                var sql = postgres(process.env.CLOUDRON_POSTGRESQL_URL)
                                
                                let app = new Koa()
                                let router = new Router()
                                
                                app.use(cors());
                                
                                router.get('/',(ctx, next) => {
                                  ctx.body = "Health Check Success";
                                })
                                .get('/someurltogetdatafrom', async (ctx, next) => {
                                  ctx.body = JSON.stringify((await sql`
                                    select somePostgresqlFunction( SomeParameterName => ${ctx.request.query.someparameternamefromquerystringparameter}) as SomeName
                                    ;
                                  `)[0].somename)
                                })
                                
                                app
                                  .use(router.routes())
                                  .use(router.allowedMethods());
                                
                                app.listen(8234);
                                
                                LanhildL Offline
                                LanhildL Offline
                                Lanhild
                                App Dev
                                wrote on last edited by
                                #14

                                @ChristopherMag Thanks for sharing 👍

                                I've made a very simple custom app to deploy a psql DB using the Cloudron addon @ https://github.com/Lanhild/postgresql-cloudron

                                timconsidineT 1 Reply Last reply
                                2
                                • LanhildL Lanhild

                                  @ChristopherMag Thanks for sharing 👍

                                  I've made a very simple custom app to deploy a psql DB using the Cloudron addon @ https://github.com/Lanhild/postgresql-cloudron

                                  timconsidineT Offline
                                  timconsidineT Offline
                                  timconsidine
                                  App Dev
                                  wrote on last edited by
                                  #15

                                  @Lanhild neat 👍
                                  so you just connect to that custom app as you would normally to a remote hosted postgres db ?

                                  LanhildL 1 Reply Last reply
                                  1
                                  • timconsidineT timconsidine

                                    @Lanhild neat 👍
                                    so you just connect to that custom app as you would normally to a remote hosted postgres db ?

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

                                    @timconsidine Exactly, spin up the app, grep the environment variables for the DB credentials and connect to it

                                    1 Reply Last reply
                                    1
                                    • timconsidineT Offline
                                      timconsidineT Offline
                                      timconsidine
                                      App Dev
                                      wrote on last edited by
                                      #17

                                      👍
                                      Definitely worth adding to the AppStore.
                                      Not much additional maintenance associated with having it there.

                                      1 Reply Last reply
                                      2
                                      • ChristopherMagC Offline
                                        ChristopherMagC Offline
                                        ChristopherMag
                                        wrote on last edited by
                                        #18

                                        @Lanhild If you want to take this a step further an option I wanted to explore but am not sure whether it would work would be to use something like node-tcp-proxy as the application itself with 5432 as source and destination port such that someone could connect to the app's name on port 5432 and the app would proxy that tcp session back to the postgresql database on port 5432.

                                        There might be issues with this as I cannot think of another app example on cloudron that uses tcp without http on top so there may be some proxy stuff being done by cloudron itself before the connection makes it to the app that prevents this from working but it was on my list of things to try at some point.

                                        1 Reply Last reply
                                        0
                                        • ChristopherMagC Offline
                                          ChristopherMagC Offline
                                          ChristopherMag
                                          wrote on last edited by ChristopherMag
                                          #19

                                          @Lanhild Fyi, for me long term I think implementing PostgREST as a cloudron app is what I will eventually be aiming for as for me I am focused on postgresql and this app would eliminate the need for any code maintained by me in the cloudron app and just have my code in postgresql itself with the app dynamically building rest endpoints based on the code in postgresql.

                                          The tcp proxy solution if possible would be useful separately as it would allow us access to MySQL, Mongodb, Postgresql, Redis, etc. directly via proxying the respective cloudron app service.

                                          1 Reply Last reply
                                          1
                                          • E Offline
                                            E Offline
                                            eddowding
                                            wrote on last edited by
                                            #20

                                            Nudge on this! It looks like there are some good solutions which can easily add a lot of value!

                                            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