thathert commented on a change in pull request #15936:
URL: https://github.com/apache/superset/pull/15936#discussion_r679053984



##########
File path: docs/src/pages/docs/installation/index.mdx
##########
@@ -100,3 +100,11 @@ 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 seperate 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, we will leverage this capability to connect to our local database 
instance. 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 -

Review comment:
       seperate -> separate
   
   Also one style thing, it looks like Superset is capitalized in the rest of 
this doc. Good to stay consistent

##########
File path: docs/src/pages/docs/installation/index.mdx
##########
@@ -100,3 +100,11 @@ 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 seperate 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, we will leverage this capability to connect to our local database 
instance. 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. 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 task.
+2. Instead of `localhost`, try using `host.docker.internal` or `172.18.0.1` as 
the host name when attempting to connect to the database. This is docker 
internal detail, to find the exact host name you want to use you can also do 
`ifconfig` or `ip addr show` and look at the ip address of `docker0` interface 
that must have been created by docker for you.

Review comment:
       You can also look at the gateway ip in the output of `docker network 
inspect bridge`

##########
File path: docs/src/pages/docs/installation/index.mdx
##########
@@ -100,3 +100,11 @@ 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 seperate 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, we will leverage this capability to connect to our local database 
instance. 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. 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 task.

Review comment:
       I'd add two caveats here:
   1. This absolutely should never be done in production, and you should 
understand the security risks of allowing incoming connections to your local 
database.
   2. This normally shouldn't be necessary (at least on a mac). I didn't have 
to do this on my local setup because when connecting via `host.docker.internal` 
it looks like the connection is coming from your host network.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to