Skip to content

Commit

Permalink
Merge pull request #115 from nevermined-io/feat/circuits-by-env-var
Browse files Browse the repository at this point in the history
feat: update to support dynamic circuits location
  • Loading branch information
eruizgar91 authored Jan 30, 2023
2 parents a4eef8f + 7a4cff5 commit 6f584dd
Show file tree
Hide file tree
Showing 14 changed files with 46 additions and 14 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ IPFS_PROJECT_ID="2DAQCd37vAOT7rMZ8J2J9LnbO8N"
IPFS_PROJECT_SECRET="cd6f32767707d6cd34d151b0049f444d"
ENABLE_PROVENANCE=true
ARTIFACTS_FOLDER=./artifacts
CIRCUITS_FOLDER=./circuits

ENABLE_COMPUTE=true
ARGO_HOST=http://localhost:2746/
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/testing-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,18 @@ jobs:
yarn run lint
- name: Check code formatting
run: yarn format:check
- uses: nevermined-io/[email protected].0
- uses: nevermined-io/[email protected].1
with:
token: ${{ secrets.API_TOKEN_GITHUB }}
opengsn: "true"
estuary: "true"
contracts-version: "v3.0.0-rc5"
node: "false"
- name: Check artifacts
run: |
nvm-tools copy-artifacts ./artifacts
ls -l artifacts
nvm-tools copy-circuits ./circuits
ls -l circuits
- name: Run tests
run: |
export PROVIDER_KEYFILE=accounts/provider.json
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ This will leave you with a `local.js` file within the `config` folder that will
The Nevermined Node reads the following environment variables allowing the configuration of the deployment without modifying any config file:

| Variable Name | Description | Example |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|
| **WEB3_PROVIDER_URL** | HTTP url of the web3 provider. The most popular providers are Infura & Alchemy, but anyone else can be used. The url depends on the network you want to connect. | http://mumbai.alchemy.io/v2/xxxxx |
| **MARKETPLACE_URI** | HTTP url to the Marketplace API | https://marketplace-api.mumbai.public.nevermined.rocks |
| **NODE_URI** | Public HTTP url where this node is exposed | https://node.mumbai.public.nevermined.rocks |
Expand All @@ -80,6 +80,7 @@ The Nevermined Node reads the following environment variables allowing the confi
| **AWS_S3_BUCKET_NAME** | Name of the S3 Bucket | `metadata` |
| **ENABLE_PROVENANCE** | If `true` it will enable the integration with the provenance registry | `true` or `false` |
| **ARTIFACTS_FOLDER** | Path where the Node will look for the Smart Contracts ABIs | A file system path. If not given it will look in the `./artifacts` folder |
| **CIRCUITS_FOLDER** | Path where the Node will look for the Circuits. | A file system path. If not given it will look in the `./circuits` folder |
| **ENABLE_COMPUTE** | Enables the Nevermined's compute endpoints | `false` |
| **ARGO_HOST** | HTTP url of the Argo Workflows instance we want to use for computing capabilities. Requires ENABLE_COMPUTE = true | `https://argo-workflows.instance` |
| **ARGO_NAMESPACE** | Name of the Argo Workflows namespace where we will deploy the Nevermined's Compute Workflows. Requires ENABLE_COMPUTE = true | `argo` |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ spec:
# value:
# - name: artifacts_folder
# value:
# - name: circuits_folder
# value:
# - name: input_dir
# value:
# - name: output_dir
Expand Down Expand Up @@ -95,6 +97,8 @@ spec:
value: '{{workflow.parameters.marketplace_api_url}}'
- name: ARTIFACTS_FOLDER
value: '{{workflow.parameters.artifacts_folder}}'
- name: CIRCUITS_FOLDER
value: '{{workflow.parameters.circuits_folder}}'
- name: BASE_PATH
value: '{{workflow.parameters.volume}}'
- name: INPUT_DIR
Expand Down Expand Up @@ -172,6 +176,8 @@ spec:
value: '{{workflow.parameters.marketplace_api_url}}'
- name: ARTIFACTS_FOLDER
value: '{{workflow.parameters.artifacts_folder}}'
- name: CIRCUITS_FOLDER
value: '{{workflow.parameters.circuits_folder}}'
- name: BASE_PATH
value: '{{workflow.parameters.volume}}'
- name: OUTPUT_DIR
Expand Down
6 changes: 6 additions & 0 deletions argo-workflows-templates/nvm-compute-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ spec:
# value:
# - name: artifacts_folder
# value:
# - name: circuits_folder
# value:
# - name: input_dir
# value:
# - name: output_dir
Expand Down Expand Up @@ -95,6 +97,8 @@ spec:
value: '{{workflow.parameters.marketplace_api_url}}'
- name: ARTIFACTS_FOLDER
value: '{{workflow.parameters.artifacts_folder}}'
- name: CIRCUITS_FOLDER
value: '{{workflow.parameters.circuits_folder}}'
- name: BASE_PATH
value: '{{workflow.parameters.volume}}'
- name: INPUT_DIR
Expand Down Expand Up @@ -172,6 +176,8 @@ spec:
value: '{{workflow.parameters.marketplace_api_url}}'
- name: ARTIFACTS_FOLDER
value: '{{workflow.parameters.artifacts_folder}}'
- name: CIRCUITS_FOLDER
value: '{{workflow.parameters.circuits_folder}}'
- name: BASE_PATH
value: '{{workflow.parameters.volume}}'
- name: OUTPUT_DIR
Expand Down
6 changes: 6 additions & 0 deletions argo-workflows-templates/nvm-fl-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ spec:
# value:
# - name: artifacts_folder
# value:
# - name: circuits_folder
# value:
# - name: input_dir
# value:
# - name: output_dir
Expand Down Expand Up @@ -116,6 +118,8 @@ spec:
value: '{{workflow.parameters.marketplace_api_url}}'
- name: ARTIFACTS_FOLDER
value: '{{workflow.parameters.artifacts_folder}}'
- name: CIRCUITS_FOLDER
value: '{{workflow.parameters.circuits_folder}}'
- name: BASE_PATH
value: '{{workflow.parameters.volume}}'
- name: INPUT_DIR
Expand Down Expand Up @@ -193,6 +197,8 @@ spec:
value: '{{workflow.parameters.marketplace_api_url}}'
- name: ARTIFACTS_FOLDER
value: '{{workflow.parameters.artifacts_folder}}'
- name: CIRCUITS_FOLDER
value: '{{workflow.parameters.circuits_folder}}'
- name: BASE_PATH
value: '{{workflow.parameters.volume}}'
- name: OUTPUT_DIR
Expand Down
1 change: 1 addition & 0 deletions config/from-env.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const keys = [
'ESTUARY_ENDPOINT',
'ENABLE_PROVENANCE',
'ARTIFACTS_FOLDER',
'CIRCUITS_FOLDER',
'ENABLE_COMPUTE',
'ARGO_HOST',
'ARGO_NAMESPACE',
Expand Down
1 change: 1 addition & 0 deletions config/nevermined.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const configBase = {
neverminedNodeAddress:
process.env['NODE_ADDRESS'] || '0x068ed00cf0441e4829d9784fcbe7b9e26d4bd8d0',
artifactsFolder: process.env['ARTIFACTS_FOLDER'] || './artifacts',
circuitsFolder: process.env['CIRCUITS_FOLDER'] || './circuits',
marketplaceAuthToken: process.env['MARKETPLACE_AUTH_TOKEN'] || 'bogus',
graphHttpUri: nograph
? undefined
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"@nestjs/swagger": "^5.2.0",
"@nestjs/typeorm": "^8.0.3",
"@nevermined-io/argo-workflows-api": "^0.1.3",
"@nevermined-io/nevermined-sdk-dtp": "0.3.0-rc14",
"@nevermined-io/nevermined-sdk-js": "1.0.0-rc17",
"@nevermined-io/nevermined-sdk-dtp": "0.3.0-rc15",
"@nevermined-io/nevermined-sdk-js": "1.0.0-rc18",
"@nevermined-io/passport-nevermined": "^0.1.1",
"@sideway/address": "^4.1.3",
"@sideway/formula": "^3.0.0",
Expand Down
4 changes: 4 additions & 0 deletions src/compute/compute.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ export class ComputeService {
name: 'artifacts_folder',
value: '/artifacts',
},
{
name: 'circuits_folder',
value: '/circuits',
},
{
name: 'input_dir',
value: 'inputs',
Expand Down
1 change: 1 addition & 0 deletions src/info/dto/get-info.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export class GetInfoDto {
'keeper-url': string
'provenance-enabled': boolean
'artifacts-folder': string
'circuits-folder': string
contracts: any
'external-contracts': any
'keeper-version': string
Expand Down
2 changes: 2 additions & 0 deletions src/info/info.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export class InfoController {
const baby = this.config.getProviderBabyjub()
const provenanceEnabled = this.config.get<boolean>('ENABLE_PROVENANCE')
const artifactDir = this.config.get<string>('ARTIFACTS_FOLDER')
const circuitDir = this.config.get<string>('CIRCUITS_FOLDER')

const providerURL = new URL(this.nvmService.web3ProviderUri())

Expand All @@ -60,6 +61,7 @@ export class InfoController {
'keeper-url': `${providerURL.protocol}//${providerURL.host}`,
'provenance-enabled': provenanceEnabled,
'artifacts-folder': artifactDir,
'circuits-folder': circuitDir,
contracts: [],
'external-contracts': [],
'keeper-version': await contractHandler.getVersion('DIDRegistry', artifactDir),
Expand Down
2 changes: 2 additions & 0 deletions src/shared/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const DOTENV_SCHEMA = Joi.object({
AWS_S3_BUCKET_NAME: Joi.string(),
ENABLE_PROVENANCE: Joi.boolean().default(true),
ARTIFACTS_FOLDER: Joi.string().default('./artifacts'),
CIRCUITS_FOLDER: Joi.string().default('./circuits'),
ENABLE_COMPUTE: Joi.boolean().default(false),
ARGO_HOST: Joi.string().default('http:localhost:2746/'),
ARGO_NAMESPACE: Joi.string().default('argo'),
Expand Down Expand Up @@ -97,6 +98,7 @@ type DotenvSchemaKeys =
| 'AWS_S3_BUCKET_NAME'
| 'ENABLE_PROVENANCE'
| 'ARTIFACTS_FOLDER'
| 'CIRCUITS_FOLDER'
| 'ENABLE_COMPUTE'
| 'ARGO_HOST'
| 'ARGO_NAMESPACE'
Expand Down
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1194,23 +1194,23 @@
dependencies:
axios "^0.21.1"

"@nevermined-io/[email protected]rc14":
version "0.3.0-rc14"
resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-dtp/-/nevermined-sdk-dtp-0.3.0-rc14.tgz#dd977de5942da638c2310134b253e4767ab52a76"
integrity sha512-5GOxkBhpQ3LNc9hI5rRMd2BmfownbJuraNvQHgQPw2PWR4iBvZNXU/lJA9qmpeDyRFdLvSclW/Tc72bvqUgQjA==
"@nevermined-io/[email protected]rc15":
version "0.3.0-rc15"
resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-dtp/-/nevermined-sdk-dtp-0.3.0-rc15.tgz#483d20724f4d2323b49ecbae695e51d101fc256f"
integrity sha512-whmzhDDisOpinfMQE55cVlG1LSKPZf6tRjPhHx459/HCITdIEszpRWfqY45LUO3KhHc3yCp2sa0DqGfTABJyeQ==
dependencies:
"@nevermined-io/nevermined-sdk-js" "1.0.0-rc17"
"@nevermined-io/nevermined-sdk-js" "1.0.0-rc18"
circomlibjs "^0.1.1"
eciesjs "^0.3.15"
ffjavascript "^0.2.55"
node-rsa "^1.1.1"
snarkjs "^0.4.26"
web3-utils "^1.7.4"

"@nevermined-io/[email protected]rc17":
version "1.0.0-rc17"
resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-js/-/nevermined-sdk-js-1.0.0-rc17.tgz#95350f0cf247fd4a59a9294c28f92d9d0b4219a0"
integrity sha512-AP1VHxXnbaScYFRUUYS1eYyMpJbIIRTWKZdkq6LHXBgEGoZdleYCwuPBG8iaAyM2GN133drKPVYEbJFIuZcAmQ==
"@nevermined-io/[email protected]rc18":
version "1.0.0-rc18"
resolved "https://registry.yarnpkg.com/@nevermined-io/nevermined-sdk-js/-/nevermined-sdk-js-1.0.0-rc18.tgz#967431bb68f3845634a214bc245b5c39f9d4adb5"
integrity sha512-cPKyjK+tfQCpnK3rJUk50U/qPeyEL+E0A40WcYLj5l274TAA9gM01Repnp4MuBJbVEXiF/nJpufZigH2jvi+CQ==
dependencies:
"@nevermined-io/subgraphs" "0.5.0-rc1"
assert "^2.0.0"
Expand Down

0 comments on commit 6f584dd

Please sign in to comment.