Pubblica il tuo progetto SubQuery

... 2022-8-5 About 5 min

# Pubblica il tuo progetto SubQuery

# Vantaggi di ospitare il tuo progetto con SubQuery

  • Eseguiremo i tuoi progetti SubQuery per te in un servizio pubblico ad alte prestazioni, scalabile e gestito
  • Questo servizio viene fornito alla comunità gratuitamente!
  • Puoi rendere i tuoi progetti pubblici in modo che siano elencati nel SubQuery Explorer (opens new window) e chiunque nel mondo possa vederli
  • Siamo integrati con GitHub, quindi chiunque nelle tue organizzazioni GitHub sarà in grado di visualizzare i progetti condivisi dell'organizzazione

# Create your first project in SubQuery Projects

# Project Codebase Hosting

There are two ways you can host your SubQuery project's codebase before publishing.

GitHub: Your project's codebase must be in a public GitHub repository

IPFS: Your project's codebase can be stored in IPFS, you can follow our IPFS hosting guide to see how to first publish to IPFS

# Login to SubQuery Projects

Before starting, please make sure that your SubQuery project codebase is online in a public GitHub repository or on IPFS. The schema.graphql file must be in the root of your directory.

To create your first project, head to project.subquery.network (opens new window). You'll need to authenticate with your GitHub account to login.

On first login, you will be asked to authorize SubQuery. We only need your email address to identify your account, and we don't use any other data from your GitHub account for any other reasons. In this step, you can also request or grant access to your GitHub Organization account so you can post SubQuery projects under your GitHub Organization instead of your personal account.

Revoke approval from a GitHub account

SubQuery Projects is where you manage all your hosted projects uploaded to the SubQuery platform. You can create, delete, and even upgrade projects all from this application.

Projects Login

If you have a GitHub Organization accounts connected, you can use the switcher on the header to change between your personal account and your GitHub Organization account. Projects created in a GitHub Organization account are shared between members in that GitHub Organization. To connect your GitHub Organization account, you can follow the steps here.

Switch between GitHub accounts

# Create your First Project

There are two methods to create a project in the SubQuery Managed Service, you can use the UI or directly via the subql cli tool.

# Using the UI

Let's start by clicking on "Create Project". You'll be taken to the New Project form. Please enter the following (you can change this in the future):

  • Account GitHub: Se hai più di un account GitHub, seleziona con quale account sarà creato questo progetto. I progetti creati in un account dell'organizzazione GitHub sono condivisi tra i membri di quell'organizzazione.
  • Project Name
  • Sottotitolo
  • Descrizione
  • GitHub Repository URL: Questo deve essere un URL GitHub valido per un repository pubblico che ha il tuo progetto SubQuery. Il file schema.graphql deve essere nella root della tua directory (imparare di più sulla struttura delle directory).
  • Database: Premium customers can access dedicated databases to host production SubQuery projects from. If this interests you, you can contact sales@subquery.network to have this setting enabled.
  • Deployment Source: You can choose to have the project deployed from the GitHub repository or alternatively deployed from a IPFS CID, see our guide about hosting with IPFS.
  • Nascondi progetto: Se selezionato, questo nasconderà il progetto dall'esploratore pubblico di SubQuery. Tieni questo non selezionato se vuoi condividere la tua SubQuery con la comunità! Create your first Project

Create your project and you'll see it on your SubQuery Project's list. We're almost there! We just need to deploy a new version of it.

Created Project with no deployment

# Using the CLI

You can also use @subql/cli to publish your project to our managed service. This requires:

// Creating a project using the CLI
$ subql project:create-project

// OR using non-interactive, it will prompt you if the required fields are missing
$ subql project:create-project
    --apiVersion=apiVersion      Api version is default to 2
    --description=description    Enter description
    --gitRepo=gitRepo            Enter git repository
    --org=org                    Enter organization name
    --project_name=project_name  Enter project name
1
2
3
4
5
6
7
8
9
10

# Deploy your First Version

There are two methods to deploy a new version of your project to the SubQuery Managed Service, you can use the UI or directly via the subql cli tool.

# Using the UI

While creating a project will setup the display behaviour of the project, you must deploy a version of it before it becomes operational. Deploying a version triggers a new SubQuery indexing operation to start, and sets up the required query service to start accepting GraphQL requests. You can also deploy new versions to existing projects here.

With your new project, you'll see a Deploy New Version button. Click this, and fill in the required information about the deployment:

  • Branch: From GitHub, select the branch of the project that you want to deploy from
  • Commit Hash: From GitHub, select the specific commit of the version of your SubQuery project codebase that you want deployed
  • IPFS: If deploying from IPFS, paste you IPFS deployment CID (without the leading ipfs://)
  • Override Network and Dictionary Endpoints: You can override the endpoints in your project manifest here
  • Indexer Version: This is the version of SubQuery's node service that you want to run this SubQuery on. See @subql/node (opens new window)
  • Query Version: This is the version of SubQuery's query service that you want to run this SubQuery on. See @subql/query (opens new window)

Deploy your first Project

If deployed successfully, you'll see the indexer start working and report back progress on indexing the current chain. This process may take time until it reaches 100%.

# Using the CLI

You can also use @subql/cli to create a new deployment of your project to our managed service. This requires:

// Deploy using the CLI
$ suqbl deployment:deploy

// OR Deploy using non-interactive CLI
$ suqbl deployment:deploy
  --dict=dict                      Enter Dictionary Endpoint
  --endpoint=endpoint              Enter Network Endpoint
  --indexerVersion=indexerVersion  Enter indexer-version
  --ipfsCID=ipfsCID                Enter IPFS CID
  --org=org                        Enter Organization Name
  --project_name=project_name      Enter Project Name
  --queryVersion=queryVersion      Enter Query-version
  --type=type                      Enter deployment type e.g. primary or stage
1
2
3
4
5
6
7
8
9
10
11
12
13

# Passi successivi - Collegati al tuo progetto

Una volta che il tuo deployment è stato completato con successo e i nostri nodi hanno indicizzato i tuoi dati dalla catena, sarai in grado di connetterti al tuo progetto tramite l'endpoint GraphQL Query visualizzato.

Progetto distribuito e sincronizzato

In alternativa, puoi cliccare sui tre puntini accanto al titolo del tuo progetto e visualizzarlo su SubQuery Explorer. There you can use the in-browser playground to get started - read more about how to use our Explorer here.

Projects in SubQuery Explorer

# Aggiungere l'account dell'organizzazione GitHub ai progetti SubQuery

It is common to publish your SubQuery project under the name of your GitHub Organization account rather than your personal GitHub account. At any point your can change your currently selected account on SubQuery Projects (opens new window) using the account switcher.

Switch between GitHub accounts

If you can't see your GitHub Organization account listed in the switcher, the you may need to grant access to SubQuery for your GitHub Organization (or request it from an administrator). To do this, you first need to revoke permissions from your GitHub account to the SubQuery Application. To do this, login to your account settings in GitHub, go to Applications, and under the Authorized OAuth Apps tab, revoke SubQuery - you can follow the exact steps here (opens new window). Don't worry, this will not delete your SubQuery project and you will not lose any data.

Revoke access to GitHub account

Once you have revoked access, log out of SubQuery Projects (opens new window) and log back in again. You should be redirected to a page titled Authorize SubQuery where you can request or grant SubQuery access to your GitHub Organization account. If you don't have admin permissions, you must make a request for an adminstrator to enable this for you.

Revoke approval from a GitHub account

Once this request has been approved by your administrator (or if are able to grant it youself), you will see the correct GitHub Organization account in the account switcher.

Last update: August 5, 2022 10:08