Using a PGSQL database outside of Docker?

I’m doing the standard Docker installation of Discourse, however it appears that there are some quirks regarding the database. First, I don’t see any listing for a production database within the config/database.yml (only development, test and profile), but it appears that the Dockerized system is using PostgreSQL.

What is the proper method for directing the standard Dockerized installation to use a PostgreSQL database on another server?

I would start with

Can’t promise it still doesn’t use Docker, but it might get you started on the right track.

4 Likes

Thanks @cpradio this worked out rather well and works with any database (ie, even non-Docker database instances), but there was one major hiccup: It’s not made clear that the process will not transfer the database info over and any existing tables will be effectively lost.

I guess the followup would be: If one were to want to retain the data after moving to a separate database, what’s the process for that?

Take a backup before, restore after.

4 Likes

Yeah, was afraid you’d say that @Falco. :wink: I guess the question evolves to be: how do you get a backup of the pgsql instance that Discourse is using / how do you get into that instance? ./launcher enter postgres?

So I’ve removed the template line from the app.yml, I guess that means I need to put that back in and then ./launcher rebuild app? Or is there a better way?

And if I do this, does that mean it will try to use the Docker pgsql db again and thus screw the app up temporarily while I have that active?

I guess a kind of complete snapshot of what’s happening there and how to interact with it and what’s to be expected (such as perhaps the new external db no longer being used temporarily while recovering the Dockerized pgsql instance)…