Skip to content

Commit

Permalink
Update naming from "Ten" to "TEN"
Browse files Browse the repository at this point in the history
  • Loading branch information
Jennievon committed Sep 2, 2024
1 parent 9925408 commit 715ec0a
Show file tree
Hide file tree
Showing 84 changed files with 455 additions and 454 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/manual-deploy-obscuro-gateway.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Deploys Ten Gateway on Azure for Testnet
# Builds the Ten Gateway image, pushes the image to dockerhub and starts the Ten Gateway on Azure VM
# Deploys TEN Gateway on Azure for Testnet
# Builds the TEN Gateway image, pushes the image to dockerhub and starts the TEN Gateway on Azure VM

name: '[M] Deploy Ten Gateway Backend'
run-name: '[M] Deploy Ten Gateway Backend ( ${{ github.event.inputs.testnet_type }} )'
name: "[M] Deploy TEN Gateway Backend"
run-name: "[M] Deploy TEN Gateway Backend ( ${{ github.event.inputs.testnet_type }} )"
on:
workflow_dispatch:
inputs:
testnet_type:
description: 'Environment'
description: "Environment"
required: true
default: 'dev-testnet'
default: "dev-testnet"
type: choice
options:
- 'dev-testnet'
- 'uat-testnet'
- 'sepolia-testnet'
- "dev-testnet"
- "uat-testnet"
- "sepolia-testnet"
instance_type:
description: 'Instance'
description: "Instance"
required: true
default: 'primary'
default: "primary"
type: choice
options:
- 'primary'
- 'dexynth'
- "primary"
- "dexynth"

jobs:
validate-inputs:
runs-on: ubuntu-latest
steps:
- name: 'Check if deployment is allowed'
- name: "Check if deployment is allowed"
run: |
if [[ "${{ github.event.inputs.instance_type }}" == "Dexynth" && "${{ github.event.inputs.testnet_type }}" != "sepolia-testnet" ]]; then
echo "Error: Dexynth can only be deployed to sepolia-testnet."
Expand All @@ -40,35 +40,35 @@ jobs:
environment:
name: ${{ github.event.inputs.testnet_type }}
steps:
- name: 'Set up environment variables'
- name: "Set up environment variables"
id: setup_env
run: |
INSTANCE_SUFFIX=""
INSTANCE_PREFIX=""
if [[ "${{ github.event.inputs.instance_type }}" != "primary" ]]; then
INSTANCE_SUFFIX="-${{ github.event.inputs.instance_type }}"
INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-"
fi
echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV
echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV
# Set infrastructure variables
PUBLIC_IP="${{ github.event.inputs.testnet_type }}-OG-static${INSTANCE_SUFFIX}"
DNS_NAME="obscurogateway-${{ github.event.inputs.testnet_type }}${INSTANCE_SUFFIX}"
VM_NAME="${{ github.event.inputs.testnet_type }}-OG-${{ github.run_number }}${INSTANCE_SUFFIX}"
DEPLOY_GROUP="ObscuroGateway-${{ github.event.inputs.testnet_type }}-${{ github.run_number }}${INSTANCE_SUFFIX}"
VNET_NAME="ObscuroGateway-${{ github.event.inputs.testnet_type }}-01VNET${INSTANCE_SUFFIX}"
SUBNET_NAME="ObscuroGateway-${{ github.event.inputs.testnet_type }}-01Subnet${INSTANCE_SUFFIX}"
echo "PUBLIC_IP=$PUBLIC_IP" >> $GITHUB_ENV
echo "DNS_NAME=$DNS_NAME" >> $GITHUB_ENV
echo "VM_NAME=$VM_NAME" >> $GITHUB_ENV
echo "DEPLOY_GROUP=$DEPLOY_GROUP" >> $GITHUB_ENV
echo "VNET_NAME=$VNET_NAME" >> $GITHUB_ENV
echo "SUBNET_NAME=$SUBNET_NAME" >> $GITHUB_ENV
# Set instance-specific variables
declare -a VAR_NAMES=(
"DOCKER_BUILD_TAG_GATEWAY"
Expand All @@ -78,7 +78,7 @@ jobs:
"GATEWAY_RATE_LIMIT_WINDOW"
"GATEWAY_MAX_CONCURRENT_REQUESTS_PER_USER"
)
for VAR_NAME in "${VAR_NAMES[@]}"; do
FULL_VAR_NAME="${INSTANCE_PREFIX}${VAR_NAME}"
VAR_VALUE=$(jq -r --arg key "$FULL_VAR_NAME" '.[$key] // empty' <<< '${{ toJson(vars) }}')
Expand All @@ -89,7 +89,7 @@ jobs:
fi
done
- name: 'Print environment variables'
- name: "Print environment variables"
# This is a useful record of what the environment variables were at the time the job ran, for debugging and reference
run: |
echo "INSTANCE_SUFFIX: $INSTANCE_SUFFIX"
Expand All @@ -107,30 +107,30 @@ jobs:
echo "GATEWAY_RATE_LIMIT_WINDOW: $GATEWAY_RATE_LIMIT_WINDOW"
echo "GATEWAY_MAX_CONCURRENT_REQUESTS_PER_USER: $GATEWAY_MAX_CONCURRENT_REQUESTS_PER_USER"
- name: 'Print GitHub variables'
- name: "Print GitHub variables"
# This is a useful record of what the environment variables were at the time the job ran, for debugging and reference
run: |
echo "GitHub Variables = ${{ toJSON(vars) }}"
- uses: actions/checkout@v4

- name: 'Extract branch name'
- name: "Extract branch name"
shell: bash
run: |
echo "Branch Name: ${GITHUB_REF_NAME}"
echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: 'Set up Docker'
- name: "Set up Docker"
uses: docker/setup-buildx-action@v1

- name: 'Login to Azure docker registry'
- name: "Login to Azure docker registry"
uses: azure/docker-login@v1
with:
login-server: testnetobscuronet.azurecr.io
username: testnetobscuronet
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: 'Login via Azure CLI'
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
Expand All @@ -141,26 +141,26 @@ jobs:
docker push ${{ env.DOCKER_BUILD_TAG_GATEWAY }}
# This will fail some deletions due to resource dependencies ( ie. you must first delete the vm before deleting the disk)
- name: 'Delete deployed VMs'
- name: "Delete deployed VMs"
uses: azure/CLI@v1
with:
inlineScript: |
$(az resource list --tag ${{ env.AZURE_DEPLOY_GROUP_GATEWAY }}=true --query '[]."id"' -o tsv | xargs -n1 az resource delete --verbose -g Testnet --ids) || true
# This will clean up any lingering dependencies - might fail if there are no resources to cleanup
- name: 'Delete VMs dependencies'
- name: "Delete VMs dependencies"
uses: azure/CLI@v1
with:
inlineScript: |
$(az resource list --tag ${{ env.AZURE_DEPLOY_GROUP_GATEWAY }}=true --query '[]."id"' -o tsv | xargs -n1 az resource delete --verbose -g Testnet --ids) || true
- name: 'Ensure VM Static Public IP Exists'
- name: "Ensure VM Static Public IP Exists"
uses: azure/CLI@v1
with:
inlineScript: |
az network public-ip show -g Testnet -n "${{ env.PUBLIC_IP }}" || az network public-ip create -g Testnet -n "${{ env.PUBLIC_IP }}" --allocation-method Static --sku Standard
- name: 'Assign/Update DNS Name for Public IP'
- name: "Assign/Update DNS Name for Public IP"
uses: azure/CLI@v1
with:
inlineScript: |
Expand All @@ -169,7 +169,7 @@ jobs:
az network public-ip update -g Testnet -n "${{ env.PUBLIC_IP }}" --dns-name "${{ env.DNS_NAME }}"
fi
- name: 'Create VM for Gateway node on Azure'
- name: "Create VM for Gateway node on Azure"
uses: azure/CLI@v1
with:
inlineScript: |
Expand All @@ -181,18 +181,18 @@ jobs:
--size Standard_D4_v5 --image Canonical:0001-com-ubuntu-server-focal:20_04-lts-gen2:latest \
--authentication-type password
- name: 'Open Ten node-${{ matrix.host_id }} ports on Azure'
- name: "Open TEN node-${{ matrix.host_id }} ports on Azure"
uses: azure/CLI@v1
with:
inlineScript: |
az vm open-port -g Testnet -n "${{ env.VM_NAME }}" --port 80,81
# To overcome issues with critical VM resources being unavailable, we need to wait for the VM to be ready
- name: 'Allow time for VM initialization'
- name: "Allow time for VM initialization"
shell: bash
run: sleep 30

- name: 'Start Ten Gateway on Azure'
- name: "Start TEN Gateway on Azure"
uses: azure/CLI@v1
with:
inlineScript: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/manual-deploy-ten-bridge.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Deploys Ten Bridge on Azure for Testnet
# Builds the Ten Bridge image, pushes the image to dockerhub and starts the Ten Bridge on Azure
# Deploys TEN Bridge on Azure for Testnet
# Builds the TEN Bridge image, pushes the image to dockerhub and starts the TEN Bridge on Azure

name: "[M] Deploy Bridge Testnet"
run-name: "[M] Deploy Bridge Testnet ( ${{ github.event.inputs.testnet_type }} )"
Expand Down
56 changes: 28 additions & 28 deletions .github/workflows/manual-deploy-ten-gateway-frontend.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
# Deploys Ten Gateway Frontend on Azure for Testnet
# Builds the Ten Gateway image, pushes the image to dockerhub and starts the Ten Gateway on Azure VM
# Deploys TEN Gateway Frontend on Azure for Testnet
# Builds the TEN Gateway image, pushes the image to dockerhub and starts the TEN Gateway on Azure VM

name: '[M] Deploy Ten Gateway Frontend'
run-name: '[M] Deploy Ten Gateway Frontend ( ${{ github.event.inputs.testnet_type }} )'
name: "[M] Deploy TEN Gateway Frontend"
run-name: "[M] Deploy TEN Gateway Frontend ( ${{ github.event.inputs.testnet_type }} )"
on:
workflow_dispatch:
inputs:
testnet_type:
description: 'Testnet Type'
description: "Testnet Type"
required: true
default: 'dev-testnet'
default: "dev-testnet"
type: choice
options:
- 'dev-testnet'
- 'uat-testnet'
- 'sepolia-testnet'
- "dev-testnet"
- "uat-testnet"
- "sepolia-testnet"
instance_type:
description: 'Instance'
description: "Instance"
required: true
default: 'primary'
default: "primary"
type: choice
options:
- 'primary'
- 'dexynth'
- "primary"
- "dexynth"
jobs:
validate-inputs:
runs-on: ubuntu-latest
steps:
- name: 'Check if deployment is allowed'
- name: "Check if deployment is allowed"
run: |
if [[ "${{ github.event.inputs.instance_type }}" == "dexynth" && "${{ github.event.inputs.testnet_type }}" != "sepolia-testnet" ]]; then
echo "Error: Dexynth can only be deployed to sepolia-testnet."
Expand All @@ -38,33 +38,33 @@ jobs:
environment:
name: ${{ github.event.inputs.testnet_type }}
steps:
- name: 'Set up environment variables'
- name: "Set up environment variables"
id: setup_env
run: |
INSTANCE_SUFFIX=""
INSTANCE_PREFIX=""
if [[ "${{ github.event.inputs.instance_type }}" != "primary" ]]; then
INSTANCE_SUFFIX="-${{ github.event.inputs.instance_type }}"
INSTANCE_PREFIX="${{ github.event.inputs.instance_type }}-"
fi
echo "INSTANCE_SUFFIX=$INSTANCE_SUFFIX" >> $GITHUB_ENV
echo "INSTANCE_PREFIX=$INSTANCE_PREFIX" >> $GITHUB_ENV
DNS_NAME_LABEL_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-ten-gateway${INSTANCE_SUFFIX}"
IMAGE_NAME_GATEWAY_FE="${{ github.event.inputs.testnet_type }}-fe-ten-gateway${INSTANCE_SUFFIX}"
echo "DNS_NAME_LABEL_GATEWAY_FE=$DNS_NAME_LABEL_GATEWAY_FE" >> $GITHUB_ENV
echo "IMAGE_NAME_GATEWAY_FE=$IMAGE_NAME_GATEWAY_FE" >> $GITHUB_ENV
# Set instance-specific variables
declare -a VAR_NAMES=(
"DOCKER_BUILD_TAG_GATEWAY_FE"
"GATEWAY_URL"
)
for VAR_NAME in "${VAR_NAMES[@]}"; do
FULL_VAR_NAME="${INSTANCE_PREFIX}${VAR_NAME}"
VAR_VALUE=$(jq -r --arg key "$FULL_VAR_NAME" '.[$key] // empty' <<< '${{ toJson(vars) }}')
Expand All @@ -74,8 +74,8 @@ jobs:
echo "Warning: ${FULL_VAR_NAME} not found in vars" >&2
fi
done
- name: 'Print GitHub variables'
- name: "Print GitHub variables"
run: |
echo "Selected Testnet Type: ${{ github.event.inputs.testnet_type }}"
echo "Selected Instance Type: ${{ github.event.inputs.instance_type }}"
Expand All @@ -86,23 +86,23 @@ jobs:
- uses: actions/checkout@v4

- name: 'Extract branch name'
- name: "Extract branch name"
shell: bash
run: |
echo "Branch Name: ${GITHUB_REF_NAME}"
echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV
- name: 'Set up Docker'
- name: "Set up Docker"
uses: docker/setup-buildx-action@v3.6.1

- name: 'Login to Azure docker registry'
- name: "Login to Azure docker registry"
uses: azure/docker-login@v1
with:
login-server: testnetobscuronet.azurecr.io
username: testnetobscuronet
password: ${{ secrets.REGISTRY_PASSWORD }}

- name: 'Login via Azure CLI'
- name: "Login via Azure CLI"
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
Expand Down
Loading

0 comments on commit 715ec0a

Please sign in to comment.