Archived
Compare commits
177
Commits
v1.0.1-alpha
...
v1.0.18
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce7e5f2d82 | ||
|
|
4dda8e2a87 | ||
|
|
24ab259741 | ||
|
|
607575e4f4 | ||
|
|
86e245e272 | ||
|
|
d677e5f369 | ||
|
|
9991baa8d6 | ||
|
|
d033d4ff93 | ||
|
|
f02bbee3bf | ||
|
|
bdde1b2c9e | ||
|
|
96a83422e7 | ||
|
|
af03208da7 | ||
|
|
86e2407800 | ||
|
|
c01ff28b4f | ||
|
|
ec54258285 | ||
|
|
1f2ee33b42 | ||
|
|
a2b700727c | ||
|
|
fa8ba7f9ef | ||
|
|
dd0b8ae81f | ||
|
|
b5c7ad114c | ||
|
|
d0d29717e1 | ||
|
|
368091e125 | ||
|
|
27195fc977 | ||
|
|
91ad0f39e6 | ||
|
|
b47b2200ce | ||
|
|
2e291b3e4c | ||
|
|
629e484c30 | ||
|
|
3d7d23b68b | ||
|
|
c6c9e229d2 | ||
|
|
c77cc4e111 | ||
|
|
26c654f3ef | ||
|
|
b6a84db6a2 | ||
|
|
e7d31e78ad | ||
|
|
86b7e6957c | ||
|
|
7812490434 | ||
|
|
161cd37b9c | ||
|
|
e183e2a880 | ||
|
|
7bd8045d6e | ||
|
|
b2268a6518 | ||
|
|
dfef77f35f | ||
|
|
78cd4e2e3e | ||
|
|
dca9a36633 | ||
|
|
e799c9eaef | ||
|
|
42dac0e712 | ||
|
|
a44c063e5a | ||
|
|
6ad2684de3 | ||
|
|
5e7b51ee6a | ||
|
|
50103fcc9c | ||
|
|
edb7346f31 | ||
|
|
377d18d540 | ||
|
|
6ed90536cf | ||
|
|
7d00228ca2 | ||
|
|
8f9f23b1c4 | ||
|
|
429e04f81d | ||
|
|
7a9926b695 | ||
|
|
0372504f44 | ||
|
|
b29537ad7c | ||
|
|
1cf58c900e | ||
|
|
c6df9ae0c1 | ||
|
|
f1cd13d988 | ||
|
|
edc24e4fc8 | ||
|
|
533ed4ee9b | ||
|
|
ba5eecaada | ||
|
|
5f73a93f5f | ||
|
|
135295f0f9 | ||
|
|
5b4f935afd | ||
|
|
5a4220ff41 | ||
|
|
a60fb08c8a | ||
|
|
2b15eff104 | ||
|
|
fc3bcdef74 | ||
|
|
500c481d6b | ||
|
|
08d5c22f32 | ||
|
|
8fb71711bc | ||
|
|
32b4c00261 | ||
|
|
71425b93f6 | ||
|
|
b90e4ad6cd | ||
|
|
b13300ca81 | ||
|
|
6396de1ecf | ||
|
|
18a7e59a8a | ||
|
|
0a66b7e9d2 | ||
|
|
7edfa1bb29 | ||
|
|
8e184f509d | ||
|
|
5697a39640 | ||
|
|
df469786ca | ||
|
|
d315941f21 | ||
|
|
ae7a17cecd | ||
|
|
261b513d68 | ||
|
|
9278d09096 | ||
|
|
b8b83768d8 | ||
|
|
ddd2ea2724 | ||
|
|
787a5228ea | ||
|
|
2ea87a3a80 | ||
|
|
8669a822df | ||
|
|
738aa1907b | ||
|
|
4b1ca04620 | ||
|
|
48dc431704 | ||
|
|
2eee4d1fb2 | ||
|
|
8e5d0d6c58 | ||
|
|
9d9eb791d1 | ||
|
|
4494f2ca62 | ||
|
|
f04726f08d | ||
|
|
b4b1ec3df8 | ||
|
|
0435a71b5e | ||
|
|
c99687cc80 | ||
|
|
cd2735fa24 | ||
|
|
9b2a58e3bd | ||
|
|
dcefebc721 | ||
|
|
82755a27f2 | ||
|
|
318d70020e | ||
|
|
6e67a59251 | ||
|
|
92743d7390 | ||
|
|
731a9f2072 | ||
|
|
d77a42b36f | ||
|
|
af1aee09ff | ||
|
|
ff76cdad61 | ||
|
|
765db5937d | ||
|
|
68c6eaf0b4 | ||
|
|
073d94e288 | ||
|
|
ee1ecbd217 | ||
|
|
36f7d4ca26 | ||
|
|
fdb04d46b4 | ||
|
|
778550754d | ||
|
|
2ba3ffac84 | ||
|
|
db4899229d | ||
|
|
a5b1f6e107 | ||
|
|
c059745af9 | ||
|
|
1b0407ae3c | ||
|
|
47b7a47160 | ||
|
|
1b4b47e9a4 | ||
|
|
b10b6c19f9 | ||
|
|
b6f1fd029d | ||
|
|
be889d893a | ||
|
|
63378a5c7e | ||
|
|
3b031329b4 | ||
|
|
d51508b01d | ||
|
|
27c3efabe2 | ||
|
|
a7221ddc24 | ||
|
|
e7296c2ce3 | ||
|
|
2c2df6ebbd | ||
|
|
d138bb1a72 | ||
|
|
543afe1808 | ||
|
|
8f63328d60 | ||
|
|
efbc86bdea | ||
|
|
23b12cc8f1 | ||
|
|
717391d835 | ||
|
|
b8c244bbdc | ||
|
|
8a9c1fb781 | ||
|
|
5d482658a7 | ||
|
|
df0bf549a2 | ||
|
|
d96546a3c5 | ||
|
|
680f227967 | ||
|
|
c85b29c237 | ||
|
|
8d2788d1c1 | ||
|
|
46375082d6 | ||
|
|
faa6027772 | ||
|
|
d6e90c2dbd | ||
|
|
c2f6544f51 | ||
|
|
d0903a2780 | ||
|
|
32edd7aea7 | ||
|
|
bd9aaebe3d | ||
|
|
b538011a7b | ||
|
|
d87a2387e5 | ||
|
|
3308328524 | ||
|
|
c502aae162 | ||
|
|
43d59a9e28 | ||
|
|
28a3880fcf | ||
|
|
acb06feac4 | ||
|
|
f7e9cf4ba4 | ||
|
|
b94cfb4de8 | ||
|
|
ed4352911d | ||
|
|
e5c18ba77a | ||
|
|
5dda2303d3 | ||
|
|
1a5844af7a | ||
|
|
5a69bf471b | ||
|
|
7a5834a021 | ||
|
|
70b7476318 | ||
|
|
8b12dec75b |
@@ -1,214 +1,105 @@
|
||||
# Stack Orchestrator
|
||||
|
||||
Stack Orchestrator allows building and deployment of a Laconic stack on a single machine with minimial prerequisites.
|
||||
Stack Orchestrator allows building and deployment of a Laconic Stack on a single machine with minimial prerequisites. It is a Python3 CLI tool that runs on any OS with Python3 and Docker. The following diagram summarizes the relevant repositories in the Laconic Stack - and the relationship to Stack Orchestrator.
|
||||
|
||||
## Setup
|
||||
### User Mode
|
||||
User mode runs the orchestrator from a "binary" single-file release and does not require special Python environment setup. Use this mode unless you plan to make changes to the orchestrator source code.
|
||||
#### Prerequisites
|
||||
Stack Orchestrator is a Python3 CLI tool that runs on any OS with Python3 and Docker. Tested on: Ubuntu 20/22.
|
||||

|
||||
|
||||
## Install
|
||||
|
||||
Ensure that the following are already installed:
|
||||
|
||||
1. Python3 (the stock Python3 version available in Ubuntu 20 and 22 is suitable)
|
||||
```
|
||||
$ python3 --version
|
||||
Python 3.8.10
|
||||
```
|
||||
2. Docker (Install a current version from dockerco, don't use the version from any Linux distro)
|
||||
```
|
||||
$ docker --version
|
||||
Docker version 20.10.17, build 100c701
|
||||
```
|
||||
3. If installed from regular package repository (not Docker Desktop), BE AWARE that the compose plugin may need to be installed, as well.
|
||||
```
|
||||
DOCKER_CONFIG=${DOCKER_CONFIG:-$HOME/.docker}
|
||||
mkdir -p $DOCKER_CONFIG/cli-plugins
|
||||
curl -SL https://github.com/docker/compose/releases/download/v2.11.2/docker-compose-linux-x86_64 -o $DOCKER_CONFIG/cli-plugins/docker-compose
|
||||
chmod +x ~/.docker/cli-plugins/docker-compose
|
||||
|
||||
# see https://docs.docker.com/compose/install/linux/#install-the-plugin-manually for further details
|
||||
# or to install for all users.
|
||||
```
|
||||
#### Install
|
||||
1. Download the latest release from [this page](https://github.com/cerc-io/stack-orchestrator/tags), into a suitable directory (e.g. `~/bin`):
|
||||
```
|
||||
$ cd ~/bin
|
||||
$ curl https://github.com/cerc-io/stack-orchestrator/releases/download/v1.0.0-alpha/laconic-so
|
||||
```
|
||||
1. Ensure `laconic-so` is on the `PATH`
|
||||
1. Verify operation:
|
||||
```
|
||||
$ ~/bin/laconic-so --help
|
||||
Usage: python -m laconic-so [OPTIONS] COMMAND [ARGS]...
|
||||
- [Python3](https://wiki.python.org/moin/BeginnersGuide/Download): `python3 --version` >= `3.10.8`
|
||||
- [Docker](https://docs.docker.com/get-docker/): `docker --version` >= `20.10.21`
|
||||
- [Docker Compose](https://docs.docker.com/compose/install/): `docker-compose --version` >= `2.13.0`
|
||||
|
||||
Laconic Stack Orchestrator
|
||||
Note: if installing docker-compose via package manager (as opposed to Docker Desktop), you must [install the plugin](https://docs.docker.com/compose/install/linux/#install-the-plugin-manually), e.g., on Linux:
|
||||
|
||||
Options:
|
||||
--quiet
|
||||
--verbose
|
||||
--dry-run
|
||||
--local-stack
|
||||
-h, --help Show this message and exit.
|
||||
```bash
|
||||
mkdir -p ~/.docker/cli-plugins
|
||||
curl -SL https://github.com/docker/compose/releases/download/v2.11.2/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose
|
||||
chmod +x ~/.docker/cli-plugins/docker-compose
|
||||
```
|
||||
|
||||
Commands:
|
||||
build-containers build the set of containers required for a complete...
|
||||
deploy-system deploy a stack
|
||||
setup-repositories git clone the set of repositories required to build...
|
||||
```
|
||||
### Developer mode
|
||||
Suitable for developers either modifying or debugging the orchestrator Python code:
|
||||
#### Prerequisites
|
||||
In addition to the binary install prerequisites listed above, the following are required:
|
||||
1. Python venv package
|
||||
This may or may not be already installed depending on the host OS and version. Check by running:
|
||||
```
|
||||
$ python3 -m venv
|
||||
usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] [--upgrade] [--without-pip] [--prompt PROMPT] ENV_DIR [ENV_DIR ...]
|
||||
venv: error: the following arguments are required: ENV_DIR
|
||||
```
|
||||
If the venv package is missing you should see a message indicating how to install it, for example with:
|
||||
```
|
||||
$ apt install python3.8-venv
|
||||
```
|
||||
#### Install
|
||||
1. Clone this repository:
|
||||
```
|
||||
$ git clone (https://github.com/cerc-io/stack-orchestrator.git
|
||||
```
|
||||
4. Enter the project directory:
|
||||
```
|
||||
$ cd stack-orchestrator
|
||||
```
|
||||
5. Create and activate a venv:
|
||||
```
|
||||
$ python3 -m venv venv
|
||||
$ source ./venv/bin/activate
|
||||
(venv) $
|
||||
```
|
||||
6. Install the cli in edit mode:
|
||||
```
|
||||
$ pip install --editable .
|
||||
```
|
||||
7. Verify installation:
|
||||
```
|
||||
(venv) $ laconic-so
|
||||
Usage: laconic-so [OPTIONS] COMMAND [ARGS]...
|
||||
Next, download the latest release from [this page](https://github.com/cerc-io/stack-orchestrator/tags), into a suitable directory (e.g. `~/bin`):
|
||||
|
||||
Laconic Stack Orchestrator
|
||||
```bash
|
||||
curl -L -o ~/bin/laconic-so https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so
|
||||
```
|
||||
|
||||
Options:
|
||||
--quiet
|
||||
--verbose
|
||||
--dry-run
|
||||
-h, --help Show this message and exit.
|
||||
Give it permissions:
|
||||
```bash
|
||||
chmod +x ~/bin/laconic-so
|
||||
```
|
||||
|
||||
Commands:
|
||||
build-containers build the set of containers required for a complete...
|
||||
deploy-system deploy a stack
|
||||
setup-repositories git clone the set of repositories required to build...
|
||||
```
|
||||
Ensure `laconic-so` is on the [`PATH`](https://unix.stackexchange.com/a/26059)
|
||||
|
||||
#### Build a zipapp (single file distributable script)
|
||||
Use shiv to build a single file Python executable zip archive of laconic-so:
|
||||
1. Install [shiv](https://github.com/linkedin/shiv):
|
||||
```
|
||||
$ (venv) pip install shiv
|
||||
$ (venv) pip install wheel
|
||||
```
|
||||
1. Run shiv to create a zipapp file:
|
||||
```
|
||||
$ (venv) shiv -c laconic-so -o laconic-so .
|
||||
```
|
||||
This creates a file `./laconic-so` that is executable outside of any venv, and on other machines and OSes and architectures, and requiring only the system Python3:
|
||||
1. Verify it works:
|
||||
```
|
||||
$ cp stack-orchetrator/laconic-so ~/bin
|
||||
$ laconic-so
|
||||
Usage: python -m laconic-so [OPTIONS] COMMAND [ARGS]...
|
||||
Verify operation:
|
||||
|
||||
Laconic Stack Orchestrator
|
||||
```
|
||||
laconic-so --help
|
||||
Usage: python -m laconic-so [OPTIONS] COMMAND [ARGS]...
|
||||
|
||||
Options:
|
||||
--quiet
|
||||
--verbose
|
||||
--dry-run
|
||||
-h, --help Show this message and exit.
|
||||
Laconic Stack Orchestrator
|
||||
|
||||
Commands:
|
||||
build-containers build the set of containers required for a complete...
|
||||
deploy-system deploy a stack
|
||||
setup-repositories git clone the set of repositories required to build...
|
||||
```
|
||||
### CI Mode
|
||||
_write-me_
|
||||
Options:
|
||||
--quiet
|
||||
--verbose
|
||||
--dry-run
|
||||
--local-stack
|
||||
-h, --help Show this message and exit.
|
||||
|
||||
Commands:
|
||||
build-containers build the set of containers required for a complete...
|
||||
build-npms build the set of npm packages required for a...
|
||||
deploy-system deploy a stack
|
||||
setup-repositories git clone the set of repositories required to build...
|
||||
```
|
||||
|
||||
## Usage
|
||||
There are three sub-commands: `setup-repositories`, `build-containers` and `deploy-system` that are generally run in order:
|
||||
|
||||
Note: $ laconic-so will run the version installed to ~/bin, while ./laconic-so can be invoked to run locally built
|
||||
version in a checkout
|
||||
Three sub-commands: `setup-repositories`, `build-containers` and `deploy-system` are generally run in order. The following is a slim example for standing up the `erc20-watcher`. Go further with the [erc20 watcher demo](/app/data/stacks/erc20) and other pieces of the stack, within the [`stacks` directory](/app/data/stacks).
|
||||
|
||||
### Setup Repositories
|
||||
Clones the set of git repositories necessary to build a system.
|
||||
|
||||
Note: the use of `ssh-agent` is recommended in order to avoid entering your ssh key passphrase for each repository.
|
||||
```
|
||||
$ laconic-so --verbose setup-repositories #this will default to ~/cerc or CERC_REPO_BASE_DIR from an env file
|
||||
#$ ./laconic-so --verbose --local-stack setup-repositories #this will use cwd ../ as dev_root_path
|
||||
Clone the set of git repositories necessary to build a system:
|
||||
|
||||
```bash
|
||||
laconic-so --verbose setup-repositories --include cerc-io/go-ethereum,cerc-io/ipld-eth-db,cerc-io/ipld-eth-server,cerc-io/watcher-ts
|
||||
```
|
||||
|
||||
This will default to `~/cerc` or - if set - the environment variable `CERC_REPO_BASE_DIR`
|
||||
|
||||
### Build Containers
|
||||
Builds the set of docker container images required to run a system. It takes around 10 minutes to build all the containers from cold.
|
||||
```
|
||||
$ laconic-so --verbose build-containers #this will default to ~/cerc or CERC_REPO_BASE_DIR from an env file
|
||||
#$ ./laconic-so --verbose --local-stack build-containers #this will use cwd ../ as dev_root_path
|
||||
|
||||
Build the set of docker container images required to run a system. It takes around 10 minutes to build all the containers from scratch.
|
||||
|
||||
```bash
|
||||
laconic-so --verbose build-containers --include cerc/go-ethereum,cerc/go-ethereum-foundry,cerc/ipld-eth-db,cerc/ipld-eth-server,cerc/watcher-erc20
|
||||
```
|
||||
|
||||
### Deploy System
|
||||
Uses `docker compose` to deploy a system.
|
||||
|
||||
Use `---include <list of components>` to deploy a subset of all containers:
|
||||
Uses `docker-compose` to deploy a system (with most recently built container images).
|
||||
|
||||
```bash
|
||||
laconic-so --verbose deploy-system --include ipld-eth-db,go-ethereum-foundry,ipld-eth-server,watcher-erc20 up
|
||||
```
|
||||
$ laconic-so --verbose deploy-system --include db-sharding,contract,ipld-eth-server,go-ethereum-foundry up
|
||||
|
||||
Check out he GraphQL playground here: [http://localhost:3002/graphql](http://localhost:3002/graphql)
|
||||
|
||||
See the [erc20 watcher demo](/app/data/stacks/erc20) to continue further.
|
||||
|
||||
### Cleanup
|
||||
|
||||
```bash
|
||||
laconic-so --verbose deploy-system --include ipld-eth-db,go-ethereum-foundry,ipld-eth-server,watcher-erc20 down
|
||||
```
|
||||
```
|
||||
$ laconic-so --verbose deploy-system --include db-sharding,contract,ipld-eth-server,go-ethereum-foundry down
|
||||
```
|
||||
Note: deploy-system command interacts with most recently built container images.
|
||||
|
||||
## Contributing
|
||||
|
||||
See the [CONTRIBUTING.md](/docs/CONTRIBUTING.md) for developer mode install.
|
||||
|
||||
## Platform Support
|
||||
Native aarm64 is _not_ currently supported. x64 emulation on ARM64 macos should work (not yet tested).
|
||||
## Implementation
|
||||
The orchestrator's operation is driven by files shown below. `repository-list.txt` container the list of git repositories; `container-image-list.txt` contains
|
||||
the list of container image names, while `clister-list.txt` specifies the set of compose components (corresponding to individual docker-compose-xxx.yml files which may in turn specify more than one container).
|
||||
Files required to build each container image are stored under `./container-build/<container-name>`
|
||||
Files required at deploy-time are stored under `./config/<component-name>`
|
||||
```
|
||||
├── pod-list.txt
|
||||
├── compose
|
||||
│ ├── docker-compose-contract.yml
|
||||
│ ├── docker-compose-db-sharding.yml
|
||||
│ ├── docker-compose-db.yml
|
||||
│ ├── docker-compose-eth-statediff-fill-service.yml
|
||||
│ ├── docker-compose-go-ethereum-foundry.yml
|
||||
│ ├── docker-compose-ipld-eth-beacon-db.yml
|
||||
│ ├── docker-compose-ipld-eth-beacon-indexer.yml
|
||||
│ ├── docker-compose-ipld-eth-server.yml
|
||||
│ ├── docker-compose-lighthouse.yml
|
||||
│ └── docker-compose-prometheus-grafana.yml
|
||||
├── config
|
||||
│ └── ipld-eth-server
|
||||
├── container-build
|
||||
│ ├── cerc-eth-statediff-fill-service
|
||||
│ ├── cerc-go-ethereum
|
||||
│ ├── cerc-go-ethereum-foundry
|
||||
│ ├── cerc-ipld-eth-beacon-db
|
||||
│ ├── cerc-ipld-eth-beacon-indexer
|
||||
│ ├── cerc-ipld-eth-db
|
||||
│ ├── cerc-ipld-eth-server
|
||||
│ ├── cerc-lighthouse
|
||||
│ └── cerc-test-contract
|
||||
├── container-image-list.txt
|
||||
├── repository-list.txt
|
||||
```
|
||||
|
||||
_write-more-of-me_
|
||||
Native aarm64 is _not_ currently supported. x64 emulation on ARM64 macos should work (not yet tested).
|
||||
|
||||
|
||||
+57
-15
@@ -1,4 +1,4 @@
|
||||
# Copyright © 2022 Cerc
|
||||
# Copyright © 2022, 2023 Cerc
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -25,7 +25,9 @@ import sys
|
||||
from decouple import config
|
||||
import subprocess
|
||||
import click
|
||||
from .util import include_exclude_check
|
||||
import importlib.resources
|
||||
from pathlib import Path
|
||||
from .util import include_exclude_check, get_parsed_stack_config
|
||||
|
||||
# TODO: find a place for this
|
||||
# epilog="Config provided either in .env or settings.ini or env vars: CERC_REPO_BASE_DIR (defaults to ~/cerc)"
|
||||
@@ -42,6 +44,11 @@ def command(ctx, include, exclude):
|
||||
verbose = ctx.obj.verbose
|
||||
dry_run = ctx.obj.dry_run
|
||||
local_stack = ctx.obj.local_stack
|
||||
stack = ctx.obj.stack
|
||||
continue_on_error = ctx.obj.continue_on_error
|
||||
|
||||
# See: https://stackoverflow.com/questions/25389095/python-get-path-of-root-project-structure
|
||||
container_build_dir = Path(__file__).absolute().parent.joinpath("data", "container-build")
|
||||
|
||||
if local_stack:
|
||||
dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")]
|
||||
@@ -55,30 +62,65 @@ def command(ctx, include, exclude):
|
||||
if not os.path.isdir(dev_root_path):
|
||||
print('Dev root directory doesn\'t exist, creating')
|
||||
|
||||
with open("container-image-list.txt") as container_list_file:
|
||||
containers = container_list_file.read().splitlines()
|
||||
# See: https://stackoverflow.com/a/20885799/1701505
|
||||
from . import data
|
||||
with importlib.resources.open_text(data, "container-image-list.txt") as container_list_file:
|
||||
all_containers = container_list_file.read().splitlines()
|
||||
|
||||
containers_in_scope = []
|
||||
if stack:
|
||||
stack_config = get_parsed_stack_config(stack)
|
||||
containers_in_scope = stack_config['containers']
|
||||
else:
|
||||
containers_in_scope = all_containers
|
||||
|
||||
if verbose:
|
||||
print(f'Containers: {containers}')
|
||||
print(f'Containers: {containers_in_scope}')
|
||||
if stack:
|
||||
print(f"Stack: {stack}")
|
||||
|
||||
# TODO: make this configurable
|
||||
container_build_env = {
|
||||
"CERC_NPM_URL": "http://gitea.local:3000/api/packages/cerc-io/npm/",
|
||||
"CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default="<token-not-supplied>"),
|
||||
"CERC_REPO_BASE_DIR": dev_root_path
|
||||
}
|
||||
|
||||
def process_container(container):
|
||||
if not quiet:
|
||||
print(f"Building: {container}")
|
||||
build_script_filename = os.path.join("container-build", container.replace("/", "-"), "build.sh")
|
||||
build_dir = os.path.join(container_build_dir, container.replace("/", "-"))
|
||||
build_script_filename = os.path.join(build_dir, "build.sh")
|
||||
if verbose:
|
||||
print(f"Script: {build_script_filename}")
|
||||
if not os.path.exists(build_script_filename):
|
||||
print(f"Error, script: {build_script_filename} doesn't exist")
|
||||
sys.exit(1)
|
||||
print(f"Build script filename: {build_script_filename}")
|
||||
if os.path.exists(build_script_filename):
|
||||
build_command = build_script_filename
|
||||
else:
|
||||
if verbose:
|
||||
print(f"No script file found: {build_script_filename}, using default build script")
|
||||
repo_dir = container.split('/')[1]
|
||||
# TODO: make this less of a hack -- should be specified in some metadata somewhere
|
||||
# Check if we have a repo for this container. If not, set the context dir to the container-build subdir
|
||||
repo_full_path = os.path.join(dev_root_path, repo_dir)
|
||||
repo_dir_or_build_dir = repo_dir if os.path.exists(repo_full_path) else build_dir
|
||||
build_command = os.path.join(container_build_dir, "default-build.sh") + f" {container} {repo_dir_or_build_dir}"
|
||||
if not dry_run:
|
||||
# We need to export CERC_REPO_BASE_DIR
|
||||
build_result = subprocess.run(build_script_filename, shell=True, env={'CERC_REPO_BASE_DIR': dev_root_path})
|
||||
# TODO: check result in build_result.returncode
|
||||
print(f"Result is: {build_result}")
|
||||
if verbose:
|
||||
print(f"Executing: {build_command}")
|
||||
build_result = subprocess.run(build_command, shell=True, env=container_build_env)
|
||||
if verbose:
|
||||
print(f"Return code is: {build_result.returncode}")
|
||||
if build_result.returncode != 0:
|
||||
print(f"Error running build for {container}")
|
||||
if not continue_on_error:
|
||||
print("FATAL Error: container build failed and --continue-on-error not set, exiting")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("****** Container Build Error, continuing because --continue-on-error is set")
|
||||
else:
|
||||
print("Skipped")
|
||||
|
||||
for container in containers:
|
||||
for container in containers_in_scope:
|
||||
if include_exclude_check(container, include, exclude):
|
||||
process_container(container)
|
||||
else:
|
||||
|
||||
@@ -0,0 +1,113 @@
|
||||
# Copyright © 2022, 2023 Cerc
|
||||
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http:#www.gnu.org/licenses/>.
|
||||
|
||||
# Builds or pulls containers for the system components
|
||||
|
||||
# env vars:
|
||||
# CERC_REPO_BASE_DIR defaults to ~/cerc
|
||||
|
||||
import os
|
||||
import sys
|
||||
from decouple import config
|
||||
import click
|
||||
import importlib.resources
|
||||
from python_on_whales import docker, DockerException
|
||||
from .util import include_exclude_check, get_parsed_stack_config
|
||||
|
||||
@click.command()
|
||||
@click.option('--include', help="only build these packages")
|
||||
@click.option('--exclude', help="don\'t build these packages")
|
||||
@click.pass_context
|
||||
def command(ctx, include, exclude):
|
||||
'''build the set of npm packages required for a complete stack'''
|
||||
|
||||
quiet = ctx.obj.quiet
|
||||
verbose = ctx.obj.verbose
|
||||
dry_run = ctx.obj.dry_run
|
||||
local_stack = ctx.obj.local_stack
|
||||
debug = ctx.obj.debug
|
||||
stack = ctx.obj.stack
|
||||
continue_on_error = ctx.obj.continue_on_error
|
||||
|
||||
if local_stack:
|
||||
dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")]
|
||||
print(f'Local stack dev_root_path (CERC_REPO_BASE_DIR) overridden to: {dev_root_path}')
|
||||
else:
|
||||
dev_root_path = os.path.expanduser(config("CERC_REPO_BASE_DIR", default="~/cerc"))
|
||||
|
||||
if not quiet:
|
||||
print(f'Dev Root is: {dev_root_path}')
|
||||
|
||||
if not os.path.isdir(dev_root_path):
|
||||
print('Dev root directory doesn\'t exist, creating')
|
||||
|
||||
# See: https://stackoverflow.com/a/20885799/1701505
|
||||
from . import data
|
||||
with importlib.resources.open_text(data, "npm-package-list.txt") as package_list_file:
|
||||
all_packages = package_list_file.read().splitlines()
|
||||
|
||||
packages_in_scope = []
|
||||
if stack:
|
||||
stack_config = get_parsed_stack_config(stack)
|
||||
# TODO: syntax check the input here
|
||||
packages_in_scope = stack_config['npms']
|
||||
else:
|
||||
packages_in_scope = all_packages
|
||||
|
||||
if verbose:
|
||||
print(f'Packages: {packages_in_scope}')
|
||||
|
||||
def build_package(package):
|
||||
if not quiet:
|
||||
print(f"Building npm package: {package}")
|
||||
repo_dir = package
|
||||
repo_full_path = os.path.join(dev_root_path, repo_dir)
|
||||
# TODO: make the npm registry url configurable.
|
||||
build_command = ["sh", "-c", "cd /workspace && build-npm-package-local-dependencies.sh http://gitea.local:3000/api/packages/cerc-io/npm/"]
|
||||
if not dry_run:
|
||||
if verbose:
|
||||
print(f"Executing: {build_command}")
|
||||
envs = {"CERC_NPM_AUTH_TOKEN": os.environ["CERC_NPM_AUTH_TOKEN"]} | ({"CERC_SCRIPT_DEBUG": "true"} if debug else {})
|
||||
try:
|
||||
docker.run("cerc/builder-js",
|
||||
remove=True,
|
||||
interactive=True,
|
||||
tty=True,
|
||||
user=f"{os.getuid()}:{os.getgid()}",
|
||||
envs=envs,
|
||||
add_hosts=[("gitea.local", "host-gateway")],
|
||||
volumes=[(repo_full_path, "/workspace")],
|
||||
command=build_command
|
||||
)
|
||||
# Note that although the docs say that build_result should contain
|
||||
# the command output as a string, in reality it is always the empty string.
|
||||
# Since we detect errors via catching exceptions below, we can safely ignore it here.
|
||||
except DockerException as e:
|
||||
print(f"Error executing build for {package} in container:\n {e}")
|
||||
if not continue_on_error:
|
||||
print("FATAL Error: build failed and --continue-on-error not set, exiting")
|
||||
sys.exit(1)
|
||||
else:
|
||||
print("****** Build Error, continuing because --continue-on-error is set")
|
||||
|
||||
else:
|
||||
print("Skipped")
|
||||
|
||||
for package in packages_in_scope:
|
||||
if include_exclude_check(package, include, exclude):
|
||||
build_package(package)
|
||||
else:
|
||||
if verbose:
|
||||
print(f"Excluding: {package}")
|
||||
@@ -0,0 +1,59 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
eth-probe-db:
|
||||
restart: always
|
||||
image: timescale/timescaledb:latest-pg14
|
||||
environment:
|
||||
POSTGRES_USER: "probe"
|
||||
POSTGRES_DB: "probe"
|
||||
POSTGRES_PASSWORD: "probe"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
volumes:
|
||||
- ../../eth-probe/db/schema.sql:/docker-entrypoint-initdb.d/init.sql
|
||||
ports:
|
||||
- 5432
|
||||
eth-probe-mq:
|
||||
restart: always
|
||||
image: cerc/eth-probe:local
|
||||
environment:
|
||||
MODE: "mq"
|
||||
PROBE_DEV: "false"
|
||||
PGPORT: 5432
|
||||
PGPASSWORD: "probe"
|
||||
DB_USER: "probe"
|
||||
PROBE_DB_NAME: "probe"
|
||||
PROBE_DB_LOCATION: "eth-probe-db"
|
||||
MQ_HOST: "0.0.0.0"
|
||||
MQ_PORT: 33333
|
||||
DEBUG: "vulcanize:*,cerc:*"
|
||||
healthcheck:
|
||||
test: [ "CMD", "nc", "-v", "localhost", "33333" ]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
depends_on:
|
||||
eth-probe-db:
|
||||
condition: service_healthy
|
||||
eth-probe-probe:
|
||||
restart: always
|
||||
image: cerc/eth-probe:local
|
||||
environment:
|
||||
MODE: "probe"
|
||||
PROBE_DEV: "false"
|
||||
MQ_HOST: "eth-probe-mq"
|
||||
MQ_PORT: 33333
|
||||
PROBE_ID: 0
|
||||
GETH_HOST: "fixturenet-eth-geth-1"
|
||||
GETH_MIN_BLOCK: 5
|
||||
GETHJSON_URL: "http://fixturenet-eth-geth-1:9898/geth.json"
|
||||
DEBUG: "vulcanize:*,cerc:*,-vulcanize:sniffer:dpt:error"
|
||||
depends_on:
|
||||
eth-probe-mq:
|
||||
condition: service_healthy
|
||||
@@ -0,0 +1,21 @@
|
||||
version: "3.2"
|
||||
services:
|
||||
prometheus:
|
||||
restart: always
|
||||
image: prom/prometheus
|
||||
depends_on:
|
||||
fixturenet-eth-geth-1:
|
||||
condition: service_healthy
|
||||
volumes:
|
||||
- ../config/fixturenet-eth-metrics/prometheus/etc:/etc/prometheus
|
||||
ports:
|
||||
- "9090"
|
||||
grafana:
|
||||
restart: always
|
||||
image: grafana/grafana
|
||||
volumes:
|
||||
- ../config/fixturenet-eth-metrics/grafana/etc/provisioning/dashboards:/etc/grafana/provisioning/dashboards
|
||||
- ../config/fixturenet-eth-metrics/grafana/etc/provisioning/datasources:/etc/grafana/provisioning/datasources
|
||||
- ../config/fixturenet-eth-metrics/grafana/etc/dashboards:/etc/grafana/dashboards
|
||||
ports:
|
||||
- "3000"
|
||||
+12
-4
@@ -8,9 +8,19 @@ services:
|
||||
environment:
|
||||
RUN_BOOTNODE: "true"
|
||||
image: cerc/fixturenet-eth-geth:local
|
||||
ports:
|
||||
- "9898"
|
||||
- "30303"
|
||||
|
||||
fixturenet-eth-geth-1:
|
||||
hostname: fixturenet-eth-geth-1
|
||||
cap_add:
|
||||
- SYS_PTRACE
|
||||
environment:
|
||||
CERC_REMOTE_DEBUG: "true"
|
||||
CERC_RUN_STATEDIFF: "detect"
|
||||
CERC_STATEDIFF_DB_NODE_ID: 1
|
||||
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
|
||||
env_file:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
image: cerc/fixturenet-eth-geth:local
|
||||
@@ -24,12 +34,11 @@ services:
|
||||
- fixturenet-eth-bootnode-geth
|
||||
ports:
|
||||
- "8545"
|
||||
- "40000"
|
||||
- "6060"
|
||||
|
||||
fixturenet-eth-geth-2:
|
||||
hostname: fixturenet-eth-geth-2
|
||||
environment:
|
||||
CERC_RUN_STATEDIFF: "true"
|
||||
CERC_STATEDIFF_DB_NODE_ID: 2
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "8545"]
|
||||
interval: 30s
|
||||
@@ -40,7 +49,6 @@ services:
|
||||
- ../config/fixturenet-eth/fixturenet-eth.env
|
||||
image: cerc/fixturenet-eth-geth:local
|
||||
depends_on:
|
||||
- migrations
|
||||
- fixturenet-eth-bootnode-geth
|
||||
|
||||
fixturenet-eth-bootnode-lighthouse:
|
||||
+19
-6
@@ -20,14 +20,27 @@ services:
|
||||
DATABASE_USER: "vdbm"
|
||||
DATABASE_PASSWORD: "password"
|
||||
ETH_CHAIN_ID: 99
|
||||
ETH_FORWARD_ETH_CALLS: $eth_forward_eth_calls
|
||||
ETH_PROXY_ON_ERROR: $eth_proxy_on_error
|
||||
ETH_HTTP_PATH: $eth_http_path
|
||||
ETH_FORWARD_ETH_CALLS: "false"
|
||||
ETH_FORWARD_GET_STORAGE_AT: "false"
|
||||
ETH_PROXY_ON_ERROR: "false"
|
||||
METRICS: "true"
|
||||
PROM_HTTP: "true"
|
||||
PROM_HTTP_ADDR: "0.0.0.0"
|
||||
PROM_HTTP_PORT: "8090"
|
||||
LOGRUS_LEVEL: "debug"
|
||||
CERC_REMOTE_DEBUG: "true"
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ../config/ipld-eth-server/chain.json
|
||||
target: /tmp/chain.json
|
||||
ports:
|
||||
- "127.0.0.1:8081:8081"
|
||||
- "127.0.0.1:8082:8082"
|
||||
|
||||
- "8081"
|
||||
- "8082"
|
||||
- "8090"
|
||||
- "40000"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "8081"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
@@ -0,0 +1,45 @@
|
||||
version: '3.8'
|
||||
|
||||
services:
|
||||
keycloak-db:
|
||||
image: postgres:14-alpine
|
||||
env_file:
|
||||
- ../config/keycloak/keycloak.env
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 10
|
||||
start_period: 3s
|
||||
ports:
|
||||
- 5432
|
||||
keycloak:
|
||||
image: cerc/keycloak:local
|
||||
env_file:
|
||||
- ../config/keycloak/keycloak.env
|
||||
environment:
|
||||
JAVA_OPTS_APPEND: "-Dkeycloak.migration.action=import -Dkeycloak.migration.provider=dir -Dkeycloak.migration.dir=/import -Dkeycloak.migration.strategy=IGNORE_EXISTING"
|
||||
volumes:
|
||||
- ../config/keycloak/import:/import
|
||||
ports:
|
||||
- 8080
|
||||
command: ["start"]
|
||||
depends_on:
|
||||
keycloak-db:
|
||||
condition: service_healthy
|
||||
keycloak-nginx:
|
||||
image: nginx:1.23-alpine
|
||||
restart: always
|
||||
volumes:
|
||||
- ../config/keycloak/nginx:/etc/nginx/conf.d
|
||||
ports:
|
||||
- 80
|
||||
depends_on:
|
||||
- keycloak
|
||||
keycloak-nginx-prometheus-exporter:
|
||||
image: nginx/nginx-prometheus-exporter
|
||||
restart: always
|
||||
environment:
|
||||
- SCRAPE_URI=http://keycloak-nginx:80/stub_status
|
||||
depends_on:
|
||||
- keycloak-nginx
|
||||
@@ -3,3 +3,5 @@ services:
|
||||
test:
|
||||
image: cerc/test-container:local
|
||||
restart: always
|
||||
ports:
|
||||
- "80"
|
||||
@@ -0,0 +1,18 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
tx-spammer:
|
||||
restart: always
|
||||
image: cerc/tx-spammer:local
|
||||
env_file:
|
||||
- ../config/tx-spammer/tx-spammer.env
|
||||
environment:
|
||||
ACCOUNTS_CSV_URL: http://fixturenet-eth-bootnode-geth:9898/accounts.csv
|
||||
ETH_HTTP_PATH: http://fixturenet-eth-geth-1:8545
|
||||
LOG_LEVEL: debug
|
||||
SPAMMER_COMMAND: autoSend
|
||||
depends_on:
|
||||
fixturenet-eth-bootnode-geth:
|
||||
condition: service_started
|
||||
fixturenet-eth-geth-1:
|
||||
condition: service_healthy
|
||||
@@ -0,0 +1,49 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
|
||||
erc20-watcher-db:
|
||||
restart: unless-stopped
|
||||
image: postgres:14-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=vdbm
|
||||
- POSTGRES_MULTIPLE_DATABASES=erc20-watcher,erc20-watcher-job-queue
|
||||
- POSTGRES_EXTENSION=erc20-watcher-job-queue:pgcrypto
|
||||
- POSTGRES_PASSWORD=password
|
||||
volumes:
|
||||
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
|
||||
- erc20_watcher_db_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "0.0.0.0:15433:5432"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
|
||||
erc20-watcher:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
ipld-eth-server:
|
||||
condition: service_healthy
|
||||
erc20-watcher-db:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-erc20:local
|
||||
environment:
|
||||
- ETH_RPC_URL=http://go-ethereum:8545
|
||||
command: ["sh", "-c", "yarn server"]
|
||||
volumes:
|
||||
- ../config/watcher-erc20/erc20-watcher.toml:/app/packages/erc20-watcher/environments/local.toml
|
||||
ports:
|
||||
- "0.0.0.0:3002:3001"
|
||||
- "0.0.0.0:9002:9001"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3002"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
volumes:
|
||||
erc20_watcher_db_data:
|
||||
@@ -0,0 +1,49 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
|
||||
erc721-watcher-db:
|
||||
restart: unless-stopped
|
||||
image: postgres:14-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=vdbm
|
||||
- POSTGRES_MULTIPLE_DATABASES=erc721-watcher,erc721-watcher-job-queue
|
||||
- POSTGRES_EXTENSION=erc721-watcher-job-queue:pgcrypto
|
||||
- POSTGRES_PASSWORD=password
|
||||
volumes:
|
||||
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
|
||||
- erc721_watcher_db_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "0.0.0.0:15434:5432"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
|
||||
erc721-watcher:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
ipld-eth-server:
|
||||
condition: service_healthy
|
||||
erc721-watcher-db:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-erc721:local
|
||||
environment:
|
||||
- ETH_RPC_URL=http://go-ethereum:8545
|
||||
command: ["sh", "-c", "yarn server"]
|
||||
volumes:
|
||||
- ../config/watcher-erc721/erc721-watcher.toml:/app/packages/erc721-watcher/environments/local.toml
|
||||
ports:
|
||||
- "0.0.0.0:3009:3009"
|
||||
- "0.0.0.0:9003:9001"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3009"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
|
||||
volumes:
|
||||
erc721_watcher_db_data:
|
||||
+7
-9
@@ -4,7 +4,7 @@ version: '3.2'
|
||||
|
||||
services:
|
||||
|
||||
watcher-db:
|
||||
mobymask-watcher-db:
|
||||
restart: unless-stopped
|
||||
image: postgres:14-alpine
|
||||
environment:
|
||||
@@ -14,7 +14,7 @@ services:
|
||||
- POSTGRES_PASSWORD=password
|
||||
volumes:
|
||||
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
|
||||
- watcher_db_data:/var/lib/postgresql/data
|
||||
- mobymask_watcher_db_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "0.0.0.0:15432:5432"
|
||||
healthcheck:
|
||||
@@ -27,12 +27,12 @@ services:
|
||||
mobymask-watcher-server:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
watcher-db:
|
||||
mobymask-watcher-db:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-mobymask:local
|
||||
command: ["sh", "-c", "yarn server"]
|
||||
volumes:
|
||||
- ../config/watcher-mobymask/mobymask-watcher.toml:/app/watcher-ts/packages/mobymask-watcher/environments/local.toml
|
||||
- ../config/watcher-mobymask/mobymask-watcher.toml:/app/packages/mobymask-watcher/environments/local.toml
|
||||
ports:
|
||||
- "0.0.0.0:3001:3001"
|
||||
- "0.0.0.0:9001:9001"
|
||||
@@ -50,18 +50,16 @@ services:
|
||||
depends_on:
|
||||
mobymask-watcher-server:
|
||||
condition: service_healthy
|
||||
watcher-db:
|
||||
mobymask-watcher-db:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-mobymask:local
|
||||
command: ["sh", "-c", "yarn job-runner"]
|
||||
volumes:
|
||||
- ../config/watcher-mobymask/mobymask-watcher.toml:/app/watcher-ts/packages/mobymask-watcher/environments/local.toml
|
||||
- ../config/watcher-mobymask/mobymask-watcher.toml:/app/packages/mobymask-watcher/environments/local.toml
|
||||
ports:
|
||||
- "0.0.0.0:9000:9000"
|
||||
extra_hosts:
|
||||
- "ipld-eth-server:host-gateway"
|
||||
|
||||
volumes:
|
||||
indexer_db_data:
|
||||
watcher_db_data:
|
||||
|
||||
mobymask_watcher_db_data:
|
||||
@@ -0,0 +1,170 @@
|
||||
version: '3.2'
|
||||
|
||||
services:
|
||||
|
||||
uniswap-watcher-db:
|
||||
restart: unless-stopped
|
||||
image: postgres:14-alpine
|
||||
environment:
|
||||
- POSTGRES_USER=vdbm
|
||||
- POSTGRES_MULTIPLE_DATABASES=erc20-watcher,uni-watcher,uni-info-watcher,erc20-watcher-job-queue,uni-watcher-job-queue,uni-info-watcher-job-queue
|
||||
- POSTGRES_EXTENSION=erc20-watcher-job-queue:pgcrypto,uni-watcher-job-queue:pgcrypto,uni-info-watcher-job-queue:pgcrypto
|
||||
- POSTGRES_PASSWORD=password
|
||||
command: ["postgres", "-c", "shared_preload_libraries=pg_stat_statements", "-c", "pg_stat_statements.track=all", "-c", "work_mem=2GB"]
|
||||
volumes:
|
||||
- ../config/postgresql/multiple-postgressql-databases.sh:/docker-entrypoint-initdb.d/multiple-postgressql-databases.sh
|
||||
- ../config/postgresql/create-pg-stat-statements.sql:/docker-entrypoint-initdb.d/create-pg-stat-statements.sql
|
||||
- uniswap_watcher_db_data:/var/lib/postgresql/data
|
||||
ports:
|
||||
- "0.0.0.0:15435:5432"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "5432"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 10s
|
||||
shm_size: '8GB'
|
||||
|
||||
erc20-watcher-server:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
uniswap-watcher-db:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-uniswap-v3:local
|
||||
working_dir: /app/packages/erc20-watcher
|
||||
environment:
|
||||
- DEBUG=vulcanize:*
|
||||
command: ["node", "--enable-source-maps", "dist/server.js"]
|
||||
volumes:
|
||||
- ../config/watcher-uniswap-v3/erc20-watcher.toml:/app/packages/erc20-watcher/environments/local.toml
|
||||
ports:
|
||||
- "0.0.0.0:3005:3001"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3001"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
uni-watcher-job-runner:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
uniswap-watcher-db:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-uniswap-v3:local
|
||||
working_dir: /app/packages/uni-watcher
|
||||
environment:
|
||||
- DEBUG=vulcanize:*
|
||||
command: ["sh", "-c", "./watch-contract.sh && node --enable-source-maps dist/job-runner.js"]
|
||||
volumes:
|
||||
- ../config/watcher-uniswap-v3/uni-watcher.toml:/app/packages/uni-watcher/environments/local.toml
|
||||
- ../config/watcher-uniswap-v3/watch-contract.sh:/app/packages/uni-watcher/watch-contract.sh
|
||||
ports:
|
||||
- "0.0.0.0:9004:9000"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "9000"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
uni-watcher-server:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
uniswap-watcher-db:
|
||||
condition: service_healthy
|
||||
uni-watcher-job-runner:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-uniswap-v3:local
|
||||
environment:
|
||||
- UNISWAP_START_BLOCK=12369621
|
||||
- DEBUG=vulcanize:*
|
||||
working_dir: /app/packages/uni-watcher
|
||||
command: ["./run.sh"]
|
||||
volumes:
|
||||
- ../config/watcher-uniswap-v3/uni-watcher.toml:/app/packages/uni-watcher/environments/local.toml
|
||||
- ../config/watcher-uniswap-v3/run.sh:/app/packages/uni-watcher/run.sh
|
||||
ports:
|
||||
- "0.0.0.0:3003:3003"
|
||||
- "0.0.0.0:9005:9001"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3003"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
uni-info-watcher-job-runner:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
uniswap-watcher-db:
|
||||
condition: service_healthy
|
||||
erc20-watcher-server:
|
||||
condition: service_healthy
|
||||
uni-watcher-server:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-uniswap-v3:local
|
||||
working_dir: /app/packages/uni-info-watcher
|
||||
environment:
|
||||
- DEBUG=vulcanize:*
|
||||
command: ["node", "--enable-source-maps", "dist/job-runner.js"]
|
||||
volumes:
|
||||
- ../config/watcher-uniswap-v3/uni-info-watcher.toml:/app/packages/uni-info-watcher/environments/local.toml
|
||||
ports:
|
||||
- "0.0.0.0:9006:9002"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "9002"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
uni-info-watcher-server:
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
uniswap-watcher-db:
|
||||
condition: service_healthy
|
||||
erc20-watcher-server:
|
||||
condition: service_healthy
|
||||
uni-watcher-server:
|
||||
condition: service_healthy
|
||||
uni-info-watcher-job-runner:
|
||||
condition: service_healthy
|
||||
image: cerc/watcher-uniswap-v3:local
|
||||
environment:
|
||||
- UNISWAP_START_BLOCK=12369621
|
||||
working_dir: /app/packages/uni-info-watcher
|
||||
command: ["./run.sh"]
|
||||
volumes:
|
||||
- ../config/watcher-uniswap-v3/uni-info-watcher.toml:/app/packages/uni-info-watcher/environments/local.toml
|
||||
- ../config/watcher-uniswap-v3/run.sh:/app/packages/uni-info-watcher/run.sh
|
||||
ports:
|
||||
- "0.0.0.0:3004:3004"
|
||||
- "0.0.0.0:9007:9003"
|
||||
healthcheck:
|
||||
test: ["CMD", "nc", "-v", "localhost", "3004"]
|
||||
interval: 20s
|
||||
timeout: 5s
|
||||
retries: 15
|
||||
start_period: 5s
|
||||
extra_hosts:
|
||||
- "host.docker.internal:host-gateway"
|
||||
|
||||
uniswap-v3-info:
|
||||
depends_on:
|
||||
uni-info-watcher-server:
|
||||
condition: service_healthy
|
||||
image: cerc/uniswap-v3-info:local
|
||||
ports:
|
||||
- "0.0.0.0:3006:3000"
|
||||
|
||||
volumes:
|
||||
uniswap_watcher_db_data:
|
||||
+1414
File diff suppressed because it is too large
Load Diff
+9
@@ -0,0 +1,9 @@
|
||||
apiVersion: 1
|
||||
|
||||
providers:
|
||||
- name: dashboards
|
||||
type: file
|
||||
updateIntervalSeconds: 10
|
||||
options:
|
||||
path: /etc/grafana/dashboards
|
||||
foldersFromFilesStructure: true
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- id: 1
|
||||
uid: jZUuGao4k
|
||||
orgId: 1
|
||||
name: Prometheus
|
||||
type: prometheus
|
||||
typeName: Prometheus
|
||||
typeLogoUrl: public/app/plugins/datasource/prometheus/img/prometheus_logo.svg
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
user: ""
|
||||
database: ""
|
||||
basicAuth: false
|
||||
isDefault: true
|
||||
jsonData:
|
||||
httpMethod: POST
|
||||
readOnly: false
|
||||
@@ -0,0 +1,34 @@
|
||||
global:
|
||||
scrape_interval: 5s
|
||||
evaluation_interval: 15s
|
||||
|
||||
scrape_configs:
|
||||
# ipld-eth-server
|
||||
- job_name: 'ipld-eth-server'
|
||||
metrics_path: /metrics
|
||||
scrape_interval: 5s
|
||||
static_configs:
|
||||
- targets: ['ipld-eth-server:8090']
|
||||
|
||||
# geth
|
||||
- job_name: 'geth'
|
||||
metrics_path: /debug/metrics/prometheus
|
||||
scheme: http
|
||||
static_configs:
|
||||
- targets: ['fixturenet-eth-geth-1:6060']
|
||||
|
||||
# nginx
|
||||
- job_name: 'nginx'
|
||||
scrape_interval: 5s
|
||||
metrics_path: /metrics
|
||||
scheme: http
|
||||
static_configs:
|
||||
- targets: ['keycloak-nginx-prometheus-exporter:9113']
|
||||
|
||||
# keycloak
|
||||
- job_name: 'keycloak'
|
||||
scrape_interval: 5s
|
||||
metrics_path: /auth/realms/cerc/metrics
|
||||
scheme: http
|
||||
static_configs:
|
||||
- targets: ['keycloak:8080']
|
||||
+5
@@ -2,6 +2,7 @@
|
||||
ACCOUNT_PASSWORD=secret1212
|
||||
|
||||
# ENODE of the geth bootnode.
|
||||
BOOTNODE_KEY="b0ac22adcad37213c7c565810a50f1772291e7b0ce53fb73e7ec2a3c75bc13b5"
|
||||
ENODE="enode://af22c29c316ad069cf48a09a4ad5cf04a251b411e45098888d114c6dd7f489a13786620d5953738762afa13711d4ffb3b19aa5de772d8af72f851f7e9c5b164a@fixturenet-eth-bootnode-geth:30303"
|
||||
|
||||
# JWT shared by geth and lighthouse for authentication.
|
||||
@@ -16,3 +17,7 @@ CERC_STATEDIFF_DB_PORT=5432
|
||||
CERC_STATEDIFF_DB_NAME="cerc_testing"
|
||||
CERC_STATEDIFF_DB_USER="vdbm"
|
||||
CERC_STATEDIFF_DB_PASSWORD="password"
|
||||
CERC_STATEDIFF_DB_GOOSE_MIN_VER=23
|
||||
CERC_STATEDIFF_DB_LOG_STATEMENTS="false"
|
||||
|
||||
CERC_GETH_VMODULE="statediff/*=5,rpc/*=5"
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,17 @@
|
||||
POSTGRES_DB=keycloak
|
||||
POSTGRES_USER=keycloak
|
||||
POSTGRES_PASSWORD=keycloak
|
||||
KC_DB=postgres
|
||||
KC_DB_URL_HOST=keycloak-db
|
||||
KC_DB_URL_DATABASE=${POSTGRES_DB}
|
||||
KC_DB_USERNAME=${POSTGRES_USER}
|
||||
KC_DB_PASSWORD=${POSTGRES_PASSWORD}
|
||||
KC_DB_SCHEMA=public
|
||||
KC_HOSTNAME=localhost
|
||||
KC_HTTP_ENABLED="true"
|
||||
KC_HTTP_RELATIVE_PATH="/auth"
|
||||
KC_HOSTNAME_STRICT_HTTPS="false"
|
||||
KEYCLOAK_ADMIN=admin
|
||||
KEYCLOAK_ADMIN_PASSWORD=admin
|
||||
X_API_CHECK_REALM=cerc
|
||||
X_API_CHECK_CLIENT_ID="%api_key%"
|
||||
@@ -0,0 +1,72 @@
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name localhost;
|
||||
|
||||
error_page 500 502 503 504 /50x.html;
|
||||
location = /50x.html {
|
||||
root /usr/share/nginx/html;
|
||||
}
|
||||
|
||||
### geth
|
||||
location ~ ^/eth/?([^/]*)$ {
|
||||
set $apiKey $1;
|
||||
if ($apiKey = '') {
|
||||
set $apiKey $http_X_API_KEY;
|
||||
}
|
||||
auth_request /auth;
|
||||
proxy_buffering off;
|
||||
rewrite /.*$ / break;
|
||||
proxy_pass http://fixturenet-eth-geth-1:8545;
|
||||
}
|
||||
|
||||
## ipld-eth-server
|
||||
# location ~ ^/ipld/eth/([^/]*)$ {
|
||||
# set $apiKey $1;
|
||||
# if ($apiKey = '') {
|
||||
# set $apiKey $http_X_API_KEY;
|
||||
# }
|
||||
# auth_request /auth;
|
||||
# auth_request_set $user_id $sent_http_x_user_id;
|
||||
# proxy_buffering off;
|
||||
# rewrite /.*$ / break;
|
||||
# proxy_pass http://ipld-eth-server:8081;
|
||||
# proxy_set_header X-Original-Remote-Addr $remote_addr;
|
||||
# proxy_set_header X-User-Id $user_id;
|
||||
# }
|
||||
#
|
||||
# location ~ ^/ipld/gql/([^/]*)$ {
|
||||
# set $apiKey $1;
|
||||
# if ($apiKey = '') {
|
||||
# set $apiKey $http_X_API_KEY;
|
||||
# }
|
||||
# auth_request /auth;
|
||||
# proxy_buffering off;
|
||||
# rewrite /.*$ / break;
|
||||
# proxy_pass http://ipld-eth-server:8082;
|
||||
# }
|
||||
|
||||
## lighthouse
|
||||
location /beacon/ {
|
||||
set $apiKey $http_X_API_KEY;
|
||||
auth_request /auth;
|
||||
proxy_buffering off;
|
||||
proxy_pass http://fixturenet-eth-lighthouse-1:8001/;
|
||||
}
|
||||
|
||||
location = /auth {
|
||||
internal;
|
||||
proxy_buffering off;
|
||||
resolver 127.0.0.11 ipv6=off;
|
||||
proxy_pass http://keycloak:8080/auth/realms/cerc/check?apiKey=$apiKey;
|
||||
proxy_pass_request_body off;
|
||||
proxy_set_header Content-Length "";
|
||||
proxy_set_header X-Original-URI $request_uri;
|
||||
proxy_set_header X-Original-Remote-Addr $remote_addr;
|
||||
proxy_set_header X-Original-Host $host;
|
||||
}
|
||||
|
||||
location = /stub_status {
|
||||
stub_status;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
CREATE EXTENSION pg_stat_statements;
|
||||
@@ -0,0 +1,2 @@
|
||||
ETH_CALL_FREQ=1000
|
||||
ETH_SEND_FREQ=1000
|
||||
@@ -0,0 +1,41 @@
|
||||
[server]
|
||||
host = "0.0.0.0"
|
||||
port = 3001
|
||||
mode = "storage"
|
||||
kind = "lazy"
|
||||
|
||||
[metrics]
|
||||
host = "127.0.0.1"
|
||||
port = 9000
|
||||
[metrics.gql]
|
||||
port = 9001
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "erc20-watcher-db"
|
||||
port = 5432
|
||||
database = "erc20-watcher"
|
||||
username = "vdbm"
|
||||
password = "password"
|
||||
synchronize = true
|
||||
logging = false
|
||||
maxQueryExecutionTime = 100
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server:8082/graphql"
|
||||
rpcProviderEndpoint = "http://ipld-eth-server:8081"
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
deleteOnStart = false
|
||||
|
||||
[jobQueue]
|
||||
dbConnectionString = "postgres://vdbm:password@erc20-watcher-db:5432/erc20-watcher-job-queue"
|
||||
maxCompletionLagInSecs = 300
|
||||
jobDelayInMilliSecs = 100
|
||||
eventsInBatch = 50
|
||||
blockDelayInMilliSecs = 2000
|
||||
prefetchBlocksInMem = true
|
||||
prefetchBlockCount = 10
|
||||
@@ -0,0 +1,56 @@
|
||||
[server]
|
||||
host = "0.0.0.0"
|
||||
port = 3009
|
||||
kind = "lazy"
|
||||
|
||||
# Checkpointing state.
|
||||
checkpointing = true
|
||||
|
||||
# Checkpoint interval in number of blocks.
|
||||
checkpointInterval = 2000
|
||||
|
||||
# Enable state creation
|
||||
enableState = true
|
||||
|
||||
# Boolean to filter logs by contract.
|
||||
filterLogs = false
|
||||
|
||||
# Max block range for which to return events in eventsInRange GQL query.
|
||||
# Use -1 for skipping check on block range.
|
||||
maxEventsBlockRange = 1000
|
||||
|
||||
[metrics]
|
||||
host = "127.0.0.1"
|
||||
port = 9000
|
||||
[metrics.gql]
|
||||
port = 9001
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "erc721-watcher-db"
|
||||
port = 5432
|
||||
database = "erc721-watcher"
|
||||
username = "vdbm"
|
||||
password = "password"
|
||||
synchronize = true
|
||||
logging = false
|
||||
maxQueryExecutionTime = 100
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server:8082/graphql"
|
||||
rpcProviderEndpoint = "http://ipld-eth-server:8081"
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
deleteOnStart = false
|
||||
|
||||
[jobQueue]
|
||||
dbConnectionString = "postgres://vdbm:password@erc721-watcher-db:5432/erc721-watcher-job-queue"
|
||||
maxCompletionLagInSecs = 300
|
||||
jobDelayInMilliSecs = 100
|
||||
eventsInBatch = 50
|
||||
blockDelayInMilliSecs = 2000
|
||||
prefetchBlocksInMem = true
|
||||
prefetchBlockCount = 10
|
||||
+2
-2
@@ -27,7 +27,7 @@
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "watcher-db"
|
||||
host = "mobymask-watcher-db"
|
||||
port = 5432
|
||||
database = "mobymask-watcher"
|
||||
username = "vdbm"
|
||||
@@ -47,7 +47,7 @@
|
||||
deleteOnStart = false
|
||||
|
||||
[jobQueue]
|
||||
dbConnectionString = "postgres://vdbm:password@watcher-db/mobymask-watcher-job-queue"
|
||||
dbConnectionString = "postgres://vdbm:password@mobymask-watcher-db/mobymask-watcher-job-queue"
|
||||
maxCompletionLagInSecs = 300
|
||||
jobDelayInMilliSecs = 100
|
||||
eventsInBatch = 50
|
||||
@@ -0,0 +1,39 @@
|
||||
[server]
|
||||
host = "0.0.0.0"
|
||||
port = 3001
|
||||
mode = "eth_call"
|
||||
kind = "lazy"
|
||||
|
||||
[metrics]
|
||||
host = "127.0.0.1"
|
||||
port = 9000
|
||||
[metrics.gql]
|
||||
port = 9001
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "uniswap-watcher-db"
|
||||
port = 5432
|
||||
database = "erc20-watcher"
|
||||
username = "vdbm"
|
||||
password = "password"
|
||||
synchronize = true
|
||||
logging = false
|
||||
maxQueryExecutionTime = 100
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server.example.com:8083/graphql"
|
||||
rpcProviderEndpoint = "http://ipld-eth-server.example.com:8082"
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
deleteOnStart = false
|
||||
|
||||
[jobQueue]
|
||||
dbConnectionString = "postgres://vdbm:password@uniswap-watcher-db:5432/erc20-watcher-job-queue"
|
||||
maxCompletionLagInSecs = 300
|
||||
jobDelayInMilliSecs = 100
|
||||
eventsInBatch = 50
|
||||
blockDelayInMilliSecs = 2000
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
echo "Initializing watcher..."
|
||||
yarn fill --start-block $UNISWAP_START_BLOCK --end-block $((UNISWAP_START_BLOCK + 1))
|
||||
|
||||
echo "Running active server"
|
||||
DEBUG=vulcanize:* exec node --enable-source-maps dist/server.js
|
||||
@@ -0,0 +1,90 @@
|
||||
[server]
|
||||
host = "0.0.0.0"
|
||||
port = 3004
|
||||
mode = "prod"
|
||||
kind = "active"
|
||||
|
||||
# Checkpointing state.
|
||||
checkpointing = true
|
||||
|
||||
# Checkpoint interval in number of blocks.
|
||||
checkpointInterval = 50000
|
||||
|
||||
# Enable state creation
|
||||
enableState = false
|
||||
|
||||
# Max block range for which to return events in eventsInRange GQL query.
|
||||
# Use -1 for skipping check on block range.
|
||||
maxEventsBlockRange = 1000
|
||||
|
||||
# Interval in number of blocks at which to clear entities cache.
|
||||
clearEntitiesCacheInterval = 1000
|
||||
|
||||
# Boolean to skip updating entity fields required in state creation and not required in the frontend.
|
||||
skipStateFieldsUpdate = false
|
||||
|
||||
# Boolean to load GQL query nested entity relations sequentially.
|
||||
loadRelationsSequential = false
|
||||
|
||||
# Max GQL API requests to process simultaneously (defaults to 1).
|
||||
maxSimultaneousRequests = 1
|
||||
|
||||
# GQL cache settings
|
||||
[server.gqlCache]
|
||||
enabled = true
|
||||
|
||||
# Max in-memory cache size (in bytes) (default 8 MB)
|
||||
# maxCacheSize
|
||||
|
||||
# GQL cache-control max-age settings (in seconds)
|
||||
maxAge = 15
|
||||
timeTravelMaxAge = 86400 # 1 day
|
||||
|
||||
[metrics]
|
||||
host = "0.0.0.0"
|
||||
port = 9002
|
||||
[metrics.gql]
|
||||
port = 9003
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "uniswap-watcher-db"
|
||||
port = 5432
|
||||
database = "uni-info-watcher"
|
||||
username = "vdbm"
|
||||
password = "password"
|
||||
synchronize = true
|
||||
logging = false
|
||||
maxQueryExecutionTime = 100
|
||||
|
||||
[database.extra]
|
||||
# maximum number of clients the pool should contain
|
||||
max = 20
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server.example.com:8083/graphql"
|
||||
rpcProviderEndpoint = "http://ipld-eth-server.example.com:8082"
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
deleteOnStart = false
|
||||
|
||||
[upstream.uniWatcher]
|
||||
gqlEndpoint = "http://uni-watcher-server:3003/graphql"
|
||||
gqlSubscriptionEndpoint = "ws://uni-watcher-server:3003/graphql"
|
||||
|
||||
[upstream.tokenWatcher]
|
||||
gqlEndpoint = "http://erc20-watcher-server:3001/graphql"
|
||||
gqlSubscriptionEndpoint = "ws://erc20-watcher-server:3001/graphql"
|
||||
|
||||
[jobQueue]
|
||||
dbConnectionString = "postgres://vdbm:password@uniswap-watcher-db:5432/uni-info-watcher-job-queue"
|
||||
maxCompletionLagInSecs = 300
|
||||
jobDelayInMilliSecs = 1000
|
||||
eventsInBatch = 50
|
||||
subgraphEventsOrder = true
|
||||
blockDelayInMilliSecs = 2000
|
||||
prefetchBlocksInMem = true
|
||||
prefetchBlockCount = 10
|
||||
@@ -0,0 +1,41 @@
|
||||
[server]
|
||||
host = "0.0.0.0"
|
||||
port = 3003
|
||||
kind = "active"
|
||||
|
||||
[metrics]
|
||||
host = "0.0.0.0"
|
||||
port = 9000
|
||||
[metrics.gql]
|
||||
port = 9001
|
||||
|
||||
[database]
|
||||
type = "postgres"
|
||||
host = "uniswap-watcher-db"
|
||||
port = 5432
|
||||
database = "uni-watcher"
|
||||
username = "vdbm"
|
||||
password = "password"
|
||||
synchronize = true
|
||||
logging = false
|
||||
maxQueryExecutionTime = 100
|
||||
|
||||
[upstream]
|
||||
[upstream.ethServer]
|
||||
gqlApiEndpoint = "http://ipld-eth-server.example.com:8083/graphql"
|
||||
rpcProviderEndpoint = "http://ipld-eth-server.example.com:8082"
|
||||
|
||||
[upstream.cache]
|
||||
name = "requests"
|
||||
enabled = false
|
||||
deleteOnStart = false
|
||||
|
||||
[jobQueue]
|
||||
dbConnectionString = "postgres://vdbm:password@uniswap-watcher-db:5432/uni-watcher-job-queue"
|
||||
maxCompletionLagInSecs = 300
|
||||
jobDelayInMilliSecs = 0
|
||||
eventsInBatch = 50
|
||||
lazyUpdateBlockProgress = true
|
||||
blockDelayInMilliSecs = 2000
|
||||
prefetchBlocksInMem = true
|
||||
prefetchBlockCount = 10
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
set -u
|
||||
|
||||
echo "Watching factory contract 0x1F98431c8aD98523631AE4a59f267346ea31F984"
|
||||
yarn watch:contract --address 0x1F98431c8aD98523631AE4a59f267346ea31F984 --kind factory --startingBlock 12369621 --checkpoint
|
||||
|
||||
echo "Watching nfpm contract 0xC36442b4a4522E871399CD717aBDD847Ab11FE88"
|
||||
yarn watch:contract --address 0xC36442b4a4522E871399CD717aBDD847Ab11FE88 --kind nfpm --startingBlock 12369651 --checkpoint
|
||||
@@ -0,0 +1,31 @@
|
||||
# From: https://github.com/vyzo/gerbil/blob/master/docker/Dockerfile
|
||||
FROM gerbil/ubuntu
|
||||
|
||||
# Install the Solidity compiler (latest stable version)
|
||||
# and guile
|
||||
# and libsecp256k1-dev
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive && export DEBCONF_NOWARNINGS="yes" && \
|
||||
apt-get install -y software-properties-common && \
|
||||
add-apt-repository ppa:ethereum/ethereum && \
|
||||
apt-get update && \
|
||||
apt-get install -y solc && \
|
||||
apt-get install -y guile-3.0 && \
|
||||
apt-get install -y libsecp256k1-dev && \
|
||||
apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||
|
||||
RUN mkdir /scripts
|
||||
COPY install-dependencies.sh /scripts
|
||||
|
||||
# Override the definition of GERBIL_PATH in the base image, but
|
||||
# is safe because (at present) no gerbil packages are installed in the base image
|
||||
# We do this in order to allow a set of pre-installed packages from the container
|
||||
# to be used with an arbitrary, potentially different set of projects bind mounted
|
||||
# at /src
|
||||
ENV GERBIL_PATH=/.gerbil
|
||||
RUN bash /scripts/install-dependencies.sh
|
||||
|
||||
# Needed to prevent git from raging about /src
|
||||
RUN git config --global --add safe.directory /src
|
||||
|
||||
COPY entrypoint.sh /scripts
|
||||
ENTRYPOINT ["/scripts/entrypoint.sh"]
|
||||
@@ -0,0 +1,21 @@
|
||||
## Gerbil Scheme Builder
|
||||
|
||||
This container is designed to be used as a simple "build runner" environment for building and running Scheme projects using Gerbil and gerbil-ethereum. Its primary purpose is to allow build/test/run of gerbil code without the need to install and configure all the necessary prerequisites and dependencies on the host system.
|
||||
|
||||
### Usage
|
||||
|
||||
First build the container with:
|
||||
|
||||
```
|
||||
$ laconic-so build-containers --include cerc/builder-gerbil
|
||||
```
|
||||
|
||||
Now, assuming a gerbil project located at `~/projects/my-project`, run bash in the container mounting the project with:
|
||||
|
||||
```
|
||||
$ docker run -it -v $HOME/projects/my-project:/src cerc/builder-gerbil:latest bash
|
||||
root@7c4124bb09e3:/src#
|
||||
```
|
||||
|
||||
Now gerbil commands can be run.
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec "$@"
|
||||
@@ -0,0 +1,16 @@
|
||||
DEPS=(github.com/fare/gerbil-utils
|
||||
github.com/fare/gerbil-poo
|
||||
github.com/fare/gerbil-crypto
|
||||
github.com/fare/gerbil-persist
|
||||
github.com/fare/gerbil-ethereum
|
||||
github.com/drewc/gerbil-swank
|
||||
github.com/drewc/drewc-r7rs-swank
|
||||
github.com/drewc/smug-gerbil
|
||||
github.com/drewc/ftw
|
||||
github.com/vyzo/gerbil-libp2p
|
||||
) ;
|
||||
for i in ${DEPS[@]} ; do
|
||||
echo "Installing gerbil package: $i"
|
||||
gxpkg install $i &&
|
||||
gxpkg build $i
|
||||
done
|
||||
@@ -0,0 +1,48 @@
|
||||
# Originally from: https://github.com/devcontainers/images/blob/main/src/javascript-node/.devcontainer/Dockerfile
|
||||
# [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 18, 16, 14, 18-bullseye, 16-bullseye, 14-bullseye, 18-buster, 16-buster, 14-buster
|
||||
ARG VARIANT=16-bullseye
|
||||
FROM node:${VARIANT}
|
||||
|
||||
ARG USERNAME=node
|
||||
ARG NPM_GLOBAL=/usr/local/share/npm-global
|
||||
|
||||
# Add NPM global to PATH.
|
||||
ENV PATH=${NPM_GLOBAL}/bin:${PATH}
|
||||
|
||||
RUN \
|
||||
# Configure global npm install location, use group to adapt to UID/GID changes
|
||||
if ! cat /etc/group | grep -e "^npm:" > /dev/null 2>&1; then groupadd -r npm; fi \
|
||||
&& usermod -a -G npm ${USERNAME} \
|
||||
&& umask 0002 \
|
||||
&& mkdir -p ${NPM_GLOBAL} \
|
||||
&& touch /usr/local/etc/npmrc \
|
||||
&& chown ${USERNAME}:npm ${NPM_GLOBAL} /usr/local/etc/npmrc \
|
||||
&& chmod g+s ${NPM_GLOBAL} \
|
||||
&& npm config -g set prefix ${NPM_GLOBAL} \
|
||||
&& su ${USERNAME} -c "npm config -g set prefix ${NPM_GLOBAL}" \
|
||||
# Install eslint
|
||||
&& su ${USERNAME} -c "umask 0002 && npm install -g eslint" \
|
||||
&& npm cache clean --force > /dev/null 2>&1
|
||||
|
||||
# [Optional] Uncomment this section to install additional OS packages.
|
||||
RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \
|
||||
&& apt-get -y install --no-install-recommends jq
|
||||
|
||||
# [Optional] Uncomment if you want to install an additional version of node using nvm
|
||||
# ARG EXTRA_NODE_VERSION=10
|
||||
# RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}"
|
||||
|
||||
# [Optional] Uncomment if you want to install more global node modules
|
||||
# RUN su node -c "npm install -g <your-package-list-here>"
|
||||
|
||||
RUN mkdir /scripts
|
||||
COPY build-npm-package.sh /scripts
|
||||
COPY yarn-local-registry-fixup.sh /scripts
|
||||
COPY build-npm-package-local-dependencies.sh /scripts
|
||||
ENV PATH="${PATH}:/scripts"
|
||||
|
||||
COPY entrypoint.sh .
|
||||
ENTRYPOINT ["./entrypoint.sh"]
|
||||
# Placeholder CMD : generally this will be overridden at run time like :
|
||||
# docker run -it -v /home/builder/cerc/laconic-sdk:/workspace cerc/builder-js sh -c 'cd /workspace && yarn && yarn build'
|
||||
CMD node --version
|
||||
@@ -0,0 +1,17 @@
|
||||
## JS/TS Package Builder
|
||||
|
||||
This container is designed to be used as a simple "build runner" environment for building and publishing JS/TS projects
|
||||
using `yarn`.
|
||||
|
||||
### Running a build
|
||||
|
||||
As a temporary measure while the necessary functionality is being added to Stack Orchestrator,
|
||||
it is possible to build packages manually by invoking `docker run` , for example as follows:
|
||||
|
||||
|
||||
```
|
||||
$ docker run --rm -it --add-host gitea.local:host-gateway \
|
||||
-v ${HOME}/cerc/laconic-registry-cli:/workspace cerc/builder-js \
|
||||
sh -c 'cd /workspace && CERC_NPM_AUTH_TOKEN=6613572a28ebebaee20ccd90064251fa8c2b94f6 \
|
||||
build-npm-package-local-dependencies.sh http://gitea.local:3000/api/packages/cerc-io/npm/ 0.1.8'
|
||||
```
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
#!/bin/bash
|
||||
# Usage: build-npm-package-local-dependencies.sh <registry-url> <publish-with-this-version>
|
||||
# Runs build-npm-package.sh after first fixing up yarn.lock to use a local
|
||||
# npm registry for all packages in a spcific scope (currently @cerc-io)
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
if ! [[ $# -eq 1 || $# -eq 2 ]]; then
|
||||
echo "Illegal number of parameters" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${CERC_NPM_AUTH_TOKEN}" ]]; then
|
||||
echo "CERC_NPM_AUTH_TOKEN is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Exit on error
|
||||
set -e
|
||||
local_npm_registry_url=$1
|
||||
package_publish_version=$2
|
||||
# TODO: make this a paramater and allow a list of scopes
|
||||
npm_scope_for_local="@cerc-io"
|
||||
# We need to configure the local registry
|
||||
npm config set ${npm_scope_for_local}:registry ${local_npm_registry_url}
|
||||
npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN}
|
||||
# Find the set of dependencies from the specified scope
|
||||
mapfile -t dependencies_from_scope < <(cat package.json | jq -r '.dependencies | with_entries(if (.key|test("^'${npm_scope_for_local}'/.*$")) then ( {key: .key, value: .value } ) else empty end ) | keys[]')
|
||||
echo "Fixing up dependencies"
|
||||
for package in "${dependencies_from_scope[@]}"
|
||||
do
|
||||
echo "Fixing up package ${package}"
|
||||
yarn-local-registry-fixup.sh $package ${local_npm_registry_url}
|
||||
done
|
||||
echo "Running build"
|
||||
build-npm-package.sh ${local_npm_registry_url} ${package_publish_version}
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/bin/bash
|
||||
# Usage: build-npm-package.sh <registry-url> <publish-with-this-version>
|
||||
# Note: supply the registry auth token in CERC_NPM_AUTH_TOKEN
|
||||
if [[ -n "$CERC_SCRIPT_DEBUG" ]]; then
|
||||
set -x
|
||||
fi
|
||||
if ! [[ $# -eq 1 || $# -eq 2 ]]; then
|
||||
echo "Illegal number of parameters" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ -z "${CERC_NPM_AUTH_TOKEN}" ]]; then
|
||||
echo "CERC_NPM_AUTH_TOKEN is not set" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ $# -eq 2 ]]; then
|
||||
package_publish_version=$2
|
||||
else
|
||||
package_publish_version=$( cat package.json | jq -r .version )
|
||||
fi
|
||||
# Exit on error
|
||||
set -e
|
||||
# Get the name of this package from package.json since we weren't passed that
|
||||
package_name=$( cat package.json | jq -r .name )
|
||||
local_npm_registry_url=$1
|
||||
npm config set @lirewine:registry ${local_npm_registry_url}
|
||||
npm config set @cerc-io:registry ${local_npm_registry_url}
|
||||
npm config set -- ${local_npm_registry_url}:_authToken ${CERC_NPM_AUTH_TOKEN}
|
||||
# First check if the version of this package we're trying to build already exists in the registry
|
||||
package_exists=$( yarn info --json ${package_name}@${package_publish_version} 2>/dev/null | jq -r .data.dist.tarball )
|
||||
if [[ ! -z "$package_exists" && "$package_exists" != "null" ]]; then
|
||||
echo "${package_publish_version} of ${package_name} already exists in the registry, skipping build"
|
||||
exit 0
|
||||
fi
|
||||
echo "Build and publish ${package_name} version ${package_publish_version}"
|
||||
yarn install
|
||||
yarn build
|
||||
yarn publish --non-interactive --new-version ${package_publish_version} --no-git-tag-version
|
||||
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
exec "$@"
|
||||
@@ -0,0 +1,57 @@
|
||||
#!/bin/bash
|
||||
# Usage: yarn-local-registry-fixup.sh <package-to-fix> <registry-url>
|
||||
# Assumes package.json and yarn.lock are in the cwd
|
||||
# The purpose of this script is to take a project cloned from git
|
||||
# and "fixup" its yarn.lock file such that specified dependency
|
||||
# will be fetched from a registry other than the one used when
|
||||
# yarn.lock was generated. It updates all checksums using data
|
||||
# from the "new" registry (because due to embedded timestamps etc
|
||||
# the same source code re-built later will not have the same checksum).
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
if [[ $# -ne 2 ]]; then
|
||||
echo "Illegal number of parameters" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Exit on error
|
||||
set -e
|
||||
target_package=$1
|
||||
local_npm_registry_url=$2
|
||||
# TODO: use jq rather than sed here:
|
||||
versioned_target_package=$(grep ${target_package} package.json | sed -e 's#[[:space:]]\{1,\}\"\('${target_package}'\)\":[[:space:]]\{1,\}\"\(.*\)\",#\1@\2#' )
|
||||
# Use yarn info to get URL checksums etc from the new registry
|
||||
yarn_info_output=$(yarn info --json $versioned_target_package 2>/dev/null)
|
||||
# First check if the target version actually exists.
|
||||
# If it doesn't exist there will be no .data.dist.tarball element,
|
||||
# and jq will output the string "null"
|
||||
package_tarball=$(echo $yarn_info_output | jq -r .data.dist.tarball)
|
||||
if [[ $package_tarball == "null" ]]; then
|
||||
echo "FATAL: Target package version ($versioned_target_package) not found" >&2
|
||||
exit 1
|
||||
fi
|
||||
# Code below parses out the values we need
|
||||
# When running inside a container, the registry can return a URL with the wrong host name due to proxying
|
||||
# so we need to check if that has happened and fix the URL if so.
|
||||
if ! [[ "${package_tarball}" =~ ^${local_npm_registry_url}.* ]]; then
|
||||
# HACK: I've hard-wired the host names below. Replace with proper implementation
|
||||
# TODO: remove the hack when proven no longer necessary
|
||||
package_tarball=$( echo ${package_tarball} | sed -e 's/localhost/gitea.local/g' )
|
||||
fi
|
||||
package_integrity=$(echo $yarn_info_output | jq -r .data.dist.integrity)
|
||||
package_shasum=$(echo $yarn_info_output | jq -r .data.dist.shasum)
|
||||
package_resolved=${package_tarball}#${package_shasum}
|
||||
# Some strings need to be escaped so they work when passed to sed later
|
||||
escaped_package_integrity=$(printf '%s\n' "$package_integrity" | sed -e 's/[\/&]/\\&/g')
|
||||
escaped_package_resolved=$(printf '%s\n' "$package_resolved" | sed -e 's/[\/&]/\\&/g')
|
||||
escaped_target_package=$(printf '%s\n' "$target_package" | sed -e 's/[\/&]/\\&/g')
|
||||
if [ -n "$CERC_SCRIPT_VERBOSE" ]; then
|
||||
echo "Tarball: ${package_tarball}"
|
||||
echo "Integrity: ${package_integrity}"
|
||||
echo "Shasum: ${package_shasum}"
|
||||
echo "Resolved: ${package_resolved}"
|
||||
fi
|
||||
# Use magic sed regex to replace the values in yarn.lock
|
||||
# Note: yarn.lock is not json so we can not use jq for this
|
||||
sed -i -e '/^\"'${escaped_target_package}'.*\":$/ , /^\".*$/ s/^\([[:space:]]\{1,\}resolved \).*$/\1'\"${escaped_package_resolved}\"'/' yarn.lock
|
||||
sed -i -e '/^\"'${escaped_target_package}'.*\":$/ , /^\".*$/ s/^\([[:space:]]\{1,\}integrity \).*$/\1'${escaped_package_integrity}'/' yarn.lock
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/eth-probe
|
||||
docker build -t cerc/eth-probe:local ${CERC_REPO_BASE_DIR}/eth-probe
|
||||
+12
-4
@@ -1,10 +1,17 @@
|
||||
FROM skylenet/ethereum-genesis-generator@sha256:210353ce7c898686bc5092f16c61220a76d357f51eff9c451e9ad1b9ad03d4d3 AS ethgen
|
||||
|
||||
FROM cerc/go-ethereum:local
|
||||
RUN apk add --no-cache python3 python3-dev py3-pip curl wget jq build-base gettext libintl openssl bash
|
||||
# Using the same golang image as used to build geth: https://github.com/cerc-io/go-ethereum/blob/HEAD/Dockerfile
|
||||
FROM golang:1.18-alpine as delve
|
||||
RUN go install github.com/go-delve/delve/cmd/dlv@latest
|
||||
|
||||
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/eth2-testnet-genesis
|
||||
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools
|
||||
FROM cerc/go-ethereum:local as geth
|
||||
|
||||
FROM alpine:latest
|
||||
RUN apk add --no-cache python3 python3-dev py3-pip curl wget jq build-base gettext libintl openssl bash bind-tools postgresql-client
|
||||
|
||||
COPY --from=delve /go/bin/dlv /usr/local/bin/
|
||||
COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/
|
||||
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/
|
||||
COPY --from=ethgen /apps /apps
|
||||
|
||||
RUN cd /apps/el-gen && pip3 install -r requirements.txt
|
||||
@@ -14,6 +21,7 @@ COPY run-el.sh /opt/testnet/run.sh
|
||||
|
||||
RUN cd /opt/testnet && make genesis-el
|
||||
|
||||
COPY --from=geth /usr/local/bin/geth /usr/local/bin/
|
||||
RUN geth init /opt/testnet/build/el/geth.json && rm -f ~/.ethereum/geth/nodekey
|
||||
|
||||
ENTRYPOINT ["/opt/testnet/run.sh"]
|
||||
@@ -0,0 +1,38 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
# See: https://github.com/skylenet/ethereum-genesis-generator/blob/master/entrypoint.sh
|
||||
|
||||
rm -rf ../build/el
|
||||
mkdir -p ../build/el
|
||||
|
||||
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
|
||||
envsubst < el-config.yaml > $tmp_dir/genesis-config.yaml
|
||||
|
||||
ttd=`cat $tmp_dir/genesis-config.yaml | grep terminal_total_difficulty | awk '{ print $2 }'`
|
||||
homestead_block=`cat $tmp_dir/genesis-config.yaml | grep homestead_block | awk '{ print $2 }'`
|
||||
eip150_block=`cat $tmp_dir/genesis-config.yaml | grep eip150_block | awk '{ print $2 }'`
|
||||
eip155_block=`cat $tmp_dir/genesis-config.yaml | grep eip155_block | awk '{ print $2 }'`
|
||||
eip158_block=`cat $tmp_dir/genesis-config.yaml | grep eip158_block | awk '{ print $2 }'`
|
||||
byzantium_block=`cat $tmp_dir/genesis-config.yaml | grep byzantium_block | awk '{ print $2 }'`
|
||||
constantinople_block=`cat $tmp_dir/genesis-config.yaml | grep constantinople_block | awk '{ print $2 }'`
|
||||
petersburg_block=`cat $tmp_dir/genesis-config.yaml | grep petersburg_block | awk '{ print $2 }'`
|
||||
istanbul_block=`cat $tmp_dir/genesis-config.yaml | grep istanbul_block | awk '{ print $2 }'`
|
||||
berlin_block=`cat $tmp_dir/genesis-config.yaml | grep berlin_block | awk '{ print $2 }'`
|
||||
london_block=`cat $tmp_dir/genesis-config.yaml | grep london_block | awk '{ print $2 }'`
|
||||
merge_fork_block=`cat $tmp_dir/genesis-config.yaml | grep merge_fork_block | awk '{ print $2 }'`
|
||||
|
||||
python3 /apps/el-gen/genesis_geth.py $tmp_dir/genesis-config.yaml | \
|
||||
jq ".config.terminalTotalDifficulty=$ttd" | \
|
||||
jq ".config.homesteadBlock=$homestead_block" | \
|
||||
jq ".config.eip150Block=$eip150_block" | \
|
||||
jq ".config.eip155Block=$eip155_block" | \
|
||||
jq ".config.eip158Block=$eip158_block" | \
|
||||
jq ".config.byzantiumBlock=$byzantium_block" | \
|
||||
jq ".config.constantinopleBlock=$constantinople_block" | \
|
||||
jq ".config.petersburgBlock=$petersburg_block" | \
|
||||
jq ".config.istanbulBlock=$istanbul_block" | \
|
||||
jq ".config.berlinBlock=$berlin_block" | \
|
||||
jq ".config.londonBlock=$london_block" | \
|
||||
jq ".config.mergeForkBlock=$merge_fork_block" > ../build/el/geth.json
|
||||
python3 ../accounts/mnemonic_to_csv.py $tmp_dir/genesis-config.yaml > ../build/el/accounts.csv
|
||||
+11
@@ -11,6 +11,17 @@ chain_id: 1212
|
||||
deposit_contract_address: "0x1212121212121212121212121212121212121212"
|
||||
genesis_timestamp: 0
|
||||
terminal_total_difficulty: 1000
|
||||
homestead_block: 1
|
||||
eip150_block: 1
|
||||
eip155_block: 1
|
||||
eip158_block: 1
|
||||
byzantium_block: 1
|
||||
constantinople_block: 1
|
||||
petersburg_block: 1
|
||||
istanbul_block: 1
|
||||
berlin_block: 1
|
||||
london_block: 1
|
||||
merge_fork_block: 1
|
||||
|
||||
clique:
|
||||
enabled: false
|
||||
@@ -0,0 +1,99 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
ETHERBASE=`cat /opt/testnet/build/el/accounts.csv | head -1 | cut -d',' -f2`
|
||||
NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'`
|
||||
NETRESTRICT=`ip addr | grep inet | grep -v '127.0' | awk '{print $2}'`
|
||||
|
||||
HOME_DIR=`pwd`
|
||||
cd /opt/testnet/build/el
|
||||
python3 -m http.server 9898 &
|
||||
cd $HOME_DIR
|
||||
|
||||
START_CMD="geth"
|
||||
if [ "true" == "$CERC_REMOTE_DEBUG" ] && [ -x "/usr/local/bin/dlv" ]; then
|
||||
START_CMD="/usr/local/bin/dlv --listen=:40000 --headless=true --api-version=2 --accept-multiclient exec /usr/local/bin/geth --continue --"
|
||||
fi
|
||||
|
||||
if [ "true" == "$RUN_BOOTNODE" ]; then
|
||||
$START_CMD \
|
||||
--nodekeyhex="${BOOTNODE_KEY}" \
|
||||
--nodiscover \
|
||||
--ipcdisable \
|
||||
--networkid=${NETWORK_ID} \
|
||||
--netrestrict="${NETRESTRICT}"
|
||||
else
|
||||
cd /opt/testnet/accounts
|
||||
./import_keys.sh
|
||||
|
||||
echo -n "$JWT" > /opt/testnet/build/el/jwtsecret
|
||||
|
||||
if [ "$CERC_RUN_STATEDIFF" == "detect" ] && [ -n "$CERC_STATEDIFF_DB_HOST" ]; then
|
||||
dig_result=$(dig $CERC_STATEDIFF_DB_HOST +short)
|
||||
dig_status_code=$?
|
||||
if [[ $dig_status_code = 0 && -n $dig_result ]]; then
|
||||
echo "Statediff DB at $CERC_STATEDIFF_DB_HOST"
|
||||
CERC_RUN_STATEDIFF="true"
|
||||
else
|
||||
echo "No statediff DB available."
|
||||
CERC_RUN_STATEDIFF="false"
|
||||
fi
|
||||
fi
|
||||
|
||||
STATEDIFF_OPTS=""
|
||||
if [ "$CERC_RUN_STATEDIFF" == "true" ]; then
|
||||
ready=0
|
||||
while [ $ready -eq 0 ]; do
|
||||
echo "Waiting for statediff DB..."
|
||||
sleep 1
|
||||
export PGPASSWORD="$CERC_STATEDIFF_DB_PASSWORD"
|
||||
result=$(psql -h "$CERC_STATEDIFF_DB_HOST" \
|
||||
-p "$CERC_STATEDIFF_DB_PORT" \
|
||||
-U "$CERC_STATEDIFF_DB_USER" \
|
||||
-d "$CERC_STATEDIFF_DB_NAME" \
|
||||
-t -c 'select max(version_id) from goose_db_version;' 2>/dev/null | awk '{ print $1 }')
|
||||
if [ -n "$result" ] && [ $result -ge $CERC_STATEDIFF_DB_GOOSE_MIN_VER ]; then
|
||||
echo "DB ready..."
|
||||
ready=1
|
||||
fi
|
||||
done
|
||||
STATEDIFF_OPTS="--statediff=true \
|
||||
--statediff.db.host=$CERC_STATEDIFF_DB_HOST \
|
||||
--statediff.db.name=$CERC_STATEDIFF_DB_NAME \
|
||||
--statediff.db.nodeid=$CERC_STATEDIFF_DB_NODE_ID \
|
||||
--statediff.db.password=$CERC_STATEDIFF_DB_PASSWORD \
|
||||
--statediff.db.port=$CERC_STATEDIFF_DB_PORT \
|
||||
--statediff.db.user=$CERC_STATEDIFF_DB_USER \
|
||||
--statediff.db.logstatements=${CERC_STATEDIFF_DB_LOG_STATEMENTS:-false} \
|
||||
--statediff.waitforsync=true \
|
||||
--statediff.writing=true"
|
||||
fi
|
||||
|
||||
$START_CMD \
|
||||
--bootnodes="${ENODE}" \
|
||||
--allow-insecure-unlock \
|
||||
--http \
|
||||
--http.addr="0.0.0.0" \
|
||||
--http.vhosts="*" \
|
||||
--http.api="eth,web3,net,admin,personal,debug,statediff" \
|
||||
--http.corsdomain="*" \
|
||||
--authrpc.addr="0.0.0.0" \
|
||||
--authrpc.vhosts="*" \
|
||||
--authrpc.jwtsecret="/opt/testnet/build/el/jwtsecret" \
|
||||
--networkid="${NETWORK_ID}" \
|
||||
--netrestrict="${NETRESTRICT}" \
|
||||
--gcmode archive \
|
||||
--txlookuplimit=0 \
|
||||
--cache.preimages \
|
||||
--syncmode=full \
|
||||
--mine \
|
||||
--miner.threads=1 \
|
||||
--metrics \
|
||||
--metrics.addr="0.0.0.0" \
|
||||
--verbosity=${CERC_GETH_VERBOSITY:-3} \
|
||||
--vmodule="${CERC_GETH_VMODULE:-statediff/*=5}" \
|
||||
--miner.etherbase="${ETHERBASE}" ${STATEDIFF_OPTS}
|
||||
fi
|
||||
+4
@@ -27,4 +27,8 @@ RUN cd /opt/testnet && make genesis-cl
|
||||
# Work around some bugs in lcli where the default path is always used.
|
||||
RUN mkdir -p /root/.lighthouse && cd /root/.lighthouse && ln -s /opt/testnet/build/cl/testnet
|
||||
|
||||
RUN mkdir -p /scripts
|
||||
COPY scripts/status-internal.sh /scripts
|
||||
COPY scripts/status.sh /scripts
|
||||
|
||||
ENTRYPOINT ["/opt/testnet/run.sh"]
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
# Wrapper to facilitate using status.sh inside the container
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
export LIGHTHOUSE_BASE_URL="http://fixturenet-eth-lighthouse-1:8001"
|
||||
export GETH_BASE_URL="http://fixturenet-eth-geth-1:8545"
|
||||
# See: https://stackoverflow.com/a/246128/1701505
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
$SCRIPT_DIR/status.sh
|
||||
+10
-4
@@ -1,5 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
#!/usr/bin/env bash
|
||||
if [ -n "$CERC_SCRIPT_DEBUG" ]; then
|
||||
set -x
|
||||
fi
|
||||
STATUSES=("geth to generate DAG" "beacon phase0" "beacon altair" "beacon bellatrix pre-merge" "beacon bellatrix merge")
|
||||
STATUS=0
|
||||
|
||||
@@ -7,13 +9,17 @@ STATUS=0
|
||||
LIGHTHOUSE_BASE_URL=${LIGHTHOUSE_BASE_URL}
|
||||
GETH_BASE_URL=${GETH_BASE_URL}
|
||||
|
||||
# TODO: Docker commands below should be replaced by some interface into stack orchestrator
|
||||
# or some execution environment-neutral mechanism.
|
||||
if [ -z "$LIGHTHOUSE_BASE_URL" ]; then
|
||||
LIGHTHOUSE_PORT=`docker ps -f "name=fixturenet-eth-lighthouse-1-1" --format "{{.Ports}}" | head -1 | cut -d':' -f2 | cut -d'-' -f1`
|
||||
LIGHTHOUSE_CONTAINER=`docker ps -q -f "name=fixturenet-eth-lighthouse-1-1"`
|
||||
LIGHTHOUSE_PORT=`docker port $LIGHTHOUSE_CONTAINER 8001 | cut -d':' -f2`
|
||||
LIGHTHOUSE_BASE_URL="http://localhost:${LIGHTHOUSE_PORT}"
|
||||
fi
|
||||
|
||||
if [ -z "$GETH_BASE_URL" ]; then
|
||||
GETH_PORT=`docker ps -f "name=fixturenet-eth-geth-1-1" --format "{{.Ports}}" | head -1 | cut -d':' -f2 | cut -d'-' -f1`
|
||||
GETH_CONTAINER=`docker ps -q -f "name=fixturenet-eth-geth-1-1"`
|
||||
GETH_PORT=`docker port $GETH_CONTAINER 8545 | cut -d':' -f2`
|
||||
GETH_BASE_URL="http://localhost:${GETH_PORT}"
|
||||
fi
|
||||
|
||||
+3
-1
@@ -1,4 +1,6 @@
|
||||
FROM ghcr.io/foundry-rs/foundry
|
||||
# Use locally build foundry base image to work around there being
|
||||
# no aarm64 image published.
|
||||
FROM foundry-rs/foundry:local
|
||||
|
||||
RUN apk update ; apk add --no-cache --allow-untrusted ca-certificates curl bash git jq
|
||||
RUN apk add --no-cache --upgrade grep
|
||||
+1
-1
@@ -10,7 +10,7 @@
|
||||
"petersburgBlock": 0,
|
||||
"istanbulBlock": 0,
|
||||
"clique": {
|
||||
"period": 2,
|
||||
"period": 5,
|
||||
"epoch": 3000
|
||||
}
|
||||
},
|
||||
@@ -0,0 +1,4 @@
|
||||
FROM quay.io/keycloak/keycloak:20.0
|
||||
WORKDIR /opt/keycloak/providers
|
||||
RUN curl -L https://github.com/aerogear/keycloak-metrics-spi/releases/download/2.5.3/keycloak-metrics-spi-2.5.3.jar --output keycloak-metrics-spi.jar
|
||||
RUN curl -L https://github.com/cerc-io/keycloak-api-key-demo/releases/download/v0.2/api-key-module-0.2.jar --output api-key-module.jar
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user