You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by sr...@apache.org on 2021/08/02 14:47:42 UTC

[superset] branch master updated: docs: add instructions for how to connect to local database from docker container (#15936)

This is an automated email from the ASF dual-hosted git repository.

srini pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new 31d79ff  docs: add instructions for how to connect to local database from docker container (#15936)
31d79ff is described below

commit 31d79ff67c805c320fbd6bfd75d972800ed18b86
Author: Sarthak Agrawal <sa...@gmail.com>
AuthorDate: Mon Aug 2 20:16:32 2021 +0530

    docs: add instructions for how to connect to local database from docker container (#15936)
    
    * Update installation instructions for docker
    
    Update installation instructions to include a section on
    connecting to local db via superset running in docker container.
    
    Newcomers may have trouble in this part because it involves
    knowing about some docker internal details, as well as
    google search doesn't bring many directly useful results.
    
    If it's a commonly occurring issue among new comers,
    we may accept this commit.
    
    * Update index.mdx
    
    Add a caution regarding changing database config to allow public incoming.
    Add a note that mac users may skip configuring database.
    Spelling mistake fix.
    Style fix, "Superset" is now in title case.
---
 docs/src/pages/docs/installation/index.mdx | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/docs/src/pages/docs/installation/index.mdx b/docs/src/pages/docs/installation/index.mdx
index 81bbf60..508fa27 100644
--- a/docs/src/pages/docs/installation/index.mdx
+++ b/docs/src/pages/docs/installation/index.mdx
@@ -100,3 +100,13 @@ username: admin
 ```bash
 password: admin
 ```
+
+
+### 5. Connecting your local database instance to superset
+
+When running Superset using `docker` or `docker-compose` it runs in its own docker container, as if the Superset was running in a separate machine entirely. Therefore attempts to connect to your local database with hostname `localhost` won't work as `localhost` refers to the docker container Superset is running in, and not your actual host machine. Fortunately, docker provides an easy way to access network resources in the host machine from inside a container, and we will leverage this c [...]
+
+Here the instructions are for connecting to postgresql (which is running on your host machine) from Superset (which is running in its docker container). Other databases may have slightly different configurations but gist would be same and boils down to 2 steps -
+
+1. **(Mac users may skip this step)** Configuring the local postgresql/database instance to accept public incoming connections. By default postgresql only allows incoming connections from `localhost` only, but re-iterating once again, `localhosts` are different for host machine and docker container. For postgresql this involves make one-line changes to the files `postgresql.conf` and `pg_hba.conf`, you can find helpful links tailored to your OS / PG version on the web easily for this tas [...]
+2. Instead of `localhost`, try using `host.docker.internal` (Mac users) or `172.18.0.1` (Linux users) as the host name when attempting to connect to the database. This is docker internal detail, what is happening is that in Mac systems docker creates a dns entry for the host name `host.docker.internal` which resolves to the correct address for the host machine, whereas in linux this is not the case (at least by default). If neither of these 2 hostnames work then you may want to find the  [...]