From 21055e669a54533b35ce822b4ce1b6a3785c0883 Mon Sep 17 00:00:00 2001 From: Paul Bienkowski Date: Wed, 2 Mar 2022 19:40:14 +0100 Subject: [PATCH] Document how to connect to postgresql --- README.md | 11 +++++++++++ deployment/README.md | 23 +++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/README.md b/README.md index fbb4254..8c351b7 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,17 @@ If any step of the instructions does not work for you, please open an issue and describe the problem you're having, as it is important to us that onboarding is super easy :) +### Connecting to the PostgreSQL database + +If you need to connect to your development PostgreSQL database, you should +install `psql` locally. The port 5432 is already forwarded, so you can connect with: + +``` +psql -h localhost -U obs -d obs +``` + +The password is `obs` as well. + ## License Copyright (C) 2020-2021 OpenBikeSensor Contributors diff --git a/deployment/README.md b/deployment/README.md index 8ef0ce6..e9e0e47 100644 --- a/deployment/README.md +++ b/deployment/README.md @@ -402,3 +402,26 @@ exporting that with an exclusion pattern instead of an explicit list. And then, please test your backup and restore strategy before going live, or at least before you need it! + + +### Connecting to the PostgreSQL database + +Here are the quick steps for connecting to your PostgreSQL database, should you +need that: + +* Add the `gateway` network to your `postgres` service. +* Add a port forwarding to your `postgres` service: + ```yaml + ports: + - 127.0.0.1:25432:5432 + ``` +* Run `docker-compose up -d postgres` again +* You can now connect from your server to the PostgreSQL service with: + + ``` + psql -h localhost -U obs -d obs -p 25432 + ``` + + You will need your database password for the connection. +* If you do not want to install `psql` outside your container, you can use an + SSH tunnel from your local machine to your server and run `psql` locally.