Migrating from GitHub to IPFS
Migrating from GitHub to IPFS
In order to make deploying projects easier on the Managed Service, we are deprecating GitHub deployments in favour of IPFS.
Using IPFS provides a better experience for developers in a few ways:
- Unlike with GitHub deployments, projects are built locally on your machine. This means that you can have full control over the environment. Resolving any issues with version compatibility such as node.js version or other dependencies is much faster and easier.
- You can share your projects CID and ensure that everyone will be able to run the same project with the same results.
- It’s decentralised, so that you don’t have to rely on a centralised party like GitHub to store your code.
- And on top of this, you can deploy the same project to the SubQuery Network!
How to prepare your project?
Update your project's dependencies.
- Update
@subql/cli
to the latest version: you can do this by runningyarn add -D @subql/cli@latest
ornpm i -dev @subql/cli@latest
- We also recommend updating other dependencies at this time, you might want to copy them from the latest example projects (e.g. Ethereum, Polkadot, Cosmos)
- Pay attention to this issue: 926
- Update
package.json
: Update the build command tosubql build
. It should look like this.src/index.ts
: For Substrate based projects, if updating from@polkadot/api
v6 (or earlier), update yoursrc/index.ts
to include this line.project.ts
:Make sure your project is using manifest version 1.0.0. You can check this by looking at the
specVersion
field inproject.ts
. If it is below 1.0.0, then runsubql migrate
and follow the migration steps to upgrade.Check that the
datasources: mapping: file:
references your code entrypoint correctly. Usually this is./dist/index.js
If you're using a datasource processor (any
processor:
in theproject.ts
) we need to ensure that it gets bundled during build and publish. To do so please update to the latest version of the package that now includes a bundled version. You can do this by adding exports to yourpackage.json
.
... "exports": { "processorName": "./node_modules/path/to/processor.js" // "frontierEvm": "./node_modules/@subql/frontier-evm-processor/dist/index.js" // "acalaEvm": "./node_modules/@subql/acala-evm-processor/dist/index.js", // "ethermintEVM": "./node_modules/@subql/ethermint-evm-processor/dist/index.js" // "chaintypes": "./src/chaintypes.ts" // chain types if required }
We need to update the reference to the bundle in your
project.ts
. To do this you can update any processor file paths tofile: ./node_modules/@subql/<processor-name>/dist/bundle.js
and replace<processor-name>
with the processor you are using. If you are using@subql/datasource-processors
this package is now deprecated, you can find the relevant replacement from the new datasource-processors repository.- If your project uses js/ts based custom Substrate Chain Types you will need to repeat the steps above but with the reference to your chain types.
docker-compose.yaml
: Update it to the latest docker compose version and add this directory to your repo. To test it we recommend running your project locally.
Warning
Please now rebuild and run your project locally to test these changes before proceeding using yarn
, yarn codegen
, yarn build
, and then yarn start:docker
.
Your project should now be ready to deploy via IPFS to SubQuery Managed Service or the SubQuery network. You can follow the guide here to deploy to IPFS and then publish to the Managed Service.