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.9k 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 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
                • canadaduaneC Offline
                  canadaduaneC Offline
                  canadaduane
                  wrote on last edited by
                  #21

                  Would love to see this. Self-hosted database makes n8n much more powerful.

                  1 Reply Last reply
                  0
                  • robiR Offline
                    robiR Offline
                    robi
                    wrote on last edited by
                    #22

                    Does PocketBase fill that gap?

                    Conscious tech

                    1 Reply Last reply
                    1
                    • canadaduaneC Offline
                      canadaduaneC Offline
                      canadaduane
                      wrote on last edited by
                      #23

                      Does PocketBase fill that gap?

                      PocketBase is interesting, but I wouldn't reach for it first for core application state. Postgres is "boring technology" which is great for reliability, well-known, well-understood etc. That said, I'm sure PocketBase fills an important niche.

                      robiR 1 Reply Last reply
                      0
                      • canadaduaneC canadaduane

                        Does PocketBase fill that gap?

                        PocketBase is interesting, but I wouldn't reach for it first for core application state. Postgres is "boring technology" which is great for reliability, well-known, well-understood etc. That said, I'm sure PocketBase fills an important niche.

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

                        @canadaduane Postgres doesn't have to be boring.

                        It can be a full stack system all-in-one!

                        Why bother with other things when it all comes down to the DB.
                        Have it do it!

                        See https://github.com/shouryashashank/pg-fullstack

                        Conscious tech

                        1 Reply Last reply
                        1
                        • D Offline
                          D Offline
                          DualOSWinWiz
                          wrote on last edited by
                          #25

                          I was also looking for this option but too lenghty to make a custom app on cloudron and due to these limitation i deployed portainer on intranetwork and proxy the portainer gui with cloudron app proxy as its on a seperate ubuntu and i have PG, MSSQL and MongoDB their

                          1 Reply Last reply
                          0
                          • M Offline
                            M Offline
                            msbt
                            App Dev
                            wrote on last edited by
                            #26

                            A standalone, fully customizable PostgreSQL would be nice indeed, I have a use-case where the timescaledb extension is required, has anyone tried that before?

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