A test of UDP-based communication between various Azure regions.
- Go language (the server and the client are written in Go).
- Azure CLI and Docker Desktop for Windows/Mac or Docker with Compose CLI (Linux) -- for building the client and server containers and deploying them to different Azure regions.
-
Start the server
go run server/server.go 17335
17335
is the port number that the server will use. You can use a different one, but you will need to change the server Dockerfile accordingly for Azure deployment. -
Run the client
go run client/client.go 127.0.0.1:17335 <optional-payload>
cd server
docker build -t udp-ping-server:201127a .
We'll use Azure Container Registry (ACR) here, but Docker Hub should work equally well.
If necessary, do az login
followed by az account show
to verify that correct Azure account is active. Use az account set
to change it.
- Create Azure resource groups for ACR and server deployments
In this experiment we will use Australia East, Brazil South and West Europe regions.
az group create --name udp-ping-australia --location australiaeast
az group create --name udp-ping-brazil --location brazilsouth
az group create --name udp-ping-westeurope --location westeurope
- Create Azure Account Registry
z acr create --name udppingacr201127a --resource-group udp-ping-westeurope --location westeurope --sku basic
- Create Docker contexts for deploying server to Azure regions
Do docker login azure
as necessary to enable Docker-Azure interaction.
docker context create aci udp-ping-australia --resource-group udp-ping-australia
docker context create aci udp-ping-brazil --resource-group udp-ping-brazil
docker context create aci udp-ping-westeurope --resource-group udp-ping-westeurope
- Push the server image to account registry
az acr login --name udppingacr201127a
docker tag udp-ping-server:201127a udppingacr201127a.azurecr.io/udp-ping-server:201127a
docker push udppingacr201127a.azurecr.io/udp-ping-server:201127a
Unfortunately as of November 2020 there is a bug in Docker CLI that does not allow to create public IP addresses with UDP protocol enabled when deploying to Azure Container Instances. That is why we need to deploy the containers using
az container
CLI instead. You will need to create a service principal for your Azure Container Registry.az container create --resource-group udp-ping-westeurope --name udp-server --ip-address public --ports 17335 --protocol UDP --image udppingacr201127a.azurecr.io/udp-ping-server:201127a --registry-login-server udppingacr201127a.azurecr.io --registry-username <service-principal-id> --registry-password <service-principal-password>Once the bug is fixed the following commands can be used to depoly the server to Azure Container Instaces:
docker --context udp-ping-westeurope run -d -p 17335/udp udppingacr201127a.azurecr.io/udp-ping-server:201127a
Ping the server:
docker --context udp-ping-westeurope ps
# Note the IP address of the server
go run client/client.go <server-IP-address>:17335
Repeat the same with udp-ping-australia
and udp-ping-brazil
Docker contexts/Azure regions. Note that the image to run (udppingacr201127a.azurecr.io/udp-ping-server:201127a
) does not change, only the context changes.
(TBD)