Skip to content

Commit

Permalink
Merge pull request #44 from Cardinal-Cryptography/A0-3351
Browse files Browse the repository at this point in the history
A0-3351: Add dev env for dashbord
  • Loading branch information
Marcin-Radecki authored Oct 24, 2023
2 parents 2e24434 + df4b55d commit e28bc1d
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 60 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ VITE_TERMS_OF_USE="https://alephzero.org/dashboard-terms-of-use/"
# Remove Testnet entry from the list of endpoints
# VITE_DISABLE_TESTNET=1

# Remove Devnet entry from the list of endpoints
# VITE_DISABLE_DEVNET=1

# Enable custom endpoint feature in the endpoint list
# VITE_ENABLE_CUSTOM_NETWORK=1
# VITE_CUSTOM_WS_ADDRESS=wss://ws.dev.azero.dev
1 change: 1 addition & 0 deletions .github/actions/build-and-push/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ inputs:
environment:
type: choice
options:
- devnet
- testnet
- mainnet
required: true
Expand Down
7 changes: 4 additions & 3 deletions .github/actions/deploy/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ inputs:
environment:
type: choice
options:
- devnet
- testnet
- mainnet
required: true
Expand All @@ -25,7 +26,7 @@ runs:
repository: Cardinal-Cryptography/aleph-apps
token: ${{ inputs.github_token }}
path: "aleph-apps"
ref: ${{ inputs.environment }}
ref: ${{ inputs.environment == 'devnet' && 'main' || inputs.environment }}

- name: KUSTOMIZE | Init kustomize
uses: imranismail/setup-kustomize@v2
Expand All @@ -39,7 +40,7 @@ runs:
run: |
cd aleph-apps/aleph-zero-dashboard/overlays/${{ inputs.environment }}/eu-central-1
kustomize edit set image "aleph-zero-dashboard-image-placeholder=${{ env.DEPLOY_IMAGE }}"
- name: GIT | Commit changes to aleph-apps repository
uses: EndBug/[email protected]
env:
Expand All @@ -50,4 +51,4 @@ runs:
message: 'Updating aleph-zero-dashboard ${{ inputs.environment }} docker image tag: ${{ inputs.image_tag }}'
add: '*.yaml'
cwd: 'aleph-apps'
branch: ${{ inputs.environment }}
branch: ${{ inputs.environment == 'devnet' && 'main' || inputs.environment }}
50 changes: 50 additions & 0 deletions .github/workflows/build-and-deploy-to-devnet.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build, push and deploy Aleph Zero Dashboard to devnet

on:
workflow_dispatch:
push:
branches:
- master
paths-ignore:
- ".github/**"
- "*.md"

jobs:
build-and-push:
name: Build and push
runs-on: ubuntu-20.04
environment:
name: devnet
steps:
- name: GIT | Checkout
uses: actions/checkout@v3

- name: Build and push devnet image
uses: ./.github/actions/build-and-push
id: build-devnet
with:
environment: devnet
build_envs: 'VITE_DISABLE_FIAT=1'
aws_mainnet_access_key_id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
aws_mainnet_secret_access_key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
outputs:
image_tag: ${{ steps.build-devnet.outputs.image_tag }}

deploy-to-devnet:
name: Deploy to devnet
runs-on: ubuntu-20.04
needs: [build-and-push]
environment:
name: devnet
steps:
- name: GIT | Checkout
uses: actions/checkout@v3

- name: Deploy Aleph Zero Dashboard to Devnet
uses: ./.github/actions/deploy
id: deploy-devnet
with:
environment: devnet
kustomize_version: ${{ vars.KUSTOMIZE_VERSION }}
image_tag: ${{ needs.build-and-push.outputs.image_tag }}
github_token: ${{ secrets.CI_GH_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-to-mainnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
id: build_mainnet
with:
environment: mainnet
build_envs: 'VITE_DISABLE_FIAT=1 VITE_DISABLE_TESTNET=1'
build_envs: 'VITE_DISABLE_FIAT=1 VITE_DISABLE_TESTNET=1 VITE_DISABLE_DEVNET=1'
aws_mainnet_access_key_id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
aws_mainnet_secret_access_key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
outputs:
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/build-and-deploy-to-testnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ name: Build, push and deploy Aleph Zero Dashboard to testnet
on:
workflow_dispatch:

push:
paths-ignore:
- '*.md'
branches:
- master

jobs:
build_and_push:
name: Build and push
Expand All @@ -24,7 +18,7 @@ jobs:
id: build_testnet
with:
environment: testnet
build_envs: 'VITE_DISABLE_MAINNET=1 VITE_DISABLE_FIAT=1'
build_envs: 'VITE_DISABLE_MAINNET=1 VITE_DISABLE_FIAT=1 VITE_DISABLE_DEVNET=1'
aws_mainnet_access_key_id: ${{ secrets.AWS_MAINNET_ACCESS_KEY_ID }}
aws_mainnet_secret_access_key: ${{ secrets.AWS_MAINNET_SECRET_ACCESS_KEY }}
outputs:
Expand Down
22 changes: 1 addition & 21 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,7 @@ Reach out to [email protected] for clarification of any content within this documen

## Environment Variables

Optionally apply the following environment variables in an environment file such as `.env` or with `yarn build` to customize the build of staking dashboard:

```
# disable all mentioning of fiat values and token prices
VITE_DISABLE_FIAT=1
# display an organization label in the network bar
VITE_ORGANISATION="© Parity Technologies"
# provide a privacy policy url in the network bar
VITE_PRIVACY_URL=https://...
# disable mainnet / testnet network (for e.g. testnet deployment)
VITE_DISABLE_MAINNET=1
VITE_DISABLE_TESTNET=1
# add connection to a custom network (for example a feature net, local and devnet are avaliable by default in a development build)
VITE_ENABLE_CUSTOM_NETWORK=1
VITE_CUSTOM_WS_ADDRESS=wss://ws.test.azero.dev
```
Optionally apply the following environment variables in an environment file, see [`.env`](.env) for example.

## Config Files

Expand Down
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

4 changes: 2 additions & 2 deletions docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ RUN apk add curl git gnupg ca-certificates
WORKDIR /apps
COPY . .

RUN npm install --legacy-peer-deps
RUN export $BUILD_ENVS && npm run build
RUN yarn install
RUN export $BUILD_ENVS && yarn build

# ===========================================================
FROM nginx:stable-alpine
Expand Down
28 changes: 16 additions & 12 deletions src/config/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ if (import.meta.env.VITE_ENABLE_CUSTOM_NETWORK === '1') {
NetworkList[azeroCustom.name] = azeroCustom;
}

if (import.meta.env.MODE === 'development') {
const azeroLocal = {
name: 'Aleph Zero Local',
if (import.meta.env.VITE_DISABLE_DEVNET !== '1') {
const azeroDevnet = {
name: 'Aleph Zero Devnet',
endpoints: {
rpc: 'ws://localhost:9944',
rpc: 'wss://ws.dev.azero.dev',
lightClient: null,
},
namespace: '',
Expand All @@ -219,7 +219,7 @@ if (import.meta.env.MODE === 'development') {
dark: 'rgb(0, 204, 171, 0.33)',
},
},
unit: 'LZERO',
unit: 'DZERO',
units: 12,
ss58: 42,
brand: {
Expand All @@ -235,7 +235,7 @@ if (import.meta.env.MODE === 'development') {
},
},
api: {
unit: 'LZERO',
unit: 'DZERO',
priceTicker: 'DOTUSDT', // this is for compatibility with binance endpoint, it's pinged for current token value, but we don't display that value
},
params: {
Expand All @@ -245,10 +245,15 @@ if (import.meta.env.MODE === 'development') {
},
defaultFeeReserve: 0.1,
} as const;
const azeroDevnet = {
name: 'Aleph Zero Devnet',

NetworkList[azeroDevnet.name] = azeroDevnet;
}

if (import.meta.env.MODE === 'development') {
const azeroLocal = {
name: 'Aleph Zero Local',
endpoints: {
rpc: 'wss://ws.dev.azero.dev',
rpc: 'ws://localhost:9944',
lightClient: null,
},
namespace: '',
Expand All @@ -274,7 +279,7 @@ if (import.meta.env.MODE === 'development') {
dark: 'rgb(0, 204, 171, 0.33)',
},
},
unit: 'DZERO',
unit: 'LZERO',
units: 12,
ss58: 42,
brand: {
Expand All @@ -290,7 +295,7 @@ if (import.meta.env.MODE === 'development') {
},
},
api: {
unit: 'DZERO',
unit: 'LZERO',
priceTicker: 'DOTUSDT', // this is for compatibility with binance endpoint, it's pinged for current token value, but we don't display that value
},
params: {
Expand All @@ -302,5 +307,4 @@ if (import.meta.env.MODE === 'development') {
} as const;

NetworkList[azeroLocal.name] = azeroLocal;
NetworkList[azeroDevnet.name] = azeroDevnet;
}

0 comments on commit e28bc1d

Please sign in to comment.