feat: write auto-detected port mappings during a deploy
During an app build, we now auto-detect ports based on the source code. This is usually http:80:5000, with Dockerfile-based deploys having their ports extracted from the docker image or Dockerfile. Additionally, we add an https:443 mapping for any detected http:80 mapping when there is an ssl certificate, and all http port mappings are transformed to https mappings for Dockerfile-based deploys. While the ports aren't currently consumed, a future refactor will provide the ability to fallback to the new detected ports when there is no user-specified port mapping.
This commit is contained in:
@@ -1292,7 +1292,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description: Returns a list of port mappings, newline delimited
|
||||
- Invoked by: Various networking plugins
|
||||
- Arguments `$APP`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -1307,7 +1307,21 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description: Prints out an available port greater than 1024
|
||||
- Invoked by: Various networking plugins
|
||||
- Arguments `$APP`
|
||||
- Arguments: `$APP`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
# TODO
|
||||
```
|
||||
|
||||
### `ports-set-detected`
|
||||
- Description: Allows builders to specify detected port mappings for a given app
|
||||
- Invoked by: Builder plugins
|
||||
- Arguments: `$APP [$PORT_MAPPING...]`
|
||||
- Example:
|
||||
|
||||
```shell
|
||||
@@ -1480,7 +1494,7 @@ set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x
|
||||
|
||||
- Description: This trigger should be used to do stuff to containers after they are created but before they are started. They are explicitely for commands that may involve network traffic, and _not_ for commands that are self-contained, such as chown or tar.
|
||||
- Invoked by: `dokku run`, `dokku ps:rebuild`, `dokku deploy`
|
||||
- Arguments "app|service" "$CONTAINER_ID" "$APP|$SERVICE" "$PHASE"
|
||||
- Arguments: "app|service" "$CONTAINER_ID" "$APP|$SERVICE" "$PHASE"
|
||||
|
||||
```shell
|
||||
#!/usr/bin/env bash
|
||||
|
||||
@@ -212,11 +212,14 @@ dokku ports:report
|
||||
|
||||
```
|
||||
=====> node-js-app ports information
|
||||
Port map: http:80:5000 https:443:5000
|
||||
Port map detected: http:80:5000
|
||||
Port map: http:80:5000 https:443:5000
|
||||
=====> python-sample ports information
|
||||
Port map: http:80:5000
|
||||
Port map detected: http:80:5000
|
||||
Port map: http:80:5000
|
||||
=====> ruby-sample ports information
|
||||
Port map: http:80:5000
|
||||
Port map detected: http:80:5000
|
||||
Port map: http:80:5000
|
||||
```
|
||||
|
||||
You can run the command for a specific app also.
|
||||
@@ -227,7 +230,8 @@ dokku ports:report node-js-app
|
||||
|
||||
```
|
||||
=====> node-js-app ports information
|
||||
Port map: http:80:5000 https:443:5000
|
||||
Port map detected: http:80:5000
|
||||
Port map: http:80:5000 https:443:5000
|
||||
```
|
||||
|
||||
You can pass flags which will output only the value of the specific information you want. For example:
|
||||
|
||||
Reference in New Issue
Block a user