From bc93e5da1797de7334e0c29844fd536688191175 Mon Sep 17 00:00:00 2001 From: Michael Hobbs Date: Fri, 24 Jun 2016 14:40:41 -0700 Subject: [PATCH 1/6] [ci skip] update docs with info about proxy port mapping default behavior --- docs/appendices/0.6.0-migration-guide.md | 6 ++++ docs/nginx.md | 2 +- docs/proxy.md | 36 ++++++++++++++++++++++-- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/docs/appendices/0.6.0-migration-guide.md b/docs/appendices/0.6.0-migration-guide.md index d5d773577..1d5da27dc 100644 --- a/docs/appendices/0.6.0-migration-guide.md +++ b/docs/appendices/0.6.0-migration-guide.md @@ -13,6 +13,12 @@ - You can now configure host -> container proxy port mappings - The UI is handled by the [proxy](/dokku/proxy/) interface plugin by setting the `DOKKU_PROXY_PORT_MAP` config variable in the format of `scheme:host-port:container-port`. The default `nginx-vhosts` proxy plugin supports both the `http` and `https` schemes. +- Default port mappings + - buildpack apps will be set to `http:80:5000` and will also include https:443:5000` if SSL is enabled. + - dockerfile apps with explicitly exposed ports (i.e. using the `EXPOSE` directive) will be configured with a listener on each exposed port that proxies to the same port of the deployed application container. + - You may override this behavior with the [`proxy:ports-*` commands](/dokku/proxy/) or by directly setting `DOKKU_PROXY_PORT_MAP` with the `config:set` command + - dockerfile apps without explicitly exposed ports will behave the same as a buildpack app + - NOTE: These defaults **are not** automatically changed on subsequent pushes and must be manipulated with the aforementioned commands ## calling the dokku binary diff --git a/docs/nginx.md b/docs/nginx.md index 4f739ae3f..d7efc6e56 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -224,6 +224,6 @@ See the [HSTS documentation](/dokku/deployment/ssl-configuration/#hsts-header). See the [ssl documentation](/dokku/deployment/ssl-configuration/). -## Disabling Nginx +## Disabling Nginx & Proxy port mappings See the [proxy documentation](/dokku/proxy/). diff --git a/docs/proxy.md b/docs/proxy.md index 4f3f2e245..cd5363914 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -1,7 +1,6 @@ # Proxy plugin > New as of 0.5.0 -> Port handling functionality is new as of 0.6.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. @@ -24,11 +23,11 @@ By default, the deployed docker container running your app's web process will bi ```shell # container bound to docker interface -root@dokku:~/dokku# docker ps +$ docker ps 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 -root@dokku:~/dokku# docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1 +$ docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1 172.17.0.6 # container bound to all interfaces @@ -36,3 +35,34 @@ root@dokku:/home/dokku# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1 ``` + +> New as of 0.6.0 +## Proxy port mapping + +You can now configure host -> container port mappings with the `proxy:ports-*` commands. + +```shell +$ dokku proxy:ports node-js-app +-----> Port mappings for node-js-app +-----> scheme host port container port +http 80 5000 +$ curl http://node-js-app.dokku.me +Hello World! +$ curl http://node-js-app.dokku.me:8080 +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 +-----> Setting config vars + DOKKU_PROXY_PORT_MAP: http:80:5000 http:8080:5000 +-----> Configuring node-js-app.dokku.me...(using built-in template) +-----> Creating http nginx.conf +-----> Running nginx-pre-reload + Reloading nginx +$ curl http://node-js-app.dokku.me +Hello World! +$ curl http://node-js-app.dokku.me:8080 +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. + +NOTE: This default behavior **will not** be automatically changed on subsequent pushes and must be manipulated with the `proxy:ports-*` syntax detailed above. From b7d1f54bd5acc8e36a561ddc9f25242b72a29639 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 24 Jun 2016 23:07:05 -0400 Subject: [PATCH 2/6] Fix header [ci skip] --- docs/nginx.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/nginx.md b/docs/nginx.md index d7efc6e56..a8ef0890e 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -224,6 +224,6 @@ See the [HSTS documentation](/dokku/deployment/ssl-configuration/#hsts-header). See the [ssl documentation](/dokku/deployment/ssl-configuration/). -## Disabling Nginx & Proxy port mappings +## Disabling Nginx & Managing Proxy Port mappings See the [proxy documentation](/dokku/proxy/). From 424827d8130fe7aa42e1381e42262e1559c32acb Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 24 Jun 2016 23:07:44 -0400 Subject: [PATCH 3/6] Move ports management section to new section This clarifies what was added when, and also sets a bit of a divide between the sections. [ci skip] --- docs/proxy.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/docs/proxy.md b/docs/proxy.md index cd5363914..57d685394 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -5,14 +5,10 @@ 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 Show proxy settings for app -proxy:disable Disable proxy for app -proxy:enable Enable proxy for app -proxy:ports List proxy port mappings for app -proxy:ports-add :: [::...] Set proxy port mappings for app -proxy:ports-clear Clear all proxy port mappings for app -proxy:ports-remove [|::...] Unset proxy port mappings for app -proxy:set Set proxy type for app +proxy Show proxy settings for app +proxy:disable Disable proxy for app +proxy:enable Enable proxy for app +proxy:set Set proxy type for app ``` ## Container network interface binding @@ -36,9 +32,17 @@ CONTAINER ID IMAGE COMMAND CREATED d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1 ``` -> New as of 0.6.0 ## Proxy port mapping +> New as of 0.6.0 + +``` +proxy:ports List proxy port mappings for app +proxy:ports-add :: [::...] Set proxy port mappings for app +proxy:ports-clear Clear all proxy port mappings for app +proxy:ports-remove [|::...] Unset proxy port mappings for app +``` + You can now configure host -> container port mappings with the `proxy:ports-*` commands. ```shell From 99632b714116d913a5e556854090130d33369f6c Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 24 Jun 2016 23:08:27 -0400 Subject: [PATCH 4/6] Link directly to proxy port mapping section [ci skip] --- docs/nginx.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/nginx.md b/docs/nginx.md index a8ef0890e..09d03c29c 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -224,6 +224,10 @@ See the [HSTS documentation](/dokku/deployment/ssl-configuration/#hsts-header). See the [ssl documentation](/dokku/deployment/ssl-configuration/). -## Disabling Nginx & Managing Proxy Port mappings +## Disabling Nginx See the [proxy documentation](/dokku/proxy/). + +## Managing Proxy Port mappings + +See the [proxy documentation](/dokku/proxy/#proxy-port-mapping). From 47dfde16f51a09987ed15efd76860268ac53caf4 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 24 Jun 2016 23:21:12 -0400 Subject: [PATCH 5/6] Use $ to signify bash command prompts [ci skip] --- docs/deployment/images.md | 8 ++++---- docs/deployment/ssl-configuration.md | 2 +- docs/proxy.md | 2 +- docs/troubleshooting.md | 12 ++++++------ 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/docs/deployment/images.md b/docs/deployment/images.md index 86c4e3e34..47c5de0c3 100644 --- a/docs/deployment/images.md +++ b/docs/deployment/images.md @@ -14,21 +14,21 @@ tags:destroy Remove app image tag Example: ``` -root@dokku:~# dokku tags node-js-app +$ dokku tags node-js-app =====> Image tags for dokku/node-js-app REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB -root@dokku:~# dokku tags:create node-js-app v0.9.0 +$ dokku tags:create node-js-app v0.9.0 =====> Added v0.9.0 tag to dokku/node-js-app -root@dokku:~# dokku tags node-js-app +$ dokku tags node-js-app =====> Image tags for dokku/node-js-app REPOSITORY TAG IMAGE ID CREATED VIRTUAL SIZE dokku/node-js-app latest 936a42f25901 About a minute ago 1.025 GB dokku/node-js-app v0.9.0 936a42f25901 About a minute ago 1.025 GB -root@dokku:~# dokku tags:deploy node-js-app v0.9.0 +$ dokku tags:deploy node-js-app v0.9.0 -----> Releasing node-js-app (dokku/node-js-app:v0.9.0)... -----> Deploying node-js-app (dokku/node-js-app:v0.9.0)... -----> Running pre-flight checks diff --git a/docs/deployment/ssl-configuration.md b/docs/deployment/ssl-configuration.md index b20aedf54..adcd5b83d 100644 --- a/docs/deployment/ssl-configuration.md +++ b/docs/deployment/ssl-configuration.md @@ -54,7 +54,7 @@ If you decide to obtain a CA signed certficate, you can import that certificate The `certs:info` command will simply inspect the install SSL cert and print out details. NOTE: The server-wide certificate will be inspect if installed and no app-specific certificate exists. ``` -root@dokku:~/dokku# dokku certs:info node-js-app +$ dokku certs:info node-js-app -----> Fetching SSL Endpoint info for node-js-app... -----> Certificate details: =====> Common Name(s): diff --git a/docs/proxy.md b/docs/proxy.md index 57d685394..5cc330044 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -27,7 +27,7 @@ $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1 172.17.0.6 # container bound to all interfaces -root@dokku:/home/dokku# docker ps +$ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d6499edb0edb dokku/node-js-app:latest "/bin/bash -c '/star About a minute ago Up About a minute 0.0.0.0:49153->5000/tcp node-js-app.web.1 ``` diff --git a/docs/troubleshooting.md b/docs/troubleshooting.md index 03d6e077a..5a6da26c6 100644 --- a/docs/troubleshooting.md +++ b/docs/troubleshooting.md @@ -7,7 +7,7 @@ __Solution:__ Most of the time it's caused by some defaults newer versions of nginx set. To make sure that's the issue you're having run the following: ``` -root@dockerapps:/home/git# nginx +$ nginx -t nginx: [emerg] could not build the server_names_hash, you should increase server_names_hash_bucket_size: 32 ``` @@ -27,9 +27,9 @@ A value of 64 would allow domains with up to 64 characters. Set it to 128 if you Save the file and try stopping nginx and starting it again: ``` -root@dockerapps:~/dokku# /etc/init.d/nginx stop +$ /etc/init.d/nginx stop * Stopping nginx nginx [ OK ] -root@dockerapps:~/dokku# /etc/init.d/nginx start +$ /etc/init.d/nginx start * Starting nginx nginx [ OK ] ``` @@ -65,14 +65,14 @@ __Solution (Less solution, more helpful troubleshooting steps):__ Find the failed phase's container image (*077581956a92* in this example) ``` - root@dokku:~# docker ps -a | grep build + $ docker ps -a | grep build 94d9515e6d93 077581956a92 "/build" 29 minutes ago Exited (0) 25 minutes ago cocky_bell ``` Start a new container with the failed image and poke around (i.e. ensure you can access the internet from within the container or attempt the failed command, if known) ``` - root@dokku:~# docker run -ti 077581956a92 /bin/bash + $ docker run -ti 077581956a92 /bin/bash root@9763ab86e1b4:/# curl -s -S icanhazip.com 192.168.0.1 curl http://s3pository.heroku.com/node/v0.10.30/node-v0.10.30-linux-x64.tar.gz -o node-v0.10.30-linux-x64.tar.gz @@ -84,7 +84,7 @@ __Solution (Less solution, more helpful troubleshooting steps):__ Additionally we've seen issues if changing networks that have different DNS resolvers. In this case, you can run the following to update your resolv.conf ``` - root@dokku:~# resolvconf -u + $ resolvconf -u ``` Please see https://github.com/dokku/dokku/issues/841 and https://github.com/dokku/dokku/issues/649 From a1ae7d76f45c72709546f8d84353f551a84f62a1 Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Fri, 24 Jun 2016 23:22:50 -0400 Subject: [PATCH 6/6] 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] --- docs/proxy.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/docs/proxy.md b/docs/proxy.md index 5cc330044..c1ed7b112 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -2,7 +2,7 @@ > 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 Show proxy settings for app @@ -13,9 +13,9 @@ proxy:set Set proxy type for app ## 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 `). 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 `). 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 # container bound to docker interface @@ -23,9 +23,13 @@ $ docker ps 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 +# internal IP address for the container $ docker inspect --format '{{ .NetworkSettings.IPAddress }}' node-js-app.web.1 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 $ docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES @@ -43,17 +47,20 @@ proxy:ports-clear proxy:ports-remove [|::...] 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 $ dokku proxy:ports node-js-app -----> Port mappings for node-js-app -----> scheme host port container port http 80 5000 + $ curl http://node-js-app.dokku.me Hello World! + $ curl http://node-js-app.dokku.me:8080 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 -----> Setting config vars 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 -----> Running nginx-pre-reload Reloading nginx + $ curl http://node-js-app.dokku.me Hello World! + $ curl http://node-js-app.dokku.me:8080 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. -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.