-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds OpenGSN docker setup and readme.
- Loading branch information
1 parent
608e03c
commit 950cfa2
Showing
3 changed files
with
115 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Building from the CI image (Circle CI) | ||
FROM cimg/node:16.20.1 | ||
|
||
WORKDIR /app | ||
|
||
RUN git clone --depth 1 --branch v3.0.0-beta.10 \ | ||
https://github.com/opengsn/gsn.git \ | ||
/app | ||
|
||
# Build the deps, compile the contracts etc. | ||
RUN yarn create-all-deps && \ | ||
yarn && \ | ||
yarn preprocess | ||
|
||
# Build the relay server. | ||
RUN cd packages/relay && \ | ||
yarn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# OpenGSN v3 setup ⛽️ | ||
|
||
The `/gsn` folder within the tt-white-contracts repo contains: | ||
|
||
- `deploy` | ||
- `relay` | ||
|
||
It also contains a `Dockerfile` and `compose.yml` file. | ||
|
||
Read on for the description... | ||
|
||
## Docker files | ||
|
||
`Dockerfile` contains the minimal setup to pull and build the OpenGSN repo. More specifically it: | ||
|
||
- Pulls all the deps | ||
- Compiles the contracts | ||
- Compiles the relay server typescript into the js file ready to run | ||
|
||
`compose.yml` is the `docker compose` main file. | ||
|
||
Running `docker compose up` will bring up **just** the relay server - see "Replay" section below. | ||
|
||
Running `docker run gsn_deploy` will deploy the OpenGSN contracts - see "Deploy" section below. | ||
|
||
## Deploy - dev only | ||
|
||
`deploy/config` holds the config for the deployment of the OpenGSN contracts - specifically: | ||
- `RelayHub` | ||
- `StakeManager` | ||
- `Forwarder` | ||
- `Penalizer` | ||
- `RelayRegistrar` | ||
|
||
Note: This should only be needed on a local chain... we _should_ be using the deployed contracts that exist on chain already. | ||
|
||
See: | ||
- Mainnet network: https://docs.opengsn.org/networks/polygon/polygon.html | ||
- Mumbai network: https://docs.opengsn.org/networks/polygon/mumbai.html | ||
|
||
## Relay | ||
|
||
`relay` holds the relay server's config / data. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
version: "3.8" | ||
|
||
services: | ||
gsn_deploy: | ||
image: ts-opengsn | ||
profiles: ["deploy"] | ||
build: | ||
context: ./ | ||
working_dir: /app/packages/deployer | ||
command: ["yarn", "deploy", "--network", "dev"] | ||
networks: | ||
- eth_network | ||
volumes: | ||
- type: bind | ||
source: ./deploy/config/deploy.ts | ||
target: /app/packages/deployer/deploy/deploy.ts | ||
- type: bind | ||
source: ./deploy/config/hardhat.config.ts | ||
target: /app/packages/deployer/hardhat.config.ts | ||
- type: bind | ||
source: ./deploy/config/deployment-config.ts | ||
target: /app/packages/deployer/deployments/deployment-config.ts | ||
# Deployments held in memory. | ||
- type: tmpfs | ||
target: /app/packages/deployer/deployments/networks | ||
|
||
gsn_relay: | ||
image: ts-opengsn | ||
build: | ||
context: ./ | ||
working_dir: /app/packages/relay | ||
stop_grace_period: 3s | ||
command: [ | ||
"node", | ||
"./dist/runServer.js", | ||
"--config", | ||
"/app/packages/relay/gsn-relay-config.json" | ||
] | ||
networks: | ||
- eth_network | ||
ports: | ||
- "8090:8090" | ||
volumes: | ||
- type: bind | ||
source: ./relay/config/gsn-relay-config.json | ||
target: /app/packages/relay/gsn-relay-config.json | ||
# Relay data held in memory. | ||
- type: bind | ||
source: ./relay/data | ||
target: /gsn-data | ||
|
||
networks: | ||
eth_network: | ||
name: eth_network | ||
external: true |