Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update gateway how-to guides #818

Merged
merged 8 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/config/en-custom.txt
Original file line number Diff line number Diff line change
Expand Up @@ -946,4 +946,6 @@ XRay
PodSpec
ConfigMap
CRD
composable
composable
gatewaydemo
tlsdemo
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
---
type: docs
title: "How To: Configure a gateway for routing internet traffic"
linkTitle: "Gateways"
description: "Learn how to expose a service to the internet via a gateway"
weight: 300
slug: 'gateways'
categories: "How-To"
---

This guide will walk you through how to setup a gateway for routing internet traffic to a service.
AaronCrawfis marked this conversation as resolved.
Show resolved Hide resolved

## Prerequisites

- [rad CLI]({{< ref "/guides/tooling/rad-cli/overview" >}})
- [Radius environment]({{< ref "getting-started" >}})

## Step 1: Define a container

Begin by defining the service you wish to expose to the internet in a new file named `app.bicep`. This example uses the Radius demo container:

{{< rad file="snippets/app.bicep" embed=true marker="//FRONTEND" >}}

## Step 2: Add a gateway

Next, add a gateway to `app.bicep`, routing traffic to the root path ("/") to the frontend container. Note that when a hostname is not specified one is generated automatically.

{{< rad file="snippets/app.bicep" embed=true marker="//GATEWAY" >}}

## Step 3: Deploy the app

Deploy the application with [`rad deploy`]({{< ref "rad_run" >}}):

```bash
rad deploy app.bicep -a gatewaydemo
```

The gateway endpoint will be printed at the end of the deployment:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure your intended meaning here. Do you intend to say "The gateway endpoint URL will be output after the deployment is completed"? Or something else?


```
Building app.bicep...
Deploying template './app.bicep' for application 'gatewaydemo' and environment 'default' from workspace 'default'...

Deployment In Progress...

Completed gateway Applications.Core/gateways
Completed frontend Applications.Core/containers

Deployment Complete

Resources:
gateway Applications.Core/gateways
frontend Applications.Core/containers

Public endpoint http://1.1.1.1.nip.io/
```

## Step 4: Interact with the application

Visit the endpoint to interact with the demo Radius container:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Visit the endpoint to interact with the demo Radius container:
Navigate to the endpoint URL to interact with the demo Radius container:


<img src="demo-screenshot.png" alt="Screenshot of te demo application" width="500px" >

## Done

Cleanup the application with ['rad app delete']({{< ref rad_application_delete >}}):

```bash
rad app delete gatewaydemo -y
```

## Further reading

- [Networking overview]({{< ref "/guides/author-apps/networking/overview" >}})
- [Gateway reference]({{< ref "/reference/resource-schema/core-schema/gateway" >}})
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//FRONTEND
import radius as rad

@description('The application ID being deployed. Injected automtically by the rad CLI')
param application string

resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
name: 'frontend'
properties: {
application: application
container: {
image: 'radius.azurecr.io/tutorials/webapp:edge'
ports: {
web: {
containerPort: 3000
}
}
}
}
}
//FRONTEND

//GATEWAY
resource gateway 'Applications.Core/gateways@2023-10-01-preview' = {
name: 'gateway'
properties: {
application: application
routes: [
{
path: '/'
destination: 'http://${frontend.name}:3000'
}
]
}
}
//GATEWAY
Binary file not shown.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading