-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add manual deployment workflow for Ten Bridge on
Azure for Testnet
- Loading branch information
Showing
3 changed files
with
231 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# 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 }} )" | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
testnet_type: | ||
description: "Testnet Type" | ||
required: true | ||
default: "dev-testnet" | ||
type: choice | ||
options: | ||
- "dev-testnet" | ||
- "uat-testnet" | ||
- "sepolia-testnet" | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: ${{ github.event.inputs.testnet_type }} | ||
steps: | ||
- 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@v3 | ||
|
||
- name: "Set up Docker" | ||
uses: docker/setup-buildx-action@v1 | ||
|
||
- 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 ${{ vars.DOCKER_BUILD_TAG_BRIDGE_FE }} -f ./contracts/src/bridge/frontend/Dockerfile . | ||
docker push ${{ vars.DOCKER_BUILD_TAG_BRIDGE_FE }} | ||
- 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 }}-ten-bridge | ||
image: ${{ vars.DOCKER_BUILD_TAG_BRIDGE_FE }} | ||
name: ${{ github.event.inputs.testnet_type }}-fe-ten-bridge | ||
location: "uksouth" | ||
restart-policy: "Never" | ||
environment-variables: NEXT_PUBLIC_BRIDGE_API_HOST=https://${{ github.event.inputs.testnet_type }}-api.tenscan.io NEXT_PUBLIC_FE_VERSION=${{ GITHUB.RUN_NUMBER }}-${{ GITHUB.SHA }} | ||
command-line: npm run start-prod | ||
ports: "80" | ||
cpu: 2 | ||
memory: 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Use an official Node.js 22 as a parent image | ||
FROM node:22-alpine | ||
|
||
WORKDIR /usr/src/app | ||
|
||
# ARG for build-time variable | ||
ARG API_HOST | ||
ARG L1_BRIDGE | ||
ARG L2_BRIDGE | ||
ARG MESSAGE_BUS | ||
ARG GOOGLE_ANALYTICS_ID | ||
|
||
# ENV for URL to be used in the app | ||
ENV NEXT_PUBLIC_BRIDGE_API_HOST=${API_HOST} | ||
ENV NEXT_PUBLIC_BRIDGE_L1=${L1_BRIDGE} | ||
ENV NEXT_PUBLIC_BRIDGE_L2=${L2_BRIDGE} | ||
ENV NEXT_PUBLIC_BRIDGE_MESSAGE_BUS=${MESSAGE_BUS} | ||
ENV NEXT_PUBLIC_BRIDGE_GOOGLE_ANALYTICS_ID=${GOOGLE_ANALYTICS_ID} | ||
|
||
# Copy package.json and package-lock.json (or yarn.lock) into the container | ||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
COPY . . | ||
RUN npm run build | ||
EXPOSE 80 | ||
CMD ["npm", "start"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
export const socialLinks = { | ||
github: "https://github.com/ten-protocol", | ||
discord: "https://discord.gg/QJZ39Den7d", | ||
twitter: "https://twitter.com/tenprotocol", | ||
twitterHandle: "@tenprotocol", | ||
}; | ||
|
||
export const pollingInterval = 5000; | ||
export const maxRetries = 3; | ||
export const pricePollingInterval = 60 * 1000; // 1 minute in milliseconds | ||
|
||
export const RESET_COPIED_TIMEOUT = 2000; | ||
|
||
export const getOptions = (query: { | ||
page?: string | string[]; | ||
size?: string | string[]; | ||
}) => { | ||
const offset = | ||
query.page && query.size | ||
? (parseInt(query.page as string, 10) - 1) * | ||
parseInt(query.size as string, 10) | ||
: 0; | ||
const options = { | ||
offset: Number.isNaN(offset) ? 0 : offset, | ||
size: Number.isNaN(parseInt(query.size as string, 10)) | ||
? 10 | ||
: parseInt(query.size as string, 10), | ||
// sort: query.sort ? (query.sort as string) : "blockNumber", | ||
// order: query.order ? (query.order as string) : "desc", | ||
// filter: query.filter ? (query.filter as string) : "", | ||
}; | ||
return options; | ||
}; | ||
|
||
export const apiHost = process.env.NEXT_PUBLIC_BRIDGE_API_HOST; | ||
|
||
export const l1Bridge = process.env.NEXT_PUBLIC_BRIDGE_L1; | ||
export const l2Bridge = process.env.NEXT_PUBLIC_BRIDGE_L2; | ||
export const messageBusAddress = process.env.NEXT_PUBLIC_BRIDGE_MESSAGE_BUS; | ||
|
||
export const GOOGLE_ANALYTICS_ID = | ||
process.env.NEXT_PUBLIC_BRIDGE_GOOGLE_ANALYTICS_ID; | ||
|
||
export const L1CHAINS = [ | ||
{ | ||
name: "Ethereum", | ||
value: "ETH", | ||
isNative: true, | ||
isEnabled: true, | ||
chainId: "0x1", | ||
}, | ||
]; | ||
|
||
export const L2CHAINS = [ | ||
{ | ||
name: "TEN", | ||
value: "TEN", | ||
isNative: false, | ||
isEnabled: true, | ||
chainId: "0x1bb", | ||
}, | ||
]; | ||
|
||
export const L2TOKENS = [ | ||
{ | ||
name: "Ether", | ||
value: "ETH", | ||
isNative: true, | ||
isEnabled: true, | ||
address: "", | ||
}, | ||
{ | ||
name: "USD Coin", | ||
value: "USDC", | ||
isNative: false, | ||
isEnabled: false, | ||
address: "0xb0E09857675Dc4c23ce90D4Ba62aC66fAb8b8155", | ||
}, | ||
{ | ||
name: "Tether USD", | ||
value: "USDT", | ||
isNative: false, | ||
isEnabled: false, | ||
address: "0x41ef84feDff3cE53d4C39097A81a74DD9A71280c", | ||
}, | ||
{ | ||
name: "TEN", | ||
value: "TEN", | ||
isNative: false, | ||
isEnabled: false, | ||
address: "", | ||
}, | ||
]; | ||
|
||
export const L1TOKENS = [ | ||
{ | ||
name: "Ether", | ||
value: "ETH", | ||
isNative: true, | ||
isEnabled: true, | ||
address: "", | ||
}, | ||
{ | ||
name: "USD Coin", | ||
value: "USDC", | ||
isNative: false, | ||
isEnabled: false, | ||
address: "0x718b239FFBB2dff8054ef424545A074d4EAbF220", | ||
}, | ||
{ | ||
name: "Tether USD", | ||
value: "USDT", | ||
isNative: false, | ||
isEnabled: false, | ||
address: "0x9Fa2813Fecc4706b3CA488EF21c0c73c7aD52c1F", | ||
}, | ||
{ | ||
name: "TEN", | ||
value: "TEN", | ||
isNative: false, | ||
isEnabled: false, | ||
address: "", | ||
}, | ||
]; | ||
|
||
export const PERCENTAGES = [ | ||
{ | ||
name: "25%", | ||
value: 25, | ||
}, | ||
{ | ||
name: "50%", | ||
value: 50, | ||
}, | ||
{ | ||
name: "MAX", | ||
value: 100, | ||
}, | ||
]; |