Clarify proxy documentation
- note that the port changes on every deploy when the proxy is disabled - make it clear that the proxy is being disabled for the app - note that the nginx-vhosts plugin supports the proxy plugin mapping - minor formatting changes [ci skip]
This commit is contained in:
1 parent
47dfde16f5
commit
a1ae7d76f4
1 file changed
+14
-5
+14
-5
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
> New as of 0.5.0
|
> New as of 0.5.0
|
||||||
|
|
||||||
As of dokku 0.5.0, the proxy functionality has been decoupled from the nginx-vhosts plugin into the proxy plugin. In the future this will allow other proxy software (HAproxy for example) to be used instead of nginx.
|
As of dokku 0.5.0, the proxy functionality has been decoupled from the nginx-vhosts plugin into the proxy plugin. In the future this will allow other proxy software (HAProxy for example) to be used instead of nginx.
|
||||||
|
|
||||||
```
|
```
|
||||||
proxy <app> Show proxy settings for app
|
proxy <app> Show proxy settings for app
|
||||||
@@ -13,9 +13,9 @@ proxy:set <app> <proxy-type> Set proxy type for app
|
|||||||
|
|
||||||
## Container network interface binding
|
## Container network interface binding
|
||||||
|
|
||||||
By default, the deployed docker container running your app's web process will bind to the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`). This behavior can be modified per app by disabling the proxy (i.e. `dokku proxy:disable <app>`). In this case, the container will bind to an external interface (i.e. 0.0.0.0) and your app container will be directly accessible by other hosts on your network.
|
By default, the deployed docker container running your app's web process will bind to the internal docker network interface (i.e. `docker inspect --format '{{ .NetworkSettings.IPAddress }}' $CONTAINER_ID`). This behavior can be modified per app by disabling the proxy (i.e. `dokku proxy:disable <app>`). In this case, the container will bind to an external interface (i.e. `0.0.0.0`) and your app container will be directly accessible by other hosts on your network.
|
||||||
|
|
||||||
> If a proxy is disabled, dokku will bind your container's port to a random port on the host, e.g. `0.0.0.0:32771->5000/tcp`.
|
> If a proxy is disabled, dokku will bind your container's port to a random port on the host for every deploy, e.g. `0.0.0.0:32771->5000/tcp`.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
# container bound to docker interface
|
# container bound to docker interface
|
||||||
@@ -23,9 +23,13 @@ $ docker ps
|
|||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute node-js-app.web.1
|
1b88d8aec3d1 dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute node-js-app.web.1
|
||||||
|
|
||||||
|
# internal IP address for the container
|
||||||
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
|
$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1
|
||||||
172.17.0.6
|
172.17.0.6
|
||||||
|
|
||||||
|
# disable the proxy so it listens on a host ip address
|
||||||
|
$ dokku proxy:disable node-js-app
|
||||||
|
|
||||||
# container bound to all interfaces
|
# container bound to all interfaces
|
||||||
$ docker ps
|
$ docker ps
|
||||||
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
|
||||||
@@ -43,17 +47,20 @@ proxy:ports-clear <app>
|
|||||||
proxy:ports-remove <app> <host-port> [<host-port>|<scheme>:<host-port>:<container-port>...] Unset proxy port mappings for app
|
proxy:ports-remove <app> <host-port> [<host-port>|<scheme>:<host-port>:<container-port>...] Unset proxy port mappings for app
|
||||||
```
|
```
|
||||||
|
|
||||||
You can now configure host -> container port mappings with the `proxy:ports-*` commands.
|
You can now configure `host -> container` port mappings with the `proxy:ports-*` commands. This mapping is currently supported by the built-in nginx-vhosts plugin.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ dokku proxy:ports node-js-app
|
$ dokku proxy:ports node-js-app
|
||||||
-----> Port mappings for node-js-app
|
-----> Port mappings for node-js-app
|
||||||
-----> scheme host port container port
|
-----> scheme host port container port
|
||||||
http 80 5000
|
http 80 5000
|
||||||
|
|
||||||
$ curl http://node-js-app.dokku.me
|
$ curl http://node-js-app.dokku.me
|
||||||
Hello World!
|
Hello World!
|
||||||
|
|
||||||
$ curl http://node-js-app.dokku.me:8080
|
$ curl http://node-js-app.dokku.me:8080
|
||||||
curl: (7) Failed to connect to node-js-app.dokku.me port 8080: Connection refused
|
curl: (7) Failed to connect to node-js-app.dokku.me port 8080: Connection refused
|
||||||
|
|
||||||
$ dokku proxy:ports-add node-js-app http:8080:5000
|
$ dokku proxy:ports-add node-js-app http:8080:5000
|
||||||
-----> Setting config vars
|
-----> Setting config vars
|
||||||
DOKKU_PROXY_PORT_MAP: http:80:5000 http:8080:5000
|
DOKKU_PROXY_PORT_MAP: http:80:5000 http:8080:5000
|
||||||
@@ -61,12 +68,14 @@ $ dokku proxy:ports-add node-js-app http:8080:5000
|
|||||||
-----> Creating http nginx.conf
|
-----> Creating http nginx.conf
|
||||||
-----> Running nginx-pre-reload
|
-----> Running nginx-pre-reload
|
||||||
Reloading nginx
|
Reloading nginx
|
||||||
|
|
||||||
$ curl http://node-js-app.dokku.me
|
$ curl http://node-js-app.dokku.me
|
||||||
Hello World!
|
Hello World!
|
||||||
|
|
||||||
$ curl http://node-js-app.dokku.me:8080
|
$ curl http://node-js-app.dokku.me:8080
|
||||||
Hello World!
|
Hello World!
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, buildpack apps and dockerfile apps **without** explicitly exposed ports (i.e. using the `EXPOSE` directive) will be configured with a listener on port `80` (and additionally a listener on 443 if ssl is enabled) that will proxy to the application container on port `5000`. Dockerfile apps **with** explicitly exposed ports will be configured with a listener on each exposed port and will proxy to that same port of the deployed application container.
|
By default, buildpack apps and dockerfile apps **without** explicitly exposed ports (i.e. using the `EXPOSE` directive) will be configured with a listener on port `80` (and additionally a listener on 443 if ssl is enabled) that will proxy to the application container on port `5000`. Dockerfile apps **with** explicitly exposed ports will be configured with a listener on each exposed port and will proxy to that same port of the deployed application container.
|
||||||
|
|
||||||
NOTE: This default behavior **will not** be automatically changed on subsequent pushes and must be manipulated with the `proxy:ports-*` syntax detailed above.
|
> NOTE: This default behavior **will not** be automatically changed on subsequent pushes and must be manipulated with the `proxy:ports-*` syntax detailed above.
|
||||||
Reference in new issue
Block a user