diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 641fa4c8..4c67a0e1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,6 +2,14 @@ name: Build on: workflow_dispatch: + inputs: + ENVIRONMENT_NAME: + description: 'Environment Name' + required: true + default: Stokenet + type: choice + options: + - Stokenet push: branches: @@ -246,7 +254,7 @@ jobs: HELM_GH_PASS: ${{ secrets.HELM_GH_PASS }} deploy-dev: - if: github.ref == 'refs/heads/develop' + if: github.ref == 'refs/heads/develop' && github.event_name == 'push' runs-on: ubuntu-latest needs: - push-docker-image @@ -351,3 +359,98 @@ jobs: INGRESS_DOMAIN: ${{ secrets.INGRESS_DOMAIN }} HELM_GH_USER: ${{ secrets.HELM_GH_USER }} HELM_GH_PASS: ${{ secrets.HELM_GH_PASS }} + + deploy-stokenet: + if: ( github.event.inputs.ENVIRONMENT_NAME == 'Stokenet' && github.event_name == 'workflow_dispatch' ) + runs-on: ubuntu-latest + environment: stokenet + needs: + - push-docker-image + permissions: + id-token: write + contents: read + pull-requests: read + steps: + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: unfor19/install-aws-cli-action@457b7980b125044247e455d87b9a26fc2299b787 + with: + version: 2 + - name: Setup helmfile and helm + uses: mamezou-tech/setup-helmfile@55ae2a66c5af4883148b7a50cc6ddc9b61042184 + with: + helm-diff-plugin-version: 'v3.1.3' + helmfile-version: 'v0.144.0' + helm-version: 'v3.11.0' + install-kubectl: no + - name: Install kubectl + uses: azure/setup-kubectl@901a10e89ea615cf61f57ac05cecdf23e7de06d8 #v3.2 + with: + version: 'v1.25.6' + - name: Configure AWS credentials for deployment + uses: aws-actions/configure-aws-credentials@bab55d3830fe69833c9fecaa51fe2c829a7508f3 + with: + role-to-assume: ${{ secrets.DEPLOY_STOKENET_IAM_ROLE }} + aws-region: eu-west-2 + - name: Deploy application + working-directory: deploy/helm + run: | + aws eks update-kubeconfig --name ${{ secrets.STOKENET_CLUSTER_NAME }} \ + --alias ${{ secrets.STOKENET_CLUSTER_NAME }} \ + --region eu-west-2 + + helmfile --environment stokenet --namespace radix-dapp-toolkit-stokenet \ + --state-values-set "ci.tag=${{ env.CI_TAG }}" \ + --state-values-set "ci.ingressDomain=${{ env.INGRESS_DOMAIN }}" \ + apply + env: + CI_TAG: ${{ fromJSON(needs.push-docker-image.outputs.json).labels['org.opencontainers.image.version'] }} + INGRESS_DOMAIN: ${{ secrets.STOKENET_INGRESS_DOMAIN }} + HELM_GH_USER: ${{ secrets.HELM_GH_USER }} + HELM_GH_PASS: ${{ secrets.HELM_GH_PASS }} + + deploy-mainnet: + if: github.event_name == 'release' && !github.event.release.prerelease + runs-on: ubuntu-latest + needs: + - push-docker-image + permissions: + id-token: write + contents: read + pull-requests: read + steps: + - uses: actions/checkout@755da8c3cf115ac066823e79a1e1788f8940201b + - uses: unfor19/install-aws-cli-action@457b7980b125044247e455d87b9a26fc2299b787 + with: + version: 2 + - name: Setup helmfile and helm + uses: mamezou-tech/setup-helmfile@55ae2a66c5af4883148b7a50cc6ddc9b61042184 + with: + helm-diff-plugin-version: 'v3.1.3' + helmfile-version: 'v0.144.0' + helm-version: 'v3.11.0' + install-kubectl: no + - name: Install kubectl + uses: azure/setup-kubectl@901a10e89ea615cf61f57ac05cecdf23e7de06d8 #v3.2 + with: + version: 'v1.25.6' + - name: Configure AWS credentials for deployment + uses: aws-actions/configure-aws-credentials@bab55d3830fe69833c9fecaa51fe2c829a7508f3 + with: + role-to-assume: ${{ secrets.DEPLOY_MAINNET_IAM_ROLE }} + aws-region: eu-west-2 + - name: Deploy application + working-directory: deploy/helm + run: | + aws eks update-kubeconfig --name ${{ secrets.MAINNET_CLUSTER_NAME }} \ + --alias ${{ secrets.MAINNET_CLUSTER_NAME }} \ + --region eu-west-2 + + helmfile --environment mainnet --namespace radix-dapp-toolkit-mainnet \ + --state-values-set "ci.tag=${{ env.CI_TAG }}" \ + --state-values-set "ci.ingressDomain=${{ env.INGRESS_DOMAIN }}" \ + apply + env: + CI_TAG: ${{ fromJSON(needs.push-docker-image.outputs.json).labels['org.opencontainers.image.version'] }} + INGRESS_DOMAIN: ${{ secrets.MAINNET_INGRESS_DOMAIN }} + HELM_GH_USER: ${{ secrets.HELM_GH_USER }} + HELM_GH_PASS: ${{ secrets.HELM_GH_PASS }} diff --git a/README.md b/README.md index edd33e65..25da0002 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,7 @@ - [Setting up a dApp Definition on the Radix Dashboard](#setting-up-a-dapp-definition-on-the-radix-dashboard) - [Data storage](#data-storage) - [Examples](#examples) +- [License](#license) # What is Radix dApp Toolkit? @@ -582,3 +583,7 @@ RDT handles writing and reading data to the browser’s local storage so that it # Examples The `examples` directory contains a react dApp that consumes RDT. Its main purpose is to be used by us internally for debugging but can also serve as a source of inspiration. + +# License + +The Radix Dapp Toolkit code is released under [Apache 2.0 license](LICENSE). Binaries are licensed under the [Radix Software EULA](http://www.radixdlt.com/terms/genericEULA) \ No newline at end of file diff --git a/commitlint.config.js b/commitlint.config.js index 4fedde6d..052f89f3 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1 +1,23 @@ -module.exports = { extends: ['@commitlint/config-conventional'] } +module.exports = { + extends: ['@commitlint/config-conventional'], + rules: { + 'type-enum': () => [ + 2, + 'always', + [ + 'build', + 'chore', + 'ci', + 'docs', + 'feat', + 'fix', + 'perf', + 'refactor', + 'revert', + 'style', + 'test', + 'major', + ], + ], + }, +} diff --git a/deploy/helm/environments/mainnet/values.yaml.gotmpl b/deploy/helm/environments/mainnet/values.yaml.gotmpl new file mode 100644 index 00000000..b7d06778 --- /dev/null +++ b/deploy/helm/environments/mainnet/values.yaml.gotmpl @@ -0,0 +1,35 @@ +autoscaling: + enabled: true + minReplicas: 3 + maxReplicas: 15 + targetCPUUtilizationPercentage: 70 + targetMemoryUtilizationPercentage: 70 +resources: + limits: + memory: 256Mi + requests: + cpu: 150m + memory: 256Mi + +ingress: + enabled: true + hosts: + - host: {{ .StateValues.ci.ingressDomain }} + paths: + - path: / + pathType: Prefix + basic_auth: true + annotations: + nginx.ingress.kubernetes.io/auth-type: basic + nginx.ingress.kubernetes.io/auth-secret: radix-dapp-toolkit-basic-auth + nginx.ingress.kubernetes.io/auth-realm: 'Auth Required - Mainnet' + +alertmanager: + env: "mainnet" + nameOverride: "radix-dapp-toolkit-amcfg" + slackConfig: + channel: "feed--alerts-dapps-mainnet" + secrets: + region: eu-west-2 + name: "rtlj-prod/eks/dapps/mainnet/alertmanager-integration-keys" + enable_pagerduty_notifications: true \ No newline at end of file diff --git a/deploy/helm/environments/stokenet/values.yaml.gotmpl b/deploy/helm/environments/stokenet/values.yaml.gotmpl new file mode 100644 index 00000000..f6c61b89 --- /dev/null +++ b/deploy/helm/environments/stokenet/values.yaml.gotmpl @@ -0,0 +1,30 @@ +autoscaling: + enabled: true + minReplicas: 2 + maxReplicas: 5 + targetCPUUtilizationPercentage: 70 + targetMemoryUtilizationPercentage: 70 +resources: + limits: + memory: 256Mi + requests: + cpu: 150m + memory: 256Mi + +ingress: + enabled: true + hosts: + - host: {{ .StateValues.ci.ingressDomain }} + paths: + - path: / + pathType: Prefix + +alertmanager: + env: "stokenet" + nameOverride: "radix-dapp-toolkit-amcfg" + slackConfig: + channel: "feed--alerts-dapps-dev" + secrets: + region: eu-west-2 + name: "rtlj-prod/eks/dapps/dev/alertmanager-integration-keys" + enable_pagerduty_notifications: true \ No newline at end of file diff --git a/deploy/helm/helmfile.yaml b/deploy/helm/helmfile.yaml index cf7e2d9e..2d310d8c 100644 --- a/deploy/helm/helmfile.yaml +++ b/deploy/helm/helmfile.yaml @@ -13,6 +13,8 @@ repositories: environments: dev: {} pr: {} + stokenet: {} + mainnet: {} releases: - name: radix-dapp-toolkit chart: ./radix-dapp-toolkit @@ -26,3 +28,10 @@ releases: values: - environments/common/values.yaml.gotmpl - environments/{{ .Environment.Name }}/values.yaml.gotmpl + + - name: alertmanager + chart: rdx-works/alertmanager-configs + version: 1.1.0 + installed: {{ or (eq .Environment.Name "mainnet") (eq .Environment.Name "stokenet") }} + values: + - environments/{{ .Environment.Name }}/values.yaml.gotmpl diff --git a/deploy/helm/radix-dapp-toolkit/templates/basic-auth-secret.yaml b/deploy/helm/radix-dapp-toolkit/templates/basic-auth-secret.yaml new file mode 100644 index 00000000..19fc684f --- /dev/null +++ b/deploy/helm/radix-dapp-toolkit/templates/basic-auth-secret.yaml @@ -0,0 +1,13 @@ +{{- if .Values.ingress.basic_auth }} +apiVersion: kubernetes-client.io/v1 +kind: ExternalSecret +metadata: + name: radix-dapp-toolkit-basic-auth +spec: + backendType: secretsManager + region: eu-west-2 + data: + - key: rtlj-prod/eks/dapps/mainnet/temp-basic-auth + name: auth + property: auth +{{- end }} diff --git a/examples/components/Layout.tsx b/examples/components/Layout.tsx index 076aac56..1585573b 100644 --- a/examples/components/Layout.tsx +++ b/examples/components/Layout.tsx @@ -51,6 +51,7 @@ function Header(props: BoxProps) { sx={[ { p: 2, + pr: 3, gap: 2, bgcolor: 'background.surface', display: 'flex', diff --git a/examples/create-token/CreateNftCard.tsx b/examples/create-token/CreateNftCard.tsx index a516d301..c28086d7 100644 --- a/examples/create-token/CreateNftCard.tsx +++ b/examples/create-token/CreateNftCard.tsx @@ -7,7 +7,6 @@ import FormLabel from '@mui/joy/FormLabel' import Button from '@mui/joy/Button' import { createToken } from '../manifests/tokens' import { useRdt } from '../rdt/hooks/useRdt' -import { accounts } from '../../src/data-request/builders/accounts' import { Alert, Stack } from '@mui/joy' import { useLogger } from '../components/Logger' import { Card } from '../components/Card' diff --git a/examples/integration-tests/GumballMachine/GumballMachineExamples.tsx b/examples/integration-tests/GumballMachine/GumballMachineExamples.tsx index 44ec7727..e96c0bfe 100644 --- a/examples/integration-tests/GumballMachine/GumballMachineExamples.tsx +++ b/examples/integration-tests/GumballMachine/GumballMachineExamples.tsx @@ -77,10 +77,10 @@ a) Deposit entire worktop to Alpha`, ['accountAlpha', 'accountBravo', 'componentAlpha', 'componentBravo'], `Instantiate another gumball machine prior to this scenario, again assuming price of 1 -1) Withdraw 2 XRD from Alpha -2) Create bucket of 2 XRD +1) Withdraw 8 XRD from Alpha +2) Create bucket of 8 XRD 3) Call buy_gumball on machine Alpha with bucket -4) Create bucket of all XRD +4) Create bucket of 7 XRD 5) Call buy_gumball on machine Bravo with bucket 6) Deposit entire worktop to Bravo`, ], diff --git a/examples/layouts/Header.tsx b/examples/layouts/Header.tsx index 8c7e0844..5aef0e06 100644 --- a/examples/layouts/Header.tsx +++ b/examples/layouts/Header.tsx @@ -1,6 +1,7 @@ // @ts-ignore import radixLogo from '../assets/radix-icon_128x128.png' import * as React from 'react' +import '@radixdlt/dapps-dropdown' import Box from '@mui/joy/Box' import Typography from '@mui/joy/Typography' import IconButton from '@mui/joy/IconButton' @@ -18,6 +19,10 @@ declare global { React.HTMLAttributes, HTMLElement > + 'radix-dapps-dropdown': React.DetailedHTMLProps< + React.HTMLAttributes, + HTMLElement + > } } } @@ -57,7 +62,15 @@ export const Header = ({ - + +