Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme after architecture change #247

Merged
merged 10 commits into from
Jul 13, 2023
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
45 changes: 0 additions & 45 deletions Dockerfile

This file was deleted.

54 changes: 29 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<p align="center"><img src=".github/images/MULTIX_LOGO_FULL_BLUE_1200px.png" width=500 /></p>

# Multix

### an interface to easily manage complex multisigs.

### Play with Multix on https://multix.chainsafe.io/
###https://multix.chainsafe.io

This repo contains the code to run an indexer see `./packages/squid` and a front-end, see `./packages/ui`.
This repo contains the code to run an indexer see `./squid` and a front-end, see `./packages/ui`.

## Running the project

You can run most of the project locally, except for the database that will run in a docker.

### Environment variables

You need to set up the `packages/squid/.env` file to tell the indexer what network to index. The following environment variables are expected. You can copy `packages/squid/.env.example` into `packages/squid/.env` as follow:
You need to set up the `squid/.env` file to tell the indexer what network to index. The following environment variables are expected. You can copy `packages/squid/.env.example` into `packages/squid/.env` as follow:

```bash
DB_PORT=5432
Expand All @@ -24,39 +26,41 @@ BLOCK_START=3510000 # this is the starging block of the indexer
PREFIX=42 # the ss58 prefix for the chain
RPC_WS="wss://rococo-rpc.polkadot.io" # a WS endpoint to connect to the blockchain
ARCHIVE_NAME="rococo" # the archive name from subsquid archives
CHAIN_ID='rococo' # the name that will prefix most ids in the indexer's DB
```

### Running the project locally

```bash
# install all dependancies
yarn;
#### Running the indexer locally

# install and launch the db in a docker
yarn docker:db

# build the indexer, migrate the db and run the indexer
# this will block your current terminal window
yarn squid:start
Install and launch the indexer and its DB. This will block the terminal

# in a separate terminal window, run the graphql server
yarn squid:start:graphql-server;
```bash
cd squid;
npm install;
docker compose up db -d;
npm run codegen;
npm run build;
npm run db:migrate;
npm run start:indexer # this will start the indexer using the envirnoment variables set in your .env
# alternatively, you can run with predefined values, see in /squid/assets/envs/, e.g here with polkadot
node -r dotenv/config lib/main dotenv_config_path=assets/envs/.env.polkadot
```

### Running the project all in docker

You can allso run the whole project in docker in you want.
In the squid directory but another terminal window, run the graphql server

```bash
# Install all dependencies
yarn
npm run start:graphql-server
```

# install and launch the db, the indexer and the graphql server in a docker
yarn docker:start:all
#### Running the front-end (user interface) locally

# you can see the logs with
docker compose logs
From the repostiory root

# you can stop all the docker instances with
yarn docker:down
```bash
# install all dependancies
yarn;

# install and launch the db in a docker
yarn ui:start
```
29 changes: 0 additions & 29 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,6 @@
version: '3'

services:
graphql-server:
container_name: graphql-server
build:
context: .
target: graphql-server
env_file: squid/.env
environment:
DB_HOST: db
ports:
- '4350:4350'
mem_limit: 300m
mem_reservation: 100m
depends_on:
- db

squid-indexer:
container_name: squid-indexer
build:
context: .
target: squid-indexer
env_file: squid/.env
environment:
DB_HOST: db
PROCESSOR_PROMETHEUS_PORT: 3000
ports:
- '3000:3000'
depends_on:
- db

db:
container_name: subsquid_db
image: postgres:14
Expand Down
6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,8 @@
],
"license": "MIT",
"scripts": {
"docker:start:all": "yarn docker:start:squid && yarn ui:start",
"docker:start:squid": "yarn docker:db && yarn squid:build && yarn squid:codegen && yarn squid:migrate && yarn docker:up",
"docker:build-squid-indexer-image": "docker build . --target squid-indexer -t squid-indexer",
"doker:build-graphql-server-image": "docker build . --target graphql-server -t graphql-server",
"docker:db": "docker compose up -d db",
"docker:down": "docker compose down",
"docker:up": "docker compose up -d squid-indexer graphql-server",
"build:images": "yarn docker:build-squid-indexer-image && yarn doker:build-graphql-server-image",
"build": "yarn workspaces foreach run build",
"lint": "yarn workspaces foreach run lint",
"lint:fix": "yarn workspaces foreach run lint:fix",
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/contexts/NetworkContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const NetworkContextProvider = ({ children }: NetworkContextProps) => {
return
}

selectNetwork('rococo')
selectNetwork('kusama')
}
}, [searchParams, selectNetwork, selectedNetwork])

Expand Down
4 changes: 2 additions & 2 deletions squid/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Multix-squid

A [squid](https://subsquid.io) project to support the Multix UI.
It accumulates [rococo](https://rococo.network) accounts, multisigs and proxy relations.
It accumulates the chain's accounts, multisigs and proxy relations.

## Prerequisites

Expand Down Expand Up @@ -253,7 +253,7 @@ PREFIX=42 # the ss58 prefix for the chain
RPC_WS="wss://rococo-rpc.polkadot.io" # a WS endpoint to connect to a blockchain
ARCHIVE_NAME="rococo" # optional - must be empty or set to the archive name if part of the @subsquid/archive-registry'
ARCHIVE_URL="http://localhost:4444/graphql" # optional - must be set if ARCHIVE_NAME is empty - the subsquid archive url. Consider submitting a PR to subsquid/archive-registry github repo to extend the registry.
CHAIN_ID='rococo' # a unique chain id for the database prefix
CHAIN_ID='rococo' # a unique chain id for the database prefix
```

## Differences from polkadot.js
Expand Down
Loading