diff --git a/_data/toc.yaml b/_data/toc.yaml index a286d391da..d4270e794c 100644 --- a/_data/toc.yaml +++ b/_data/toc.yaml @@ -1207,9 +1207,11 @@ toc: title: CLI-based access - sectiontitle: Deploy an application section: - - path: /datacenter/ucp/2.1/guides/user/applications/deploy-a-service/ + - path: /datacenter/ucp/2.1/guides/user/services/deploy-a-service/ title: Deploy a service - - path: /datacenter/ucp/2.1/guides/user/applications/ + - path: /datacenter/ucp/2.1/guides/user/services/use-hostnames-to-access-your-service/ + title: Use hostnames to access your service + - path: /datacenter/ucp/2.1/guides/user/services/ title: Deploy an app from the UI - path: /datacenter/ucp/2.1/guides/user/applications/deploy-app-cli/ title: Deploy an app from the CLI diff --git a/datacenter/ucp/2.1/guides/images/use-a-load-balancer-1.svg b/datacenter/ucp/2.1/guides/images/use-a-load-balancer-1.svg index a8a3523da8..1f6a63f808 100644 --- a/datacenter/ucp/2.1/guides/images/use-a-load-balancer-1.svg +++ b/datacenter/ucp/2.1/guides/images/use-a-load-balancer-1.svg @@ -1,7 +1,7 @@ - + - architecture-3 + use-hostnames-1 Created with Sketch. @@ -19,215 +19,175 @@ + + + + + + + + + + - - - - - - Docker swarm - - - - - - - - your load balancer + + + + + + + 192.168.99.104 + + + + + worker node + + + + + + + UCP worker + + + + + + nginx + + + - - - - - - + + + 192.168.99.103 + + + + + + worker node + - - - - - - - - - - - - - + + + + UCP worker + + - - - - - - - - - worker node - - - - - - - CS Docker Engine - - - - - - UCP agent - - - - - - UCP worker - - - - - - - - - - worker node - - - - - - - CS Docker Engine - - - - - - UCP agent - - - - - - UCP worker - - - + + + + 192.168.99.102 + + + + + + manager node + - - - - - - - manager node - - - - - - - CS Docker Engine - - - - - - UCP agent - - - - - - UCP manager - - - - - - - - - - manager node - - - - - - - CS Docker Engine - - - - - - UCP agent - - - - - - UCP manager - - - - - - - - - - manager node - - - - - - - CS Docker Engine - - - - - - UCP agent - - - - - - UCP manager - - - + + + + UCP manager + + + + + + + 192.168.99.101 + + + + + + manager node + + + + + UCP manager + + + + + + + 192.168.99.100 + + + + + + manager node + + + + + + + UCP manager + + + - - - - UI + + + + + swarm routing mesh - - - - CLI - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-1.svg b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-1.svg new file mode 100644 index 0000000000..eeee9fe0f9 --- /dev/null +++ b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-1.svg @@ -0,0 +1,193 @@ + + + + use-hostnames-1 + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 192.168.99.104 + + + + + + worker node + + + + + + + UCP worker + + + + + + nginx + + + + + + + 192.168.99.103 + + + + + + worker node + + + + + + + UCP worker + + + + + + + + + 192.168.99.102 + + + + + + manager node + + + + + + + UCP manager + + + + + + + 192.168.99.101 + + + + + + manager node + + + + + + + UCP manager + + + + + + + 192.168.99.100 + + + + + + manager node + + + + + + + UCP manager + + + + + + + + + + + swarm routing mesh + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-2.png b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-2.png new file mode 100644 index 0000000000..f64778e900 Binary files /dev/null and b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-2.png differ diff --git a/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-3.png b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-3.png new file mode 100644 index 0000000000..9bd8c501ad Binary files /dev/null and b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-3.png differ diff --git a/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-4.png b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-4.png new file mode 100644 index 0000000000..24f9063475 Binary files /dev/null and b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-4.png differ diff --git a/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-5.png b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-5.png new file mode 100644 index 0000000000..d412790f98 Binary files /dev/null and b/datacenter/ucp/2.1/guides/images/use-hostnames-to-access-your-service-5.png differ diff --git a/datacenter/ucp/2.1/guides/user/applications/deploy-a-service.md b/datacenter/ucp/2.1/guides/user/services/deploy-a-service.md similarity index 100% rename from datacenter/ucp/2.1/guides/user/applications/deploy-a-service.md rename to datacenter/ucp/2.1/guides/user/services/deploy-a-service.md diff --git a/datacenter/ucp/2.1/guides/user/applications/deploy-app-cli.md b/datacenter/ucp/2.1/guides/user/services/deploy-app-cli.md similarity index 100% rename from datacenter/ucp/2.1/guides/user/applications/deploy-app-cli.md rename to datacenter/ucp/2.1/guides/user/services/deploy-app-cli.md diff --git a/datacenter/ucp/2.1/guides/user/applications/index.md b/datacenter/ucp/2.1/guides/user/services/index.md similarity index 100% rename from datacenter/ucp/2.1/guides/user/applications/index.md rename to datacenter/ucp/2.1/guides/user/services/index.md diff --git a/datacenter/ucp/2.1/guides/user/services/use-hostnames-to-access-your-service.md b/datacenter/ucp/2.1/guides/user/services/use-hostnames-to-access-your-service.md new file mode 100644 index 0000000000..02342f1456 --- /dev/null +++ b/datacenter/ucp/2.1/guides/user/services/use-hostnames-to-access-your-service.md @@ -0,0 +1,67 @@ +--- +title: Use hostnames to access your service +description: Learn how to configure your services to make them accessible using a hostname instead of IP addresses and ports. +keywords: ucp, services, http, dns +--- + +When you deploy a service with an HTTP or HTTPS endpoint, you can make it +accessible to users by mapping the service port to the swarm routing mesh port. +This makes your service available using the IP address of any node in the +cluster. + +![](../../images/use-hostnames-to-access-your-service-1.svg) + +UCP takes this one step further and allows you to configure your HTTP or HTTPS +services to make them available using hostnames. +In this example we're going to deploy an NGINX service and make it available +with the hostname `app.ucp.example.com`. + +Start by making sure that the +[HTTP routing mesh service is enabled](../../admin/configure/use-domain-names-to-access-services.md) +and you have access to the `ucp-hrm` network. +If you don't have administrator credentials, ask your system administrator to +enable the HTTP routing mesh, and grant you access to the `ucp-hrm` network. + +Log in the **UCP web UI**, navigate to the **Services** page, and click +**Create a service**. Then create an NGIN service with the following +configurations: + +| Field | Value | +|:------------------|:--------------------| +| Service name | nginx | +| Image name | nginx | +| Internal port | 80 | +| Public port | 8000 | +| External scheme | http:// | +| Routing mesh host | app.ucp.example.com | + +When creating the service, make sure to publish both internal and public ports. +This maps the port 80 on the container running the service, to port 8000 on the +ingress routing mesh. + +![](../../images/use-hostnames-to-access-your-service-2.png){: .with-border} + +Then click the **Add hostname based route** to set the hostname that will +resolve to the service. + +![](../../images/use-hostnames-to-access-your-service-3.png){: .with-border} + +Finally, you need to connect the service to the `ucp-hrm` network. This is +what ensures traffic send to the HTTP routing mesh is redirected to your +service. + +![](../../images/use-hostnames-to-access-your-service-4.png){: .with-border} + +Click **Deploy now** to deploy your service. Once the service is deployed, +the HTTP routing mesh service is reconfigured to redirect HTTP requests with +the hostname set to `app.ucp.example.com`, to the NGINX service. + +To make this service accessible to users, you need to add an entry to your DNS, +mapping the name `app.ucp.example.com` to the IP address of any node in the +UCP cluster. When testing locally, you can also change your `/etc/hosts` file to +create this mapping, instead of using a DNS service. + +Now when you access `http://app.ucp.example.com` from your browser, you'll see +the default NGINX page. + +![](../../images/use-hostnames-to-access-your-service-5.png){: .with-border}