rollups-graphql

command module
v0.0.0-...-34dd292 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 10, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

README

Cartesi's GraphQL

CI Go Report Card

Technical Vision Forum Discussion

Internal docs

Description

Exposes the GraphQL reader API in the endpoint http://127.0.0.1:8080/graphql. You may access this address to use the GraphQL interactive playground in your web browser. You can also make POST requests directly to the GraphQL API. For instance, the command below gets the number of inputs.

QUERY='query { inputs { totalCount } }'; \
curl \
    -X POST \
    -H 'Content-Type: application/json' \
    -d "{\"query\": \"$QUERY\"}" \
    http://127.0.0.1:8080/graphql

Connecting to Postgres locally

Start a Postgres instance locally using docker compose.

make up-db-raw
export POSTGRES_GRAPHQL_DB_URL="postgres://postgres:password@127.0.0.1:5432/hlgraphql?sslmode=disable"
export POSTGRES_NODE_DB_URL="postgres://postgres:password@localhost:5432/rollupsdb?sslmode=disable"
go run . --http-address=0.0.0.0

Running with Node V2

Build Node V2 and then start it.

Create the rollups graphql database:

docker exec -i postgres psql -U postgres -d hlgraphql < ./postgres/raw/hlgraphql.sql

Compile:

go build -o cartesi-rollups-graphql

Run the rollups graphql:

export POSTGRES_GRAPHQL_DB_URL="postgres://postgres:password@localhost:5432/hlgraphql?sslmode=disable"
export POSTGRES_NODE_DB_URL="postgres://postgres:password@localhost:5432/rollupsdb?sslmode=disable"
./cartesi-rollups-graphql

Environment Variables

The following environment variables are used for PostgreSQL configuration:

  • POSTGRES_GRAPHQL_DB_URL: URL for the PostgreSQL database used by GraphQL.
  • POSTGRES_NODE_DB_URL: URL for the PostgreSQL database used by the node.
  • DB_MAX_OPEN_CONNS: Maximum number of open connections to the database (default: 25).
  • DB_MAX_IDLE_CONNS: Maximum number of idle connections in the pool (default: 10).
  • DB_CONN_MAX_LIFETIME: Maximum amount of time a connection may be reused (default: 1800 seconds).
  • DB_CONN_MAX_IDLE_TIME: Maximum amount of time a connection may be idle (default: 300 seconds).

Contributors

Contributors

Made with contributors-img.

Release

New releases are created using the Changesets library, which is already set up in this project.

How to do a standard release
Manual steps
  1. Workflow permissions:

    • Ensure this repository has "Read and write permissions" enabled under the "Workflow permissions" section in the repository settings.
  2. Create a changeset when you're ready to release a new version:

    npx changeset
    
    • Select the type of change (patch, minor, major)
    • Write a short description of the change
    • Make sure a .md file is automatically created inside the .changeset/ directory
  3. 'push' your changes to remote repo

    No github action is trigered until here.

  4. New Pull Request

    Create a pull request from your branch into main branch.

Automatic procedures

After merges/commits into main branch in a changeset state (with an md file in .changeset directory):

  1. Release Pull Request workflow job is automatically triggered
  2. Changesets will create a release pull request. In this PR some files will be updated by changeset bot to bump the version number
  3. Once you merge this PR, Release Pull Request workflow job will run again, and this time a new git tag will be created and pushed:
    • package.json version will be updated
    • A GitHub tag will be created
    • CHANGELOG.md will be updated
How to pre release

See the docs.

Documentation

Overview

This package contains the main function that executes the cartesi-rollups-graphql command.

Directories

Path Synopsis
(c) Cartesi and individual authors (see AUTHORS) SPDX-License-Identifier: Apache-2.0 (see LICENSE)
(c) Cartesi and individual authors (see AUTHORS) SPDX-License-Identifier: Apache-2.0 (see LICENSE)
pkg
bootstrap
This package contains the nonodo run function.
This package contains the nonodo run function.
contracts
This package contains the contract bindings for Cartesi Rollups.
This package contains the contract bindings for Cartesi Rollups.
contracts/generate
This binary generates the Go bindings for the Cartesi Rollups contracts.
This binary generates the Go bindings for the Cartesi Rollups contracts.
model
The nonodo model uses a shared-memory paradigm to synchronize between threads.
The nonodo model uses a shared-memory paradigm to synchronize between threads.
reader
This package is responsible for serving the GraphQL reader API.
This package is responsible for serving the GraphQL reader API.
reader/model
This module is a wrapper for the nonodo model that converts the internal types to GraphQL-compatible types.
This module is a wrapper for the nonodo model that converts the internal types to GraphQL-compatible types.
readerclient
This package contains a client for the GraphQL reader API for testing purposes.
This package contains a client for the GraphQL reader API for testing purposes.
supervisor
This package contains a simple supervisor for goroutine workers.
This package contains a simple supervisor for goroutine workers.
postgres
raw

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL