From fa952753072d39e5fe14877f8e37faced4cd1b55 Mon Sep 17 00:00:00 2001 From: Kirill Klimenko Date: Mon, 22 Jan 2024 18:29:38 +0100 Subject: [PATCH 1/3] Remove IPFS deployment --- .github/workflows/release-ipfs-dev.yaml | 60 --------------------- .github/workflows/release-ipfs-prod.yaml | 60 --------------------- .github/workflows/release-ipfs-staging.yaml | 60 --------------------- README.md | 16 ++---- docs/IPFS_HOSTING.md | 21 -------- package.json | 1 - utils/ipfs/postBuild.js | 30 ----------- utils/ipfs/prepareBuild.js | 30 ----------- 8 files changed, 5 insertions(+), 273 deletions(-) delete mode 100644 .github/workflows/release-ipfs-dev.yaml delete mode 100644 .github/workflows/release-ipfs-prod.yaml delete mode 100644 .github/workflows/release-ipfs-staging.yaml delete mode 100644 docs/IPFS_HOSTING.md delete mode 100644 utils/ipfs/postBuild.js delete mode 100644 utils/ipfs/prepareBuild.js diff --git a/.github/workflows/release-ipfs-dev.yaml b/.github/workflows/release-ipfs-dev.yaml deleted file mode 100644 index 33aed2bfb0..0000000000 --- a/.github/workflows/release-ipfs-dev.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: Release IPFS Dev -on: - push: - branches: - - develop - -jobs: - create_release: - name: Create IPFS Release - - runs-on: ubuntu-latest - - environment: dev - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up node - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - - - name: Install and Build - run: | - npm install - npm run graphql:build - npm run build:ipfs - env: - NEXT_PUBLIC_INFURA_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_API_KEY }} - NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }} - NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} - NEXT_PUBLIC_ETHERSCAN_API_KEY: ${{ secrets.NEXT_PUBLIC_ETHERSCAN_API_KEY }} - NEXT_PUBLIC_INFURA_IPFS_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_IPFS_API_KEY }} - NEXT_PUBLIC_INFURA_IPFS_API_SECRET: ${{ secrets.NEXT_PUBLIC_INFURA_IPFS_API_SECRET }} - - - name: IPFS Pinata deploy GitHub action - uses: decent-dao/ipfs-pinata-deploy-action@v2.0.1 - id: upload - with: - pin-name: 'app.dev.fractalframework.xyz' - path: './out/' - pinata-api-key: ${{ secrets.PINATA_API_KEY }} - pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }} - - - name: Convert CIDv0 to CIDv1 - id: convert_cidv0 - uses: decent-dao/convert-cidv0-cidv1@v1.0.0 - with: - cidv0: ${{ steps.upload.outputs.hash }} - - - name: Update DNS with new IPFS hash - uses: textileio/cloudflare-update-dnslink@v2 - with: - cid: ${{ steps.convert_cidv0.outputs.cidv1 }} - env: - CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} - RECORD_DOMAIN: 'fractalframework.xyz' - RECORD_NAME: '_dnslink.app.dev' - CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} diff --git a/.github/workflows/release-ipfs-prod.yaml b/.github/workflows/release-ipfs-prod.yaml deleted file mode 100644 index b9c23b40c3..0000000000 --- a/.github/workflows/release-ipfs-prod.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: Release IPFS Prod -on: - push: - branches: - - main - -jobs: - create_release: - name: Create IPFS Release - - runs-on: ubuntu-latest - - environment: prod - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up node - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - - - name: Install and Build - run: | - npm install - npm run graphql:build - npm run build:ipfs - env: - NEXT_PUBLIC_INFURA_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_API_KEY }} - NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }} - NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} - NEXT_PUBLIC_ETHERSCAN_API_KEY: ${{ secrets.NEXT_PUBLIC_ETHERSCAN_API_KEY }} - NEXT_PUBLIC_INFURA_IPFS_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_IPFS_API_KEY }} - NEXT_PUBLIC_INFURA_IPFS_API_SECRET: ${{ secrets.NEXT_PUBLIC_INFURA_IPFS_API_SECRET }} - - - name: IPFS Pinata deploy GitHub action - uses: decent-dao/ipfs-pinata-deploy-action@v2.0.1 - id: upload - with: - pin-name: 'app.fractalframework.xyz' - path: './out/' - pinata-api-key: ${{ secrets.PINATA_API_KEY }} - pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }} - - - name: Convert CIDv0 to CIDv1 - id: convert_cidv0 - uses: decent-dao/convert-cidv0-cidv1@v1.0.0 - with: - cidv0: ${{ steps.upload.outputs.hash }} - - - name: Update DNS with new IPFS hash - uses: textileio/cloudflare-update-dnslink@v2 - with: - cid: ${{ steps.convert_cidv0.outputs.cidv1 }} - env: - CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} - RECORD_DOMAIN: 'fractalframework.xyz' - RECORD_NAME: '_dnslink.app' - CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} diff --git a/.github/workflows/release-ipfs-staging.yaml b/.github/workflows/release-ipfs-staging.yaml deleted file mode 100644 index 58e4a9e3be..0000000000 --- a/.github/workflows/release-ipfs-staging.yaml +++ /dev/null @@ -1,60 +0,0 @@ -name: Release IPFS Staging -on: - push: - branches: - - staging - -jobs: - create_release: - name: Create IPFS Release - - runs-on: ubuntu-latest - - environment: staging - - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up node - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - - - name: Install and Build - run: | - npm install - npm run graphql:build - npm run build:ipfs - env: - NEXT_PUBLIC_INFURA_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_API_KEY }} - NEXT_PUBLIC_ALCHEMY_API_KEY: ${{ secrets.NEXT_PUBLIC_ALCHEMY_API_KEY }} - NEXT_PUBLIC_SITE_URL: ${{ secrets.NEXT_PUBLIC_SITE_URL }} - NEXT_PUBLIC_ETHERSCAN_API_KEY: ${{ secrets.NEXT_PUBLIC_ETHERSCAN_API_KEY }} - NEXT_PUBLIC_INFURA_IPFS_API_KEY: ${{ secrets.NEXT_PUBLIC_INFURA_IPFS_API_KEY }} - NEXT_PUBLIC_INFURA_IPFS_API_SECRET: ${{ secrets.NEXT_PUBLIC_INFURA_IPFS_API_SECRET }} - - - name: IPFS Pinata deploy GitHub action - uses: decent-dao/ipfs-pinata-deploy-action@v2.0.1 - id: upload - with: - pin-name: 'app.staging.fractalframework.xyz' - path: './out/' - pinata-api-key: ${{ secrets.PINATA_API_KEY }} - pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }} - - - name: Convert CIDv0 to CIDv1 - id: convert_cidv0 - uses: decent-dao/convert-cidv0-cidv1@v1.0.0 - with: - cidv0: ${{ steps.upload.outputs.hash }} - - - name: Update DNS with new IPFS hash - uses: textileio/cloudflare-update-dnslink@v2 - with: - cid: ${{ steps.convert_cidv0.outputs.cidv1 }} - env: - CLOUDFLARE_TOKEN: ${{ secrets.CLOUDFLARE_TOKEN }} - RECORD_DOMAIN: 'fractalframework.xyz' - RECORD_NAME: '_dnslink.app.staging' - CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} diff --git a/README.md b/README.md index dd88227583..1ac8ba529b 100644 --- a/README.md +++ b/README.md @@ -74,21 +74,15 @@ Test results for each test on each browser type will be output into the `/playwr ## Deployment Notes -The "dev", "staging", and "prod" environments of this app are currently deployed via both Netlify and IPFS (see the Github workflow files). +The "dev", "staging", and "prod" environments of this app are currently deployed via Netlify. The "dev" environment tracks the `develop` branch, "staging" tracks `staging`, and the "prod" environment tracks the `main` branch. The "dev", "staging", and "prod" Github environments are where custom environment variables are configured. -So at any given time, there are effectively six builds out there, and they are publicly accessible and privately configurable within Github: +So at any given time, there are effectively three builds out there, and they are publicly accessible and privately configurable within Github: -1. dev site via Netlify +1. dev site - url: https://app.dev.fractalframework.xyz -1. dev [site via IPFS](./docs/IPFS_HOSTING.md) - - url: http://app.dev.fractalframework.xyz.ipns.localhost:8080/ -1. staging site via Netlify +2. staging site - url: https://app.staging.fractalframework.xyz -1. staging [site via IPFS](./docs/IPFS_HOSTING.md) - - url: http://app.staging.fractalframework.xyz.ipns.localhost:8080/ -1. prod site via Netlify +3. prod site - url: https://app.fractalframework.xyz -1. prod [site via IPFS](./docs/IPFS_HOSTING.md) - - url: http://app.fractalframework.xyz.ipns.localhost:8080/ diff --git a/docs/IPFS_HOSTING.md b/docs/IPFS_HOSTING.md deleted file mode 100644 index 58fe6e4128..0000000000 --- a/docs/IPFS_HOSTING.md +++ /dev/null @@ -1,21 +0,0 @@ -# App Hosting on IPFS - -## Setup -Fractal's app hosting on IPFS consists of the following setup pieces: - -- `PINATA_API_KEY` and `PINATA_API_SECRET_KEY` repository secrets for a https://www.pinata.cloud/ account. A free account is limited to only 100 pinned files, so a paid account is necessary. -- The Github workflow files `release-ipfs-dev.yaml`, `release-ipfs-staging.yaml`, and `release-ipfs-prod.yaml` which trigger an upload and pinning of the static app files, which trigger on each push to the `develop`, `staging` or `main` branches, respectively. -- A [DNSLink](https://dnslink.dev/) set within Cloudflare that redirects a user running an IPFS node (see below) to the IPFS hosted version of the app. - -Additionally, customized setup pieces are referenced within the workflow yaml files: - -- [ipfs-pinata-deploy-action](https://github.com/decent-dao/ipfs-pinata-deploy-action) - A Github action for deploying to IPFS through Pinata -- [convert-cidv0-cidv1](https://github.com/decent-dao/convert-cidv0-cidv1) - A GitHub action for converting a CIDv0 (IPFS hash) value to CIDv1 - -## Running an IPFS Node -In order to view the IPFS hosted version of the app you will need an IPFS node running on your machine as well as the IPFS browser plugin: - -- [IPFS Desktop app](https://docs.ipfs.tech/install/ipfs-desktop/) - for running a node -- [IPFS Browser plugin](https://chrome.google.com/webstore/detail/ipfs-companion/nibjojkomfdiaoajekhjakgkdhaomnch) - Chrome plugin (other browsers also supported) - -Now, when navigating to e.g. https://app.dev.fractalframework.xyz/ you should see the URL redirect to https://app.dev.fractalframework.xyz.ipns.localhost:8080/, and you are now viewing the IPFS hosted version. This may take some time on first viewing the site, as the files are all downloaded to your local IPFS node. \ No newline at end of file diff --git a/package.json b/package.json index 0fb9b2888b..f490f1f352 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,6 @@ "start:https": "npm run set:env & HTTPS=true next start", "start:windows": "set \"GENERATE_SOURCEMAP=false\" && for /F \"delims=\" %I in ('git rev-parse HEAD') do set \"NEXT_PUBLIC_GIT_HASH=%I\" && next start", "build": "npm run graphql:build && NEXT_PUBLIC_GIT_HASH=`git rev-parse HEAD` next build", - "build:ipfs": "node ./utils/ipfs/prepareBuild.js && next build && node ./utils/ipfs/postBuild.js", "build:windows": "for /F \"delims=\" %I in ('git rev-parse HEAD') do set \"NEXT_PUBLIC_GIT_HASH=%I\" && next build", "graphql:build": "graphclient build", "graphql:dev-server": "graphclient serve-dev", diff --git a/utils/ipfs/postBuild.js b/utils/ipfs/postBuild.js deleted file mode 100644 index 082122b524..0000000000 --- a/utils/ipfs/postBuild.js +++ /dev/null @@ -1,30 +0,0 @@ -const fs = require('fs') - -function updateFile(filename, replacement) { - return new Promise(function(resolve) { - fs.readFile(filename, 'utf-8', function(err, data) { - if (err) { - throw (err); - } else { - data = data.replace(replacement.rule, replacement.replacer); - console.log("Writing to file", filename, data); - } - fs.writeFile(filename, data, 'utf-8', function(err) { - - if (err) { - throw (err); - } else { - resolve(); - } - }); - }); - }) -} - -updateFile( - "next.config.js", - { - rule: "output: 'export',", - replacer: "output: undefined," - } -); \ No newline at end of file diff --git a/utils/ipfs/prepareBuild.js b/utils/ipfs/prepareBuild.js deleted file mode 100644 index 29154e34cf..0000000000 --- a/utils/ipfs/prepareBuild.js +++ /dev/null @@ -1,30 +0,0 @@ -const fs = require('fs') - -function updateFile(filename, replacement) { - return new Promise(function(resolve) { - fs.readFile(filename, 'utf-8', function(err, data) { - if (err) { - throw (err); - } else { - data = data.replace(replacement.rule, replacement.replacer); - console.log("Writing to file", filename, data); - } - fs.writeFile(filename, data, 'utf-8', function(err) { - - if (err) { - throw (err); - } else { - resolve(); - } - }); - }); - }) -} - -updateFile( - "next.config.js", - { - rule: "output: undefined,", - replacer: "output: 'export'," - } -); \ No newline at end of file From a337ad60bc2ebd9eeaa06944cc36b9f87a8b2f32 Mon Sep 17 00:00:00 2001 From: Kirill Klimenko Date: Mon, 22 Jan 2024 18:30:16 +0100 Subject: [PATCH 2/3] Clean up output in next.config.js --- next.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/next.config.js b/next.config.js index 89d9879905..c8095e7756 100644 --- a/next.config.js +++ b/next.config.js @@ -1,6 +1,5 @@ /** @type {import('next').NextConfig} */ module.exports = { - output: undefined, webpack(config) { config.resolve.fallback = { fs: false, From 84a54a4763b2d2bec27136706cb8f398828f6d27 Mon Sep 17 00:00:00 2001 From: Kirill Klimenko Date: Tue, 23 Jan 2024 17:39:17 +0100 Subject: [PATCH 3/3] Move testid for accountMenu-network into Select --- .../ui/menus/AccountDisplay/MenuItemNetwork.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/components/ui/menus/AccountDisplay/MenuItemNetwork.tsx b/src/components/ui/menus/AccountDisplay/MenuItemNetwork.tsx index 8df4e47ff6..6027ea0dd5 100644 --- a/src/components/ui/menus/AccountDisplay/MenuItemNetwork.tsx +++ b/src/components/ui/menus/AccountDisplay/MenuItemNetwork.tsx @@ -38,6 +38,7 @@ export function MenuItemNetwork() { width="100%" bgColor="#2c2c2c" borderColor="#4d4d4d" + data-testid="accountMenu-network" rounded="sm" cursor="pointer" onChange={async e => { @@ -57,12 +58,7 @@ export function MenuItemNetwork() { bg={chain.color} rounded="full" /> - - {chain.name} - + {chain.name} ))}