Hosting PostgreSQL


#1

I searched around and didn’t see anything about this asked before, but is there support for a PostgreSQL server on glitch, or will it have to be hosted somewhere else?


#2

You should host it somewhere else. You can only open one port in your Glitch app, so you would have a lot of work to do to share that port with Postgres.


#3

Well I’d just be hosting it for my application, not for anything else. I would only be accessing it from glitch, and from my previous testing, it seems that you can have multiple ports opened up on it, but only 3000 is accessible outside the container.


#4

As Tim said, it’s not impossible but it’s not an efficient use of time. You’d have to proxy the requests, directing each one to the appropriate port through the one open port. You’d be better of using another database type that you don’t need a client for or hosting it elsewhere.


#5

I don’t really get how it would be harder if I would only be accessing it locally. I was messing with proxying multiple HTTP servers within 1 glitch project (on separate ports), and saw that you can do localhost:otherport from within the project. Wouldn’t a database basically be the same thing on localhost?


#6

Yes, if you just want your project to hit it, you could do that. You would have to worry about starting/stopping the database, though. You might be better off with sqlite - there’s an example you can start from here: https://glitch.com/~sqlite3-db


#7

I’ve used sqlite before, I recently switched over to using postgresql for things, though. Are there instructions somewhere on setting up postgresql?


#8

No, you’re the first person who has asked for it.