Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions .github/workflows/reusable-subgraph-deployer-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,26 @@ on:
type: string
secrets:
docker-username:
description: 'Docker registry username (required unless `dry-run: true`)'
required: false
description: 'Docker Hub username (used to log in to Docker Hub and to push the image)'
required: true
docker-password:
description: 'Docker registry password or PAT (required unless `dry-run: true`)'
required: false
description: 'Docker Hub password or PAT (used to log in to Docker Hub and to push the image)'
required: true

jobs:
docker-publish:
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@docker-build-v2.3.1
uses: iExecBlockchainComputing/github-actions-workflows/.github/workflows/docker-build.yml@docker-build-v3.5.1
with:
image-name: 'iexechub/dataprotector-subgraph-deployer'
registry: 'docker.io'
dockerfile: 'packages/subgraph/deployer.Dockerfile'
context: 'packages/subgraph'
security-scan: true
security-report: 'sarif'
context: '.'
security-scan: false
hadolint: true
push: ${{ !inputs.dry-run }}
image-tag: ${{ inputs.tag }}
secrets:
dockerhub-username: ${{ secrets.docker-username }}
dockerhub-password: ${{ secrets.docker-password }}
username: ${{ secrets.docker-username }}
password: ${{ secrets.docker-password }}
Comment thread
Christophe-iExec marked this conversation as resolved.
3 changes: 3 additions & 0 deletions .github/workflows/subgraph-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ jobs:
uses: ./.github/workflows/reusable-subgraph-deployer-docker.yml
with:
dry-run: true
secrets:
docker-username: ${{ secrets.DOCKERHUB_USERNAME }}
docker-password: ${{ secrets.DOCKERHUB_PAT }}
70 changes: 0 additions & 70 deletions .github/workflows/subgraph-deploy.yml

This file was deleted.

23 changes: 0 additions & 23 deletions packages/subgraph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,28 +45,6 @@ To deploy this subgraph on Thegraph network:
npm run deploy-studio
```

### Self-Hosted Subgraph Deployment Process

We use CI/CD pipelines to deploy our subgraphs to hosted environments.
For zero-downtime updates to the production subgraph:

1. **Index the New Version (Temporary Deployment)**

- Trigger deployment with target: `subgraph-deploy-tmp`
- This creates a separate instance for indexing

2. **Wait for Indexing Completion**

- Monitor the temporary deployment until it's fully synced

3. **Deploy to Production (Zero Downtime)**

- Once temporary deployment is ready, trigger: `subgraph-deploy-prod`
- This swaps the deployments with no service interruption

4. **Verify the Deployment**
- Access the production subgraph at: <https://thegraph.iex.ec/subgraphs/name/bellecour/dataprotector-v2/graphql>

## Query Examples

### Sample GraphQL Query
Expand Down Expand Up @@ -124,4 +102,3 @@ Our repository uses automated workflows to build, test, and deploy the subgraph:

- **ABI Validation**: Ensures contract ABIs are up-to-date across all packages
- **Testing**: Unit and integration tests validate subgraph functionality (TODO)
- **Zero-Downtime Deployment**: Staged deployment process ensures continuous service availability
2 changes: 1 addition & 1 deletion packages/subgraph/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const envSchema = z.object({
NETWORK_NAME: z
.string()
.min(1, 'NETWORK_NAME is required')
.default('bellecour'),
.default('arbitrum-one'),

GRAPHNODE_URL: z
.string()
Expand Down
27 changes: 16 additions & 11 deletions packages/subgraph/deployer.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
FROM node:20

RUN mkdir /app

COPY . /app

WORKDIR /app/packages/subgraph

RUN npm ci

ENTRYPOINT [ "npm", "run", "all" ]
FROM node:22-slim

# Pull latest Debian security patches and upgrade the bundled npm,
# whose vendored dependencies (node-tar) carry known CVEs
RUN apt-get update \
&& apt-get upgrade -y \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g npm@latest

COPY . /app

WORKDIR /app/packages/subgraph

RUN npm ci

ENTRYPOINT [ "npm", "run", "all" ]
22 changes: 0 additions & 22 deletions packages/subgraph/networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,5 @@
"address": "0xe4f319aDf2f3DbFD3270f35CEc90575dC858A0dA",
"startBlock": 363897845
}
},
"bellecour": {
"DataProtector": {
"address": "0x3a4Ab33F3D605e75b6D00A32A0Fa55C3628F6A59",
"startBlock": 25455501
},
"DatasetRegistry": {
"address": "0x799DAa22654128d0C64d5b79eac9283008158730",
"startBlock": 25455501
},
"DataProtectorSharing": {
"address": "0x1390c3c6a545198809F1C7c5Dd2600ef74D60925",
"startBlock": 28566236
},
"AppRegistry": {
"address": "0xB1C52075b276f87b1834919167312221d50c9D16",
"startBlock": 28566236
},
"AddOnlyAppWhitelistRegistry": {
"address": "0x498D324F711b8998Be81818742e268dEE30347c6",
"startBlock": 28566234
}
}
}
Loading
Loading