diff --git a/.github/images/MULTIX_LOGO_FULL_BLUE_1200px.png b/.github/images/MULTIX_LOGO_FULL_BLUE_1200px.png new file mode 100644 index 00000000..592006f0 Binary files /dev/null and b/.github/images/MULTIX_LOGO_FULL_BLUE_1200px.png differ diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 16bdc534..00000000 --- a/Dockerfile +++ /dev/null @@ -1,45 +0,0 @@ -# node alpine image -FROM node:19-alpine AS node - -# node with gyp for complex executions -FROM node AS node-with-gyp -RUN apk add g++ make python3 - -# build the application to generate a distributable package -FROM node-with-gyp AS builder -WORKDIR /multix - -ADD .yarn/plugins .yarn/plugins -ADD package.json . -ADD yarn.lock . -ADD .yarnrc.yml . - -ADD packages/squid/package.json ./packages/squid/ -ADD packages/squid/tsconfig.json ./packages/squid/ -ADD packages/squid/src ./packages/squid/src -ADD packages/squid/schema.graphql ./packages/squid - -RUN corepack enable -RUN yarn workspaces focus multix-squid -RUN yarn workspace multix-squid codegen -RUN yarn workspace multix-squid build - -# squid app -FROM node AS squid - -WORKDIR /multix - -COPY --from=builder multix/packages/squid/package.json . -COPY --from=builder multix/node_modules node_modules -COPY --from=builder multix/packages/squid/lib lib -COPY --from=builder multix/packages/squid/schema.graphql . - -ADD packages/squid/db db - -# indexer image that will be published -FROM squid AS squid-indexer -CMD yarn start:indexer - -# graphql server that will be published -FROM squid AS graphql-server -CMD yarn start:graphql-server diff --git a/README.md b/README.md index 548c6b09..0defd0b5 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,12 @@ +

+ # 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 @@ -12,7 +14,7 @@ You can run most of the project locally, except for the database that will run i ### 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 @@ -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 ``` diff --git a/docker-compose.yml b/docker-compose.yml index 360e477c..ec4fe468 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/package.json b/package.json index d2b0ded3..07cb65bc 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/ui/src/contexts/NetworkContext.tsx b/packages/ui/src/contexts/NetworkContext.tsx index 236374e8..9893d2f6 100644 --- a/packages/ui/src/contexts/NetworkContext.tsx +++ b/packages/ui/src/contexts/NetworkContext.tsx @@ -60,7 +60,7 @@ const NetworkContextProvider = ({ children }: NetworkContextProps) => { return } - selectNetwork('rococo') + selectNetwork('kusama') } }, [searchParams, selectNetwork, selectedNetwork]) diff --git a/squid/README.md b/squid/README.md index a79fe9ac..806d304d 100644 --- a/squid/README.md +++ b/squid/README.md @@ -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 @@ -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