Skip to content

[M] Deploy Obscuro Scan Testnet ( sepolia-testnet ) #31

[M] Deploy Obscuro Scan Testnet ( sepolia-testnet )

[M] Deploy Obscuro Scan Testnet ( sepolia-testnet ) #31

# Deploys Obscuro Scan on Azure for Testnet
# Builds the Obscuro Scan image, pushes the image to dockerhub and starts the Obscuro Scan on Azure
name: '[M] Deploy Obscuro Scan 2 Testnet'
run-name: '[M] Deploy Obscuro Scan Testnet ( ${{ github.event.inputs.testnet_type }} )'
on:
workflow_dispatch:
inputs:
testnet_type:
description: 'Testnet Type'
required: true
default: 'dev-testnet'
type: choice
options:
- 'dev-testnet'
- 'testnet'
- 'sepolia-testnet'
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: 'Set up Docker'
uses: docker/setup-buildx-action@v1
- name: 'Set Obscuro Scan variables for testnet'
if: ${{ github.event.inputs.testnet_type == 'testnet' }}
run: |
echo "OBSCURO_SCAN_FE_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/fe_obscuro_scan_testnet:latest" >> $GITHUB_ENV
echo "OBSCURO_SCAN_API_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/api_obscuro_scan_testnet:latest" >> $GITHUB_ENV
echo "OBSCURO_SCAN_NODE_HOST=erpc.testnet.obscu.ro" >> $GITHUB_ENV
- name: 'Set Obscuro Scan variables for dev-testnet'
if: ${{ github.event.inputs.testnet_type == 'dev-testnet' }}
run: |
echo "OBSCURO_SCAN_FE_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/dev_fe_obscuro_scan_testnet:latest" >> $GITHUB_ENV
echo "OBSCURO_SCAN_API_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/dev_api_obscuro_scan_testnet:latest" >> $GITHUB_ENV
echo "OBSCURO_SCAN_NODE_HOST=erpc.dev-testnet.obscu.ro" >> $GITHUB_ENV
- name: 'Set Obscuro Scan variables for dev-testnet'
if: ${{ github.event.inputs.testnet_type == 'sepolia-testnet' }}
run: |
echo "OBSCURO_SCAN_FE_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/sepolia_fe_obscuro_scan_testnet:latest" >> $GITHUB_ENV
echo "OBSCURO_SCAN_API_BUILD_TAG=testnetobscuronet.azurecr.io/obscuronet/sepolia_api_obscuro_scan_testnet:latest" >> $GITHUB_ENV
echo "OBSCURO_SCAN_NODE_HOST=erpc.sepolia-testnet.obscu.ro" >> $GITHUB_ENV
- 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'
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: Build and Push Docker FE Image
run: |
DOCKER_BUILDKIT=1 docker build -t ${{ env.OBSCURO_SCAN_FE_BUILD_TAG }} -f ./tools/obscuroscan_v2/frontend/Dockerfile .
docker push ${{ env.OBSCURO_SCAN_FE_BUILD_TAG }}
- name: Build and Push Docker API Image
run: |
DOCKER_BUILDKIT=1 docker build -t ${{ env.OBSCURO_SCAN_API_BUILD_TAG }} -f ./tools/obscuroscan_v2/backend/Dockerfile .
docker push ${{ env.OBSCURO_SCAN_API_BUILD_TAG }}
- name: 'Deploy FE to Azure Container Instances'
uses: 'azure/aci-deploy@v1'
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ github.event.inputs.testnet_type }}-obscuro-scan
image: ${{ env.OBSCURO_SCAN_FE_BUILD_TAG }}
name: ${{ github.event.inputs.testnet_type }}-fe-obscuro-scan
location: 'uksouth'
restart-policy: 'Never'
environment-variables: VITE_APIHOSTADDRESS=http://${{ github.event.inputs.testnet_type }}-api-obscuro-scan.uksouth.azurecontainer.io VITE_FE_VERSION=${{ GITHUB.RUN_NUMBER }}-${{ GITHUB.SHA }}
command-line: npm run serve-prod
ports: '80'
cpu: 2
memory: 2
- name: 'Deploy API to Azure Container Instances'
uses: 'azure/aci-deploy@v1'
with:
resource-group: ${{ secrets.RESOURCE_GROUP }}
dns-name-label: ${{ github.event.inputs.testnet_type }}-api-obscuro-scan
image: ${{ env.OBSCURO_SCAN_API_BUILD_TAG }}
name: ${{ github.event.inputs.testnet_type }}-api-obscuro-scan
location: 'uksouth'
restart-policy: 'Never'
command-line: ./cmd/backend --nodeHostAddress http://${{ env.OBSCURO_SCAN_NODE_HOST }}:80 --serverAddress 0.0.0.0:80
ports: '80'
cpu: 2
memory: 2