From 643797884b78e3e843285867e0bfb1a877627abb Mon Sep 17 00:00:00 2001 From: Cafe137 Date: Fri, 6 Dec 2024 11:09:28 +0100 Subject: [PATCH 1/3] feat: optionally deploy config in get-bee command --- src/command/utility/get-bee.ts | 45 ++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 5 deletions(-) diff --git a/src/command/utility/get-bee.ts b/src/command/utility/get-bee.ts index cdd60fc1..753317b6 100644 --- a/src/command/utility/get-bee.ts +++ b/src/command/utility/get-bee.ts @@ -1,7 +1,9 @@ +import { Strings } from 'cafe-utility' import { execSync } from 'child_process' -import { writeFileSync } from 'fs' +import { existsSync, writeFileSync } from 'fs' import { LeafCommand } from 'furious-commander' import fetch from 'node-fetch' +import { CommandLineError } from '../../utils/error' import { RootCommand } from '../root-command' const archTable = { @@ -37,11 +39,44 @@ export class GetBee extends RootCommand implements LeafCommand { this.console.info('Bee downloaded successfully') if (process.platform !== 'win32') { - this.console.info(`Running chmod +x bee`) + this.console.info(`Running chmod +x bee to make it executable`) execSync('chmod +x bee') } - this.console.log('Verify the version of the downloaded Bee binary by running:') - this.console.log('') - this.console.log('./bee version') + + this.console.info('') + const deployConfig = await this.console.confirm('Create a preset Bee config.yaml file?') + + if (deployConfig) { + if (existsSync('config.yaml')) { + throw new CommandLineError('config.yaml already exists, stopping') + } + + this.console.info('') + this.console.info('Ultra-light: Limited download capabilities, no requirements') + this.console.info('Light: Upload and download, requires xDAI to launch and xBZZ to upload') + + const type = await this.console.promptList(['ultra-light', 'light'], 'Select the type of configuration to create') + writeFileSync( + 'config.yaml', + `api-addr: 127.0.0.1:1633 +blockchain-rpc-endpoint: "https://xdai.fairdatasociety.org" +cors-allowed-origins: ["*"] +data-dir: "${process.cwd()}/data-dir" +full-node: false +mainnet: true +storage-incentives-enable: false +swap-enable: ${type === 'light' ? 'true' : 'false'} +password: "${Strings.randomAlphanumeric(20)}"`, + ) + + this.console.info('') + this.console.info('All set! Start Bee node by running:') + this.console.info('') + this.console.info('./bee start --config=config.yaml') + } else { + this.console.info('Verify the version of the downloaded Bee binary by running:') + this.console.info('') + this.console.info('./bee version') + } } } From c7cbb91bb4ada0e124929c057062ffcfe2db258a Mon Sep 17 00:00:00 2001 From: Cafe137 Date: Fri, 6 Dec 2024 14:38:52 +0100 Subject: [PATCH 2/3] chore: wording --- src/command/utility/get-bee.ts | 43 ++++++++++++++-------------------- 1 file changed, 18 insertions(+), 25 deletions(-) diff --git a/src/command/utility/get-bee.ts b/src/command/utility/get-bee.ts index 753317b6..a8103274 100644 --- a/src/command/utility/get-bee.ts +++ b/src/command/utility/get-bee.ts @@ -3,7 +3,6 @@ import { execSync } from 'child_process' import { existsSync, writeFileSync } from 'fs' import { LeafCommand } from 'furious-commander' import fetch from 'node-fetch' -import { CommandLineError } from '../../utils/error' import { RootCommand } from '../root-command' const archTable = { @@ -36,47 +35,41 @@ export class GetBee extends RootCommand implements LeafCommand { await fetch(url) .then(x => x.arrayBuffer()) .then(x => writeFileSync(`bee${suffixString}`, Buffer.from(x))) - this.console.info('Bee downloaded successfully') + this.console.log('Bee downloaded successfully') if (process.platform !== 'win32') { this.console.info(`Running chmod +x bee to make it executable`) execSync('chmod +x bee') } - this.console.info('') - const deployConfig = await this.console.confirm('Create a preset Bee config.yaml file?') + if (existsSync('config.yaml')) { + this.console.log('config.yaml already exists, done') - if (deployConfig) { - if (existsSync('config.yaml')) { - throw new CommandLineError('config.yaml already exists, stopping') - } + return + } - this.console.info('') - this.console.info('Ultra-light: Limited download capabilities, no requirements') - this.console.info('Light: Upload and download, requires xDAI to launch and xBZZ to upload') + this.console.info('') + this.console.info('Ultra-light: Limited download capabilities, no funding required.') + this.console.info('Light: Full functionality; requires xDAI to launch and xBZZ for uploading and retrieving data.') - const type = await this.console.promptList(['ultra-light', 'light'], 'Select the type of configuration to create') - writeFileSync( - 'config.yaml', - `api-addr: 127.0.0.1:1633 + const type = await this.console.promptList(['ultra-light', 'light'], 'Select the type of configuration to create') + writeFileSync( + 'config.yaml', + `api-addr: 127.0.0.1:1633 blockchain-rpc-endpoint: "https://xdai.fairdatasociety.org" cors-allowed-origins: ["*"] data-dir: "${process.cwd()}/data-dir" full-node: false mainnet: true +resolver-options: ["https://cloudflare-eth.com"] storage-incentives-enable: false swap-enable: ${type === 'light' ? 'true' : 'false'} password: "${Strings.randomAlphanumeric(20)}"`, - ) + ) - this.console.info('') - this.console.info('All set! Start Bee node by running:') - this.console.info('') - this.console.info('./bee start --config=config.yaml') - } else { - this.console.info('Verify the version of the downloaded Bee binary by running:') - this.console.info('') - this.console.info('./bee version') - } + this.console.info('') + this.console.log('All set! Start Bee node by running:') + this.console.info('') + this.console.log('./bee start --config=config.yaml') } } From 419710ec623851dbd931403326fe5d8b8392cabc Mon Sep 17 00:00:00 2001 From: Cafe137 Date: Sun, 8 Dec 2024 19:26:46 +0100 Subject: [PATCH 3/3] ci: simplify test ci --- .github/workflows/ci.yaml | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6dd12bac..772b9432 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -31,22 +31,8 @@ jobs: with: node-version: ${{ matrix.node-version }} - - name: Auth to Github Package Docker Registry - run: | - echo "${{ secrets.GITHUB_TOKEN }}" | docker login https://docker.pkg.github.com -u ${GITHUB_ACTOR} --password-stdin - - ## Try getting the node modules from cache, if failed npm ci - - uses: actions/cache@v2 - id: cache-npm - with: - path: node_modules - key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.OS }}-node-${{ matrix.node }}-${{ env.cache-name }}- - ${{ runner.OS }}-node-${{ matrix.node }}- - - name: Install npm deps - run: npm install -g npm && npm ci && npm install -g @fairdatasociety/fdp-play + run: npm ci && npm install -g @fairdatasociety/fdp-play - name: Start fdp-play environment run: npm run bee