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/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/nginx.md b/docs/nginx.md index 4f739ae3f..09d03c29c 100644 --- a/docs/nginx.md +++ b/docs/nginx.md @@ -227,3 +227,7 @@ See the [ssl documentation](/dokku/deployment/ssl-configuration/). ## Disabling Nginx See the [proxy documentation](/dokku/proxy/). + +## Managing Proxy Port mappings + +See the [proxy documentation](/dokku/proxy/#proxy-port-mapping). diff --git a/docs/proxy.md b/docs/proxy.md index 4f3f2e245..c1ed7b112 100644 --- a/docs/proxy.md +++ b/docs/proxy.md @@ -1,38 +1,81 @@ # 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. +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 -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 -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 +# 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 -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 ``` + +## 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. 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 +-----> 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. 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