Skip to content

Instantly share code, notes, and snippets.

@nota-ja
Last active August 18, 2022 15:37

Revisions

  1. nota-ja created this gist Mar 29, 2017.
    13 changes: 13 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    # "Multiple App Ports" Demo on Cloud Foundry

    2017.03.29

    These demos are validated against:

    * [cf-release v251](https://github.com/cloudfoundry/cf-release/tree/v251)
    * [diego-release v1.5.3](https://github.com/cloudfoundry/diego-release/tree/v1.5.3)
    * [routing-release v0.143.0](https://github.com/cloudfoundry-incubator/routing-release/tree/0.143.0)

    on [bosh-lite (11025e9166499ee35ee04d243d1407024b97a2c6)](https://github.com/cloudfoundry/bosh-lite/tree/11025e9166499ee35ee04d243d1407024b97a2c6).

    The demo app is in [cf-acceptance-tests (84a19e6ce1eb39d7109eb9cc0a19ca6105dc4e58)](https://github.com/cloudfoundry/cf-acceptance-tests/tree/84a19e6ce1eb39d7109eb9cc0a19ca6105dc4e58/assets/multi-port-app).
    25 changes: 25 additions & 0 deletions operations-for-http.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,25 @@
    # "Multiple App Ports" Demo Operations for HTTP Routing

    1. Cloning demo app
    Using cf-acceptance-tests/assets/multi-port-app
    * `git clone https://github.com/cloudfoundry/cf-acceptance-tests.git`
    1. Creating routes
    * (confirmation before operations) `cf routes`
    * `cf create-route demo-spc bosh-lite.com --hostname mpg2`
    * (confirmation after operations) `cf routes`
    1. Pushing app with listening multiple ports
    * `cf push mpg -c 'go-online --ports=7777,8888,8080'`
    * (checking current status)
    * `curl -k https://mpg.bosh-lite.com/ports`
    * `curl -k https://mpg2.bosh-lite.com/ports` -> should fail
    1. Updating external ports of app
    * (confirmation before operations) `cf curl /v2/apps/$(cf app mpg --guid)`
    * `cf curl /v2/apps/$(cf app mpg --guid) -X PUT -d '\{"ports": \[7777, 8888, 8080\]\}'`
    1. Adding route mappings
    * (confirmation before operations) `cf curl /v2/route_mappings`
    * (checking `<ROUTE-GUID>`s) `cf curl /v2/routes?q=host:mpg2`
    * `cf curl /v2/route_mappings -X POST -d "\{\"app_guid\": \"$(cf app mpg --guid)\", \"route_guid\": \"<ROUTE-GUID>\", \"app_port\": 7777\}"`
    * (confirmation after operations) `cf curl /v2/route_mappings`
    1. Validating behavior
    * `curl -k https://mpg.bosh-lite.com/ports`
    * `curl -k https://mpg2.bosh-lite.com/ports`
    27 changes: 27 additions & 0 deletions operations-for-tcp.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,27 @@
    # "Multiple App Ports" Demo Operations for TCP Routing

    1. Cloning demo app
    Using cf-acceptance-tests/assets/multi-port-app
    * `git clone https://github.com/cloudfoundry/cf-acceptance-tests.git`
    1. Creating routes
    * (confirmation before operations) `cf routes`
    * `cf create-route demo-spc tcp.bosh-lite.com --port 1077`
    * `cf create-route demo-spc tcp.bosh-lite.com --port 1080`
    * `cf create-route demo-spc tcp.bosh-lite.com --port 1088`
    * (confirmation after operations) `cf routes`
    1. Pushing app with listening multiple ports, not-started, no-routes
    * `cf push mpg-tcp -c 'go-online --ports=7777,8888,8080' --no-route --no-start`
    1. Updating external ports of app
    * (confirmation before operations) `cf curl /v2/apps/$(cf app mpg-tcp --guid)`
    * `cf curl /v2/apps/$(cf app mpg-tcp --guid) -X PUT -d '\{"ports": \[7777, 8888, 8080\]\}'`
    1. Adding route mappings
    * (confirmation before operations) `cf curl /v2/route_mappings`
    * (checking `<ROUTE-GUID>`s) `cf curl /v2/routes` and check each guid for routes `tcp.bosh-lite.com:1080`, `tcp.bosh-lite.com:1077`, `tcp.bosh-lite.com:1088`
    * `cf curl /v2/route_mappings -X POST -d "\{\"app_guid\": \"$(cf app mpg-tcp --guid)\", \"route_guid\": \"<ROUTE-GUID>\", \"app_port\": 8080\}"`
    * `cf curl /v2/route_mappings -X POST -d "\{\"app_guid\": \"$(cf app mpg-tcp --guid)\", \"route_guid\": \"<ROUTE-GUID>\", \"app_port\": 7777\}"`
    * `cf curl /v2/route_mappings -X POST -d "\{\"app_guid\": \"$(cf app mpg-tcp --guid)\", \"route_guid\": \"<ROUTE-GUID>\", \"app_port\": 8888\}"`
    * (confirmation after operations) `cf curl /v2/route_mappings`
    1. Validating behavior
    * `curl -k http://tcp.bosh-lite.com:1077`
    * `curl -k http://tcp.bosh-lite.com:1080`
    * `curl -k http://tcp.bosh-lite.com:1088`