ubergeek77 / Lemmy-Easy-Deploy

Deploy Lemmy the easy way!
MIT License
135 stars 16 forks source link

Accessing the postgresql remotely. #35

Closed airjer closed 1 year ago

airjer commented 1 year ago

Hey what’s the quickest/easiest method for accessing and editing the postgresql inside the docker container? Google hasn’t helped me thus far.

ubergeek77 commented 1 year ago

To get a temporary shell into the container to run postgres commands, you can run this command:

docker compose -p lemmy-easy-deploy exec postgres psql -U lemmy

To expose the postgres port for remote access, you can create a folder called custom, copy the original docker-compose.yml.template into it, and add the port to the postgres service:

https://github.com/ubergeek77/Lemmy-Easy-Deploy/blob/main/ADVANCED_CONFIGURATION.md

Although that would come at a security risk.

Hope that helps!

airjer commented 1 year ago

It will once I get my instance back on track... I seem to have made it unconnectable now even locally. I redeployed and now it fails on the Postgres deployment saying it's unhealthy. Looking at the logs it is erroring out trying to connect. Anyway to force the defaults back on? or where would I edit the conf inside the now inactive Postgres docker? Thanks

ubergeek77 commented 1 year ago

Not really sure what you could have done, did you delete the postgres volume? Because it's possible your generated secrets don't match anymore.

If you want to "nuke everything" and start over, you can run docker volume ls to see what volumes you're using, run docker volume rm <volume> to remove the volumes one by one, rm -rf ./live to delete the entire deployment (including generated passwords!), then you can start over.

If you want to keep your data, it will be difficult to edit a file in a failing container, but you can check the README and supply a custom postgres.conf file that will override the original.

May I ask what you are trying to do?

airjer commented 1 year ago

I was trying all different ways of trying to access it remotely with a GUI. I think I inputted an IP for it somewhere that I shouldn't have and it has caused it to not be reachable anymore. One of the options has caused duplicate admins and I was wanting to edit that data to get rid of them.

airjer commented 1 year ago

I'm trying to pass on the the conf, yet it still continues to try to listen on the wrong IP I put in. May have to nuke everything.