Using Postgres inside apps

40 views
Skip to first unread message

Zach Balleisen

unread,
Mar 29, 2020, 1:36:21 PM3/29/20
to Sandstorm Development
Hi,

I'm really struggling to get Postgres working with Weblate, a Django app. (It appears that only Postgres will be supported going forward, so I think it makes sense to use it despite not being ideal in a Sandstorm context.) Does anyone know which apps already use Postgres, and might be good to emulate?

Best,
Zach Balleisen

Dan Krol

unread,
Mar 29, 2020, 1:42:30 PM3/29/20
to Zach Balleisen, Sandstorm Development
I'm in the middle of working on an application that uses postgres. I got it to work, though I haven't had a signoff on it yet as to whether I'm doing it the best way. I'll try to get it up on github for you soon so you can try it out!

--
You received this message because you are subscribed to the Google Groups "Sandstorm Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sandstorm-dev/20d876a1-cf9d-416c-bf24-1182daeaa59b%40googlegroups.com.

Dan Krol

unread,
Mar 29, 2020, 4:32:51 PM3/29/20
to Zach Balleisen, Sandstorm Development
I decided to cut my code down to the bits that are relevant to postgres for what I'll show you. A handful of caveats:

* This is very WIP, along with some TODOs and other notes to self that you may want to consider as well (I'm happy to get critiques from you and others as well here; I was gonna solicit opinions on this eventually anyway)
* This may or may not be optimized for running multiple times; some parts may want to be split out for initialization
* This was written for spk, not vagrant-spk. Based on Debian Buster.
* It may not work out of the box. Again I ripped out everything unrelated.
* postrges.conf is a modified version of the default. I don't remember if I took notes on what I changed and why, but I should do so before releasing. Look for the "TODO"s there for at least a couple of them. And/or you could diff with the one in /etc/, or the one that gets generated in /var/ under normal circumstances when running postgres.
* The "/var/pgtest/x/" path stuff you see was probably just related to the tests I was doing, or maybe it was to avoid conflict with the existing installation of postgres. At any rate, I think nothing's particularly special about the path other than that it's under /var/
* There's probably extra noise in the "create superusers, create tables" part of it. It was the result of experimentation and I should cut it down to all I really need there. Also what I do there is related to the specific application I'm working on, but you should ideally be able to do any sort of table creations and queries at that point in the script.

Gonna try Gogs on for size for sharing this. If you visit this and click "Explore" you should see the repo with list of files:


Let me know if you have problems, I may have seen the same ones recently.

-Dan



Dan Krol

unread,
Mar 29, 2020, 4:35:34 PM3/29/20
to Zach Balleisen, Sandstorm Development
(I, and others here I've asked, don't think there are any apps in the Marketplace that use Postgres at the moment.)

Zach Balleisen

unread,
Mar 29, 2020, 9:20:24 PM3/29/20
to Dan Krol, Sandstorm Development
Thank you so much for this! Nolan Darilek seemed to have gotten it working in his attempt to port Loomio, but I was really struggling to follow his example. I'll try to follow your approach, and will  definitely ask if I have any problems.

Thanks,
Zach Balleisen

Jacob Weisz

unread,
Mar 29, 2020, 10:13:39 PM3/29/20
to sandst...@googlegroups.com
As a note, Loomio would be probably really interesting on Sandstorm still.

--
  Jacob Weisz

Reply all
Reply to author
Forward
0 new messages