Skip to content

Commit

Permalink
Merge pull request #1259 from edenia/feat/evm-cicd
Browse files Browse the repository at this point in the history
feat(cicd): update workflow for specific networks with evm
  • Loading branch information
xavier506 authored Aug 23, 2023
2 parents e6ca839 + 779ad17 commit 4ebf1c7
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 13 deletions.
7 changes: 6 additions & 1 deletion .env.telos
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,16 @@ HAPI_CREATE_ACCOUNT_ACTION_NAME=
# hapi-evm
HAPI_EVM_SERVER_PORT=9090
HAPI_EVM_SERVER_ADDRESS=hapi-evm
HAPI_EVM_HASURA_URL=http://hasura:8080/v1/graphql
HAPI_EVM_HASURA_ADMIN_SECRET=myadminsecretkey
HAPI_EVM_DATABASE_URL=postgres://eoscr:password@postgres:5432/localdb
HAPI_EVM_ENDPOINT=https://testnet.telos.net/evm
HAPI_EVM_API_ENDPOINTS=["https://telos.greymass.com","https://telos.eosphere.io","telos.caleos.io","mainnet.telosusa.io"]
HAPI_EVM_NETWORK_CHAIN_ID=4667b205c6838ef70ff7988f6e8257e8be0e1284a2f59699054a018f743b1d11
HAPI_EVM_EOS_EVM_ACCOUNT=eosio.evm
HAPI_BLOCK_INTERVAL_SEC=0.3
HAPI_EVM_BLOCK_INTERVAL_SEC=0.3
HAPI_EVM_HYPERION_API=https://telos.eosusa.io
HAPI_EVM_HYPERION_START_AT=2021-06-02T00:00:00.000+00:00

#webapp
PORT=3000
Expand Down
14 changes: 14 additions & 0 deletions .env.telostestnet
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,20 @@ HAPI_RE_CAPTCHA_PROJECT_ID=
HAPI_PUBLIC_RE_CAPTCHA_KEY=
HAPI_CREATE_ACCOUNT_ACTION_NAME=

# hapi-evm
HAPI_EVM_SERVER_PORT=9090
HAPI_EVM_SERVER_ADDRESS=hapi-evm
HAPI_EVM_HASURA_URL=http://hasura:8080/v1/graphql
HAPI_EVM_HASURA_ADMIN_SECRET=myadminsecretkey
HAPI_EVM_DATABASE_URL=postgres://eoscr:password@postgres:5432/localdb
HAPI_EVM_ENDPOINT=https://testnet.telos.net/evm
HAPI_EVM_API_ENDPOINTS=["https://telos-testnet.edenia.cloud","https://telos-testnet.cryptolions.io","https://testnet.telos.eosrio.io","https://test.telos.eosusa.io"]
HAPI_EVM_NETWORK_CHAIN_ID=1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f
HAPI_EVM_EOS_EVM_ACCOUNT=eosio.evm
HAPI_EVM_BLOCK_INTERVAL_SEC=0.3
HAPI_EVM_HYPERION_API=https://test.telos.eosusa.io
HAPI_EVM_HYPERION_START_AT=2021-06-02T00:00:00.000+00:00

#webapp
PORT=3000
REACT_APP_VERSION=dev
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/deploy-telos-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ jobs:
id: build_kubernetes_files
run: |
make \
build-kubernetes
build-kubernetes \
build-kubernetes-evm
env:
# general
NAMESPACE: telos-testnet-dashboard
Expand Down Expand Up @@ -104,12 +105,26 @@ jobs:
HAPI_EOS_EXCHANGE_RATE_API: 'https://api.coingecko.com/api/v3/simple/price?ids=telos&vs_currencies=usd'
HAPI_COINGECKO_API_TOKEN_ID: telos
HAPI_REWARDS_TOKEN: TLOS
# hapi-evm
HAPI_EVM_SERVER_PORT: '9090'
HAPI_EVM_SERVER_ADDRESS: '0.0.0.0'
HAPI_EVM_HASURA_URL: 'http://dashboard-hasura:8080/v1/graphql'
HAPI_EVM_HASURA_ADMIN_SECRET: ${{ secrets.HAPI_EVM_HASURA_ADMIN_SECRET }}
HAPI_EVM_DATABASE_URL: ${{ secrets.HAPI_EVM_DATABASE_URL }}
HAPI_EVM_ENDPOINT: 'https://testnet.telos.net/evm'
HAPI_EVM_API_ENDPOINTS: '["https://telos-testnet.edenia.cloud","https://telos-testnet.cryptolions.io","https://testnet.telos.eosrio.io","https://test.telos.eosusa.io"]'
HAPI_EVM_NETWORK_CHAIN_ID: 1eaa0824707c8c16bd25145493bf062aecddfeb56c736f6ba6397f3195f33c9f
HAPI_EVM_EOS_EVM_ACCOUNT: ${{ secrets.HAPI_EVM_EOS_EVM_ACCOUNT }}
HAPI_EVM_BLOCK_INTERVAL_SEC: ${{ secrets.HAPI_EVM_BLOCK_INTERVAL_SEC }}
HAPI_EVM_HYPERION_API: ${{ secrets.HAPI_EVM_HYPERION_API }}
HAPI_EVM_HYPERION_START_AT: ${{ secrets.HAPI_EVM_HYPERION_START_AT }}
# hasura
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }}
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: guest
HASURA_GRAPHQL_ACTION_BASE_URL: http://dashboard-hapi:9090
HASURA_GRAPHQL_ACTION_EVM_URL: http://dashboard-hapi-evm:9090

- name: Setup and deploy kubernetes environment
uses: steebchen/[email protected]
Expand Down
17 changes: 16 additions & 1 deletion .github/workflows/deploy-telos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ jobs:
id: build_kubernetes_files
run: |
make \
build-kubernetes
build-kubernetes \
build-kubernetes-evm
env:
# general
NAMESPACE: telos-dashboard
Expand Down Expand Up @@ -104,12 +105,26 @@ jobs:
HAPI_EOS_EXCHANGE_RATE_API: 'https://api.coingecko.com/api/v3/simple/price?ids=telos&vs_currencies=usd'
HAPI_COINGECKO_API_TOKEN_ID: telos
HAPI_REWARDS_TOKEN: TLOS
# hapi-evm
HAPI_EVM_SERVER_PORT: '9090'
HAPI_EVM_SERVER_ADDRESS: '0.0.0.0'
HAPI_EVM_HASURA_URL: 'http://dashboard-hasura:8080/v1/graphql'
HAPI_EVM_HASURA_ADMIN_SECRET: ${{ secrets.HAPI_EVM_HASURA_ADMIN_SECRET }}
HAPI_EVM_DATABASE_URL: ${{ secrets.HAPI_EVM_DATABASE_URL }}
HAPI_EVM_ENDPOINT: 'https://mainnet.telos.net/evm'
HAPI_EVM_API_ENDPOINTS: '["https://telos.greymass.com","https://telos.eosphere.io","telos.caleos.io","mainnet.telosusa.io"]'
HAPI_EVM_NETWORK_CHAIN_ID: 4667b205c6838ef70ff7988f6e8257e8be0e1284a2f59699054a018f743b1d11
HAPI_EVM_EOS_EVM_ACCOUNT: ${{ secrets.HAPI_EVM_EOS_EVM_ACCOUNT }}
HAPI_EVM_BLOCK_INTERVAL_SEC: ${{ secrets.HAPI_EVM_BLOCK_INTERVAL_SEC }}
HAPI_EVM_HYPERION_API: ${{ secrets.HAPI_EVM_HYPERION_API }}
HAPI_EVM_HYPERION_START_AT: ${{ secrets.HAPI_EVM_HYPERION_START_AT }}
# hasura
HASURA_GRAPHQL_ENABLE_CONSOLE: 'true'
HASURA_GRAPHQL_DATABASE_URL: ${{ secrets.HASURA_GRAPHQL_DATABASE_URL }}
HASURA_GRAPHQL_ADMIN_SECRET: ${{ secrets.HASURA_GRAPHQL_ADMIN_SECRET }}
HASURA_GRAPHQL_UNAUTHORIZED_ROLE: guest
HASURA_GRAPHQL_ACTION_BASE_URL: http://dashboard-hapi:9090
HASURA_GRAPHQL_ACTION_EVM_URL: http://dashboard-hapi-evm:9090

- name: Setup and deploy kubernetes environment
uses: steebchen/[email protected]
Expand Down
10 changes: 6 additions & 4 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,16 @@ services:
environment:
HAPI_EVM_SERVER_PORT: '${HAPI_EVM_SERVER_PORT}'
HAPI_EVM_SERVER_ADDRESS: '${HAPI_EVM_SERVER_ADDRESS}'
HAPI_EVM_HASURA_URL: '${HAPI_EVM_HASURA_URL}'
HAPI_EVM_HASURA_ADMIN_SECRET: '${HAPI_EVM_HASURA_ADMIN_SECRET}'
HAPI_EVM_DATABASE_URL: '${HAPI_EVM_DATABASE_URL}'
HAPI_EVM_ENDPOINT: '${HAPI_EVM_ENDPOINT}'
HAPI_EVM_API_ENDPOINTS: '${HAPI_EVM_API_ENDPOINTS}'
HAPI_EVM_NETWORK_CHAIN_ID: '${HAPI_EVM_NETWORK_CHAIN_ID}'
HAPI_EVM_EOS_EVM_ACCOUNT: '${HAPI_EVM_EOS_EVM_ACCOUNT}'
HAPI_EVM_HASURA_URL: '${HAPI_HASURA_URL}'
HAPI_EVM_HASURA_ADMIN_SECRET: '${HAPI_HASURA_ADMIN_SECRET}'
HAPI_EVM_DATABASE_URL: '${HAPI_DATABASE_URL}'
HAPI_BLOCK_INTERVAL_SEC: '${HAPI_BLOCK_INTERVAL_SEC}'
HAPI_EVM_BLOCK_INTERVAL_SEC: '${HAPI_EVM_BLOCK_INTERVAL_SEC}'
HAPI_EVM_HYPERION_API: '${HAPI_EVM_HYPERION_API}'
HAPI_EVM_HYPERION_START_AT: '${HAPI_EVM_HYPERION_START_AT}'
hasura:
container_name: '${STAGE}-${APP_NAME}-hasura'
image: hasura/graphql-engine:v2.16.0.cli-migrations-v3
Expand Down
4 changes: 2 additions & 2 deletions hapi-evm/src/config/hyperion.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const api =
process.env.HAPI_HYPERION_API || 'https://test.telos.eosusa.io'
process.env.HAPI_EVM_HYPERION_API || 'https://test.telos.eosusa.io'
export const startAt =
process.env.HAPI_HYPERION_START_AT || '2021-06-02T00:00:00.000+00:00'
process.env.HAPI_EVM_HYPERION_START_AT || '2021-06-02T00:00:00.000+00:00'
4 changes: 2 additions & 2 deletions hapi-evm/src/config/network.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const evmEndpoint =
process.env.HAPI_EVM_ENDPOINT || 'http://localhost/evm'
export const chainId = process.env.HAPI_NETWORK_CHAIN_ID || 'chainid1'
export const chainId = process.env.HAPI_EVM_NETWORK_CHAIN_ID || 'chainid1'
export const evmAccount = process.env.HAPI_EVM_EOS_EVM_ACCOUNT || 'eosio.evm'
export const eosEndpoints =
process.env.HAPI_EVM_EOS_EVM_ACCOUNT?.split(',') || []
export const blockIntervalSec = parseFloat(
process.env.HAPI_BLOCK_INTERVAL_SEC || '0.5'
process.env.HAPI_EVM_BLOCK_INTERVAL_SEC || '0.5'
)
29 changes: 29 additions & 0 deletions kubernetes-evm/hapi-evm-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: dashboard-hapi-evm
name: dashboard-hapi-evm
spec:
replicas: 1
selector:
matchLabels:
app: dashboard-hapi-evm
strategy:
type: Recreate
template:
metadata:
labels:
app: dashboard-hapi-evm
spec:
imagePullSecrets:
- name: regcred
containers:
- image: ${DOCKER_REGISTRY}/${IMAGE_NAME_HAPI_EVM}:${VERSION}
imagePullPolicy: "Always"
name: "dashboard-hapi-evm"
envFrom:
- configMapRef:
name: dashboard-hapi-evm-config
ports:
- containerPort: 9090
13 changes: 13 additions & 0 deletions kubernetes-evm/hapi-evm-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
labels:
app: dashboard-hapi-evm
name: dashboard-hapi-evm
spec:
ports:
- name: hapi
port: 9091
targetPort: 9090
selector:
app: dashboard-hapi-evm
19 changes: 19 additions & 0 deletions kubernetes/configmap-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ data:
---
apiVersion: v1
kind: ConfigMap
metadata:
name: dashboard-hapi-evm-config
data:
# hapi-evm
HAPI_EVM_SERVER_PORT: '${HAPI_EVM_SERVER_PORT}'
HAPI_EVM_SERVER_ADDRESS: '${HAPI_EVM_SERVER_ADDRESS}'
HAPI_EVM_HASURA_URL: '${HAPI_EVM_HASURA_URL}'
HAPI_EVM_HASURA_ADMIN_SECRET: '${HAPI_EVM_HASURA_ADMIN_SECRET}'
HAPI_EVM_DATABASE_URL: '${HAPI_EVM_DATABASE_URL}'
HAPI_EVM_ENDPOINT: '${HAPI_EVM_ENDPOINT}'
HAPI_EVM_API_ENDPOINTS: '${HAPI_EVM_API_ENDPOINTS}'
HAPI_EVM_NETWORK_CHAIN_ID: '${HAPI_EVM_NETWORK_CHAIN_ID}'
HAPI_EVM_EOS_EVM_ACCOUNT: '${HAPI_EVM_EOS_EVM_ACCOUNT}'
HAPI_EVM_BLOCK_INTERVAL_SEC: '${HAPI_EVM_BLOCK_INTERVAL_SEC}'
HAPI_EVM_HYPERION_API: '${HAPI_EVM_HYPERION_API}'
HAPI_EVM_HYPERION_START_AT: '${HAPI_EVM_HYPERION_START_AT}'
---
apiVersion: v1
kind: ConfigMap
metadata:
name: dashboard-hasura-config
data:
Expand Down
10 changes: 10 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ RESET := $(shell tput -Txterm sgr0)

K8S_BUILD_DIR ?= ./build_k8s
K8S_FILES := $(shell find ./kubernetes -name '*.yaml' | sed 's:./kubernetes/::g')
K8S_FILES_EVM := $(shell find ./kubernetes-evm -name '*.yaml' | sed 's:./kubernetes-evm/::g')

run:
@echo "$(BLUE)running action $(filter-out $@,$(MAKECMDGOALS))$(RESET)"
Expand Down Expand Up @@ -165,6 +166,15 @@ build-kubernetes: ./kubernetes
$(SHELL_EXPORT) envsubst <./kubernetes/$$file >$(K8S_BUILD_DIR)/$$file; \
done

build-kubernetes-evm: ##@devops Generate proper k8s files based on the templates for evm
build-kubernetes-evm: ./kubernetes-evm
@echo "Build kubernetes files for evm..."
@mkdir -p $(K8S_BUILD_DIR)
@for file in $(K8S_FILES_EVM); do \
mkdir -p `dirname "$(K8S_BUILD_DIR)/$$file"`; \
$(SHELL_EXPORT) envsubst <./kubernetes-evm/$$file >$(K8S_BUILD_DIR)/$$file; \
done

deploy-kubernetes: ##@devops Publish the build k8s files
deploy-kubernetes: $(K8S_BUILD_DIR)
@kubectl create ns $(NAMESPACE) || echo "Namespace '$(NAMESPACE)' already exists.";
Expand Down
5 changes: 3 additions & 2 deletions utils/meta.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ VERSION ?= $(shell git rev-parse --short HEAD)

IMAGE_NAME_WEBAPP=dashboard-webapp
IMAGE_NAME_HAPI=dashboard-hapi
IMAGE_NAME_HAPI_EVM=dashboard-hapi-evm
IMAGE_NAME_HASURA=dashboard-hasura
IMAGE_NAME_WALLET=dashboard-wallet

DOCKER_REGISTRY=ghcr.io/edenia
SUBDIRS = webapp hapi hasura wallet
SUBDIRS = webapp hapi hasura wallet hapi-evm

MAKE_ENV += DOCKER_REGISTRY VERSION IMAGE_NAME_WEBAPP IMAGE_NAME_HAPI IMAGE_NAME_WALLET IMAGE_NAME_HASURA
MAKE_ENV += DOCKER_REGISTRY VERSION IMAGE_NAME_WEBAPP IMAGE_NAME_HAPI IMAGE_NAME_HAPI_EVM IMAGE_NAME_WALLET IMAGE_NAME_HASURA

SHELL_EXPORT := $(foreach v,$(MAKE_ENV),$(v)='$($(v))')

Expand Down

0 comments on commit 4ebf1c7

Please sign in to comment.