Skip to main content

Migrating from GitHub to IPFS

SubQuery TeamAbout 2 min

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?

  1. Update your project's dependencies.

  2. package.json: Update the build command to subql build. It should look like thisopen in new window.

  3. src/index.ts: For Substrate based projects, if updating from @polkadot/api v6 (or earlier), update your src/index.ts to include this lineopen in new window.

  4. project.ts:

    • Make sure your project is using manifest version 1.0.0. You can check this by looking at the specVersion field in project.ts. If it is below 1.0.0, then run subql 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 the project.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 your package.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 to file: ./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 repositoryopen in new window.

    • 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.
  5. docker-compose.yaml: Update it to the latest docker compose versionopen in new window and add this directoryopen in new window 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.