From f3fbc075e8c3615e04c3af28933c45723a006622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=BDiga=20Kokelj?= Date: Mon, 27 May 2024 09:25:53 +0200 Subject: [PATCH] start from the existing github action --- .../manual-deploy-obscuro-gateway.yml | 97 +++++++------------ 1 file changed, 34 insertions(+), 63 deletions(-) diff --git a/.github/workflows/manual-deploy-obscuro-gateway.yml b/.github/workflows/manual-deploy-obscuro-gateway.yml index dd7aac6db0..3d66be8cd7 100644 --- a/.github/workflows/manual-deploy-obscuro-gateway.yml +++ b/.github/workflows/manual-deploy-obscuro-gateway.yml @@ -1,8 +1,8 @@ -# Deploys Ten Gateway on Azure for Testnet +# Deploys Obscuro Gateway on Azure for Testnet # Builds the Obscuro Gateway image, pushes the image to dockerhub and starts the Obscuro Gateway on Azure VM -name: '[M] Deploy Ten Gateway' -run-name: '[M] Deploy Ten Gateway ( ${{ github.event.inputs.testnet_type }} )' +name: '[M] Deploy Obscuro Gateway' +run-name: '[M] Deploy Obscuro Gateway ( ${{ github.event.inputs.testnet_type }} )' on: workflow_dispatch: inputs: @@ -52,7 +52,7 @@ jobs: - name: Build and Push Docker Image run: | - DOCKER_BUILDKIT=1 docker build -t ${{ vars.DOCKER_BUILD_TAG_GATEWAY }} -f ./tools/walletextension/enclave.Dockerfile . + DOCKER_BUILDKIT=1 docker build --build-arg TESTNET_TYPE=${{ github.event.inputs.testnet_type }} -t ${{ vars.DOCKER_BUILD_TAG_GATEWAY }} -f ./tools/walletextension/Dockerfile . docker push ${{ vars.DOCKER_BUILD_TAG_GATEWAY }} # This will fail some deletions due to resource dependencies ( ie. you must first delete the vm before deleting the disk) @@ -93,10 +93,10 @@ jobs: --public-ip-address "${{ github.event.inputs.testnet_type }}-OG-ENC-static" \ --tags deploygroup=ObscuroGateway-${{ github.event.inputs.testnet_type }}-${{ GITHUB.RUN_NUMBER }} ${{ vars.AZURE_DEPLOY_GROUP_GATEWAY }}=true \ --vnet-name ObscuroGateway-${{ github.event.inputs.testnet_type }}-01VNET --subnet ObscuroGateway-${{ github.event.inputs.testnet_type }}-01Subnet \ - --size Standard_DC1s_v2 --storage-sku StandardSSD_LRS --image ObscuroConfUbuntu \ + --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 Obscuro node-${{ matrix.host_id }} ports on Azure' uses: azure/CLI@v1 with: inlineScript: | @@ -105,66 +105,37 @@ jobs: # 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' shell: bash - run: sleep 120 + run: sleep 30 - - name: 'Start Ten gateway on Azure' + - name: 'Start Obscuro gateway on Azure' uses: azure/CLI@v1 with: inlineScript: | az vm run-command invoke -g Testnet -n "${{ github.event.inputs.testnet_type }}-OG-${{ GITHUB.RUN_NUMBER }}-SGX" \ --command-id RunShellScript \ - --scripts 'set -e - LOG_FILE=/home/ten/setup.log - exec > >(tee -i ${LOG_FILE}) 2>&1 - - echo "Creating directory /home/ten" - mkdir -p /home/ten - - echo "Updating package list" - sudo apt-get update - - echo "Installing gcc" - sudo apt-get install -y gcc - - echo "Refreshing and installing snap packages" - sudo snap refresh && sudo snap install --channel=1.18 go --classic - - echo "Installing Docker" - curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh - - echo "Pulling Docker image ${{ vars.DOCKER_BUILD_TAG_GATEWAY }}" - docker pull ${{ vars.DOCKER_BUILD_TAG_GATEWAY }} - - echo "Cloning repository" - git clone --depth 1 -b ${{ env.BRANCH_NAME }} https://github.com/ten-protocol/go-ten.git /home/ten/go-ten - - echo "Running Datadog agent container" - docker run -d --name datadog-agent \ - --network node_network \ - -e DD_API_KEY=${{ secrets.DD_API_KEY }} \ - -e DD_LOGS_ENABLED=true \ - -e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true \ - -e DD_LOGS_CONFIG_AUTO_MULTI_LINE_DETECTION=true \ - -e DD_CONTAINER_EXCLUDE_LOGS="name:datadog-agent" \ - -e DD_SITE="datadoghq.eu" \ - -v /var/run/docker.sock:/var/run/docker.sock:ro \ - -v /proc/:/host/proc/:ro \ - -v /opt/datadog-agent/run:/opt/datadog-agent/run:rw \ - -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \ - datadog/agent:latest - - echo "Creating Docker network if not exists" - docker network create --driver bridge node_network || true - - echo "Starting Ten gateway container" - cd /home/ten/go-ten/ - docker run -p 80:80 -p 81:81 --name ${{ github.event.inputs.testnet_type }}-OG-${{ GITHUB.RUN_NUMBER }}-SGX \ - -e OE_SIMULATION=0 \ - --entrypoint "/home/ten/go-ten/tools/walletextension/main/entry.sh" \ - ${{ vars.DOCKER_BUILD_TAG_GATEWAY }} \ - ego run /home/ten/go-ten/tools/walletextension/main/main \ - --host=0.0.0.0 --port=80 --portWS=81 --nodeHost=${{ vars.L2_RPC_URL_VALIDATOR }} --verbose=true \ - --logPath=sys_out --dbType=mariaDB --dbConnectionURL="obscurouser:${{ secrets.OBSCURO_GATEWAY_MARIADB_USER_PWD }}@tcp(obscurogateway-mariadb-${{ github.event.inputs.testnet_type }}.uksouth.cloudapp.azure.com:3306)/ogdb" - - echo "Script execution completed" - ' \ No newline at end of file + --scripts 'mkdir -p /home/obscuro \ + && sudo apt-get update \ + && sudo apt-get install -y gcc \ + && sudo snap refresh && sudo snap install --channel=1.18 go --classic \ + && curl -fsSL https://get.docker.com -o get-docker.sh && sh ./get-docker.sh \ + && git clone --depth 1 -b ${{ env.BRANCH_NAME }} https://github.com/ten-protocol/go-ten.git /home/obscuro/go-obscuro \ + && docker network create --driver bridge node_network || true \ + && docker run -d --name datadog-agent \ + --network node_network \ + -e DD_API_KEY=${{ secrets.DD_API_KEY }} \ + -e DD_LOGS_ENABLED=true \ + -e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true \ + -e DD_LOGS_CONFIG_AUTO_MULTI_LINE_DETECTION=true \ + -e DD_CONTAINER_EXCLUDE_LOGS="name:datadog-agent" \ + -e DD_SITE="datadoghq.eu" \ + -v /var/run/docker.sock:/var/run/docker.sock:ro \ + -v /proc/:/host/proc/:ro \ + -v /opt/datadog-agent/run:/opt/datadog-agent/run:rw \ + -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \ + datadog/agent:latest \ + && cd /home/obscuro/go-obscuro/ \ + && docker run -d -p 80:80 -p 81:81 --name ${{ github.event.inputs.testnet_type }}-OG-${{ GITHUB.RUN_NUMBER }} \ + -e OBSCURO_GATEWAY_VERSION="${{ GITHUB.RUN_NUMBER }}-${{ GITHUB.SHA }}" \ + ${{ vars.DOCKER_BUILD_TAG_GATEWAY }} \ + -host=0.0.0.0 -port=8080 -portWS=81 -nodeHost=${{ vars.L2_RPC_URL_VALIDATOR }} -verbose=true \ + -logPath=sys_out -dbType=mariaDB -dbConnectionURL="obscurouser:${{ secrets.OBSCURO_GATEWAY_MARIADB_USER_PWD }}@tcp(obscurogateway-mariadb-${{ github.event.inputs.testnet_type }}.uksouth.cloudapp.azure.com:3306)/ogdb"' \ No newline at end of file