Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

postgres documentation lacks information on use with docker #8304

Open
richvdh opened this issue Sep 12, 2020 · 6 comments
Open

postgres documentation lacks information on use with docker #8304

richvdh opened this issue Sep 12, 2020 · 6 comments
Labels
A-Docker Docker images, or making it easier to run Synapse in a container. A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label)

Comments

@richvdh
Copy link
Member

richvdh commented Sep 12, 2020

(see: https://github.com/matrix-org/synapse/blob/master/docs/postgres.md)

... in particular, it doesn't say how to run synapse_port_db

@richvdh
Copy link
Member Author

richvdh commented Sep 12, 2020

For the record, I think you can do something like:

docker run --rm -it \
    --mount type=volume,src=synapse-data,dst=/data \
    --entrypoint /usr/local/bin/synapse_port_db \
    matrixdotorg/synapse:latest \
    --sqlite-database /data/homeserver.db.snapshot \
    --postgres-config /data/homeserver-postgres.yaml

@erikjohnston erikjohnston added A-Docker Docker images, or making it easier to run Synapse in a container. A-Docs things relating to the documentation Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label) labels Sep 14, 2020
@beda17
Copy link

beda17 commented Dec 8, 2021

For those using docker-compose:

docker-compose run --rm --entrypoint /usr/local/bin/synapse_port_db synapse --sqlite-database=/data/homeserver.db --postgres-config=/data/homeserver_new.yaml --curse

synapse ............................. your synapse container name
homeserver.db .................. your sqlite database file
homeserver_new.yaml ...... your new config file

Don't forget to start your postgresdb first and learn from my mistake: If you limit the postgresql container memory, give enough.

@richvdh
Copy link
Member Author

richvdh commented Dec 9, 2021

@beda17 would you be able to open a PR to add this to the documentation?

@beda17
Copy link

beda17 commented Dec 13, 2021

I am not a programmer, but I am using git for few months and I would like to contribute. I will get my courage together and try to propose a PR.

@chmac
Copy link
Contributor

chmac commented Dec 23, 2021

Another option to run synapse_port_db is to remove the PORTS option in the docker compose file, thus taking the server offline, get a bash terminal like docker exec -it synapse_container_id /bin/bash and then run the script. Ugly, but it gets the job done.

@chmac
Copy link
Contributor

chmac commented Dec 23, 2021

I've submitted a PR which addresses some of these topics, links to this issue, and mentions in the example compose file that it's necessary to actually enable postgres in the config file, otherwise sqlite is the default.

@DMRobertson DMRobertson added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Jan 27, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Docker Docker images, or making it easier to run Synapse in a container. A-Docs things relating to the documentation T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. Z-Help-Wanted We know exactly how to fix this issue, and would be grateful for any contribution z-p3 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

5 participants