Forem Creators and Builders 🌱

Lee
Lee

Posted on

Forem Selfhost. Restoring a database.

Hey there,

I have had a nosey at the selfhost docs but I can't find any instructions on how to restored a database from a forem PostGres backup.

Can anyone point me in the right direction?

ta!

Top comments (10)

Collapse
 
ellativity profile image
Ella (she/her/elle)

Which hosting service are you using, because that may also be a factor?

For example, Digital Ocean has docs here and I think you have at least one Heroku instance

Collapse
 
lee profile image
Lee

Would you mind asking if I need the full PostGres URI if I am connecting to a restored AWS RDS database?

I am attempting configure ansible for AWS RDS rather than localhost, then boot a self host forem and then restore the DB from an existing forem DB.

Collapse
 
ellativity profile image
Ella (she/her/elle)

Also from my reliable source @andygeorge :

Selfhost runs PostGres itself, and doesn't use AWS RDS... it runs PostGres locally on the selfhost VM instance (eg AWS EC2 instance). The forem-postgres.service service manages the PostGres process directly

Ooooh, does @andrewbrown's post help with some of this?

Thread Thread
 
lee profile image
Lee

Ah yes it does, it validates that Selfhost can run with the db on RDS, I can see the @jdoss has commented that you can just specify the following values before launching the ansible build, I just want to check the format should be:

postgres_user: postgres
postgres_password: "xxxxxxxxxxx"
postgres_host: xxxx.xxxx.eu-west-2.rds.amazonaws.com

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

@jdoss said that should work, so looking forward to hearing more from you about how you get on with it!

Thread Thread
 
lee profile image
Lee

It doesn't :( everything is in place, there are no errors from the build, jsut no database is commissioned so the app isn't available. Have reverted back to local but it would be good to be able to abstract the DB in RDS and take advantage of all the cool backup and scalability features 😎

Thread Thread
 
ellativity profile image
Ella (she/her/elle)

Another question (sorry, I know you're here for answers 😉): are you attempting this with a life-and-in-person Forem?

If I understand @jdoss correctly, you either need to

stop your Forem, dump the DB, import it to the RDS and then edit the Forem configs to point it at your RDS instance

Alternatively,

start it from scratch for Ansible to write these changes

If not, this is curiouser and curiouser (and I'll be happy to continue relaying questions to our team for ideas on why it's not working).

Collapse
 
lee profile image
Lee

Hey @ellativity 🤩 I am using AWS (I am also assuming here that selfhost deploys PostGres)

Collapse
 
ellativity profile image
Ella (she/her/elle)

I asked around, and had a reliable source inform me:

It should be possible to pg_dump from your existing database and psql restore it into the selfhost database.
The selfhost database uses these variables for credentials with vault_forem_postgres_password being defined below that

This should work on all selfhost Forems 🤞

Thread Thread
 
lee profile image
Lee

Perfect, as usual, exactly what I needed 🤩