MySQL and Postgresql as standalone apps
-
wrote on Apr 28, 2022, 7:25 PM last edited by ChristopherMag Apr 28, 2022, 7:27 PM
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.
-
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.
wrote on Apr 28, 2022, 7:37 PM last edited by@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.
-
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).
-
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).
wrote on May 2, 2022, 3:06 PM last edited by@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.
-
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).
-
wrote on May 21, 2022, 6:33 PM last edited by
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.
-
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.
wrote on May 21, 2022, 6:48 PM last edited by@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
-
@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
@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
-
wrote on Jan 16, 2023, 3:05 PM last edited by
+10000 from me too. A standalone database app would be very useful.
-
wrote on Jan 26, 2024, 3:47 PM last edited by
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.
-
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.
App Devwrote on Jan 26, 2024, 11:06 PM last edited by Lanhild Jan 26, 2024, 11:06 PM@ChristopherMag Thanks for the info!
Do you mind sharing your custom application code? I'm very interested in that.
-
wrote on Feb 22, 2024, 9:41 PM last edited by
@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);
-
@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);
@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
-
@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
@Lanhild neat
so you just connect to that custom app as you would normally to a remote hosted postgres db ? -
@Lanhild neat
so you just connect to that custom app as you would normally to a remote hosted postgres db ?@timconsidine Exactly, spin up the app, grep the environment variables for the DB credentials and connect to it
-
Definitely worth adding to the AppStore.
Not much additional maintenance associated with having it there. -
wrote on Mar 11, 2024, 3:50 PM last edited by
@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.
-
wrote on Mar 11, 2024, 3:54 PM last edited by ChristopherMag Mar 11, 2024, 3:55 PM
@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.
-
wrote 22 days ago last edited by
Nudge on this! It looks like there are some good solutions which can easily add a lot of value!