refactor: only use detected port mapping if override is not specified
Previously, we would always set the port mapping during a dockerfile build, making it difficult for users to override mappings. We also only _sometimes_ updated the detected port mapping, further confusing issues when users were migrating from Dockerfile to Buildpacks for builds. Now, we always detect the port mapping during the build process, and only use that detected port mapping if an override is not specified. This greatly simplifies the experience around port mapping, as now a user can create an app, set a port mapping, and that first deploy will respect the port mapping without an additional deploy. The builder always has the best context for what the app should be listening on, and thus we can always specify a "default" port mapping at this stage. Users can override this map as desired later. This change also results in the removal of a ton of internal code that is now centralized in the ports plugin. Closes #4067
This commit is contained in:
1 parent
6168b0c71c
commit
f8ccf52079
36 files changed
+238
-416
No files matched your search
+20
-15
@@ -34,60 +34,65 @@ teardown() {
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:list $TEST_APP | xargs"
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http 1234 5001"
|
||||
assert_output "http:1234:5001"
|
||||
|
||||
run /bin/bash -c "dokku ports:add $TEST_APP http:8080:5002 https:8443:5003"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:list $TEST_APP | xargs"
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http 1234 5001 http 8080 5002 https 8443 5003"
|
||||
assert_output "http:1234:5001 http:8080:5002 https:8443:5003"
|
||||
|
||||
run /bin/bash -c "dokku ports:set $TEST_APP http:8080:5000 https:8443:5000 http:1234:5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:list $TEST_APP | xargs"
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http 1234 5001 http 8080 5000 https 8443 5000"
|
||||
assert_output "http:1234:5001 http:8080:5000 https:8443:5000"
|
||||
|
||||
run /bin/bash -c "dokku ports:remove $TEST_APP 8080"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:list $TEST_APP | xargs"
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http 1234 5001 https 8443 5000"
|
||||
assert_output "http:1234:5001 https:8443:5000"
|
||||
|
||||
run /bin/bash -c "dokku ports:remove $TEST_APP http:1234:5001"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:list $TEST_APP | xargs"
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "https 8443 5000"
|
||||
assert_output "https:8443:5000"
|
||||
|
||||
run /bin/bash -c "dokku ports:clear $TEST_APP"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_success
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:list $TEST_APP | xargs"
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http 80 5000"
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku --quiet ports:report $TEST_APP --ports-map-detected"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http:80:5000"
|
||||
}
|
||||
|
||||
@test "(ports:add) post-deploy add" {
|
||||
@@ -138,7 +143,7 @@ teardown() {
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http:80:5000 https:443:5000"
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map-detected"
|
||||
echo "output: $output"
|
||||
@@ -155,7 +160,7 @@ teardown() {
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http:3000:3000 http:3003:3003"
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map-detected"
|
||||
echo "output: $output"
|
||||
@@ -170,7 +175,7 @@ teardown() {
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map"
|
||||
echo "output: $output"
|
||||
echo "status: $status"
|
||||
assert_output "http:3000:3000 http:3003:3003"
|
||||
assert_output_not_exists
|
||||
|
||||
run /bin/bash -c "dokku ports:report $TEST_APP --ports-map-detected"
|
||||
echo "output: $output"
|
||||
|
||||
Reference in new issue
Block a user