Skip to content

Commit

Permalink
Merge branch 'main' into ci-test
Browse files Browse the repository at this point in the history
  • Loading branch information
dboreham committed Oct 3, 2023
2 parents 69b352d + cf039d9 commit b3b57b6
Show file tree
Hide file tree
Showing 168 changed files with 7,762 additions and 863 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Lint Checks

on:
pull_request:
branches: '*'
push:
branches: '*'

jobs:
test:
name: "Run linter"
runs-on: ubuntu-latest
steps:
- name: "Clone project repository"
uses: actions/checkout@v3
- name: "Install Python"
uses: actions/setup-python@v4
with:
python-version: '3.8'
- name : "Run flake8"
uses: py-actions/flake8@v2
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Ensure that the following are already installed:
- [Python3](https://wiki.python.org/moin/BeginnersGuide/Download): `python3 --version` >= `3.8.10` (the Python3 shipped in Ubuntu 20+ is good to go)
- [Docker](https://docs.docker.com/get-docker/): `docker --version` >= `20.10.21`
- [jq](https://stedolan.github.io/jq/download/): `jq --version` >= `1.5`
- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git): `git --version` >= `2.10.3`

Note: if installing docker-compose via package manager on Linux (as opposed to Docker Desktop), you must [install the plugin](https://docs.docker.com/compose/install/linux/#install-the-plugin-manually), e.g. :

Expand Down Expand Up @@ -48,6 +49,18 @@ Verify operation (your version will probably be different, just check here that
laconic-so version
Version: 1.1.0-7a607c2-202304260513
```
Save the distribution url to `~/.laconic-so/config.yml`:
```bash
mkdir ~/.laconic-so
echo "distribution-url: https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so" > ~/.laconic-so/config.yml"
```
### Update
If Stack Orchestrator was installed using the process described above, it is able to subsequently self-update to the current latest version by running:
```bash
laconic-so update
```
## Usage
Expand Down
9 changes: 6 additions & 3 deletions app/base.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc
# Copyright © 2022, 2023 Vulcanize

# 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
Expand Down Expand Up @@ -63,7 +63,8 @@ def ensure_available(self):
self.url = "http://gitea.local:3000/api/packages/cerc-io/npm/"
else:
# If not, print a message about how to start it and return fail to the caller
print("ERROR: The package-registry stack is not running, and no external registry specified with CERC_NPM_REGISTRY_URL")
print("ERROR: The package-registry stack is not running, and no external registry "
"specified with CERC_NPM_REGISTRY_URL")
print("ERROR: Start the local package registry with: laconic-so --stack package-registry deploy-system up")
return False
return True
Expand All @@ -75,5 +76,7 @@ def get_url(self):
def get_npm_registry_url():
# If an auth token is not defined, we assume the default should be the cerc registry
# If an auth token is defined, we assume the local gitea should be used.
default_npm_registry_url = "http://gitea.local:3000/api/packages/cerc-io/npm/" if config("CERC_NPM_AUTH_TOKEN", default=None) else "https://git.vdb.to/api/packages/cerc-io/npm/"
default_npm_registry_url = "http://gitea.local:3000/api/packages/cerc-io/npm/" if config(
"CERC_NPM_AUTH_TOKEN", default=None
) else "https://git.vdb.to/api/packages/cerc-io/npm/"
return config("CERC_NPM_REGISTRY_URL", default=default_npm_registry_url)
3 changes: 2 additions & 1 deletion app/build_containers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc
# Copyright © 2022, 2023 Vulcanize

# 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
Expand Down Expand Up @@ -86,6 +86,7 @@ def command(ctx, include, exclude, force_rebuild, extra_build_args):
# TODO: make this configurable
container_build_env = {
"CERC_NPM_REGISTRY_URL": get_npm_registry_url(),
"CERC_GO_AUTH_TOKEN": config("CERC_GO_AUTH_TOKEN", default=""),
"CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default=""),
"CERC_REPO_BASE_DIR": dev_root_path,
"CERC_CONTAINER_BASE_DIR": container_build_dir,
Expand Down
8 changes: 5 additions & 3 deletions app/build_npms.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright © 2022, 2023 Cerc
# Copyright © 2022, 2023 Vulcanize

# 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
Expand Down Expand Up @@ -30,10 +30,12 @@

builder_js_image_name = "cerc/builder-js:local"


@click.command()
@click.option('--include', help="only build these packages")
@click.option('--exclude', help="don\'t build these packages")
@click.option("--force-rebuild", is_flag=True, default=False, help="Override existing target package version check -- force rebuild")
@click.option("--force-rebuild", is_flag=True, default=False,
help="Override existing target package version check -- force rebuild")
@click.option("--extra-build-args", help="Supply extra arguments to build")
@click.pass_context
def command(ctx, include, exclude, force_rebuild, extra_build_args):
Expand Down Expand Up @@ -122,7 +124,7 @@ def build_package(package):
# envs = {"CERC_NPM_AUTH_TOKEN": npm_registry_url_token} | ({"CERC_SCRIPT_DEBUG": "true"} if debug else {})
# but that isn't available in Python 3.8 (default in Ubuntu 20) so for now we use dict.update:
envs = {"CERC_NPM_AUTH_TOKEN": npm_registry_url_token,
"LACONIC_HOSTED_CONFIG_FILE": "config-hosted.yml" # Convention used by our web app packages
"LACONIC_HOSTED_CONFIG_FILE": "config-hosted.yml" # Convention used by our web app packages
}
envs.update({"CERC_SCRIPT_DEBUG": "true"} if debug else {})
envs.update({"CERC_FORCE_REBUILD": "true"} if force_rebuild else {})
Expand Down
27 changes: 27 additions & 0 deletions app/command_types.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Copyright © 2023 Vulcanize

# 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/>.

from dataclasses import dataclass


@dataclass
class CommandOptions:
stack: str
quiet: bool = False
verbose: bool = False
dry_run: bool = False
local_stack: bool = False
debug: bool = False
continue_on_error: bool = False
1 change: 1 addition & 0 deletions app/data/compose/docker-compose-fixturenet-eth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ services:
- fixturenet-eth-bootnode-geth
ports:
- "8545"
- "8546"
- "40000"
- "6060"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ services:
restart: unless-stopped
image: cerc/laconic-console-host:local
environment:
- CERC_WEBAPP_FILES_DIR=${CERC_WEBAPP_FILES_DIR:-/usr/local/share/.config/yarn/global/node_modules/@cerc-io/console-app/dist/production}
- LACONIC_HOSTED_ENDPOINT=${LACONIC_HOSTED_ENDPOINT:-http://localhost}
ports:
- "80"
2 changes: 1 addition & 1 deletion app/data/compose/docker-compose-fixturenet-laconicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ services:
- "6060"
- "26657"
- "26656"
- "9473:9473"
- "9473"
- "8545"
- "8546"
- "9090"
Expand Down
2 changes: 1 addition & 1 deletion app/data/compose/docker-compose-fixturenet-plugeth.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ services:
- SYS_PTRACE
environment:
CERC_REMOTE_DEBUG: ${CERC_REMOTE_DEBUG:-true}
CERC_RUN_STATEDIFF: "detect"
CERC_RUN_STATEDIFF: ${CERC_RUN_STATEDIFF:-detect}
CERC_STATEDIFF_DB_NODE_ID: 1
CERC_SCRIPT_DEBUG: ${CERC_SCRIPT_DEBUG}
env_file:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: '3.2'

services:
# Deploys the sushiswap v3 subgraph
sushiswap-subgraph-v3:
image: cerc/sushiswap-subgraphs:local
restart: on-failure
depends_on:
graph-node:
condition: service_healthy
environment:
- APP=v3
- NETWORK=lotus-fixturenet
command: ["bash", "-c", "./v3/run-v3.sh && ./blocks/run-blocks.sh"]
working_dir: /app/subgraphs
volumes:
- ../config/fixturenet-sushiswap-subgraph-v3/lotus-fixturenet.js.template:/app/config/lotus-fixturenet.js.template
- ../config/fixturenet-sushiswap-subgraph-v3/run-blocks.sh:/app/subgraphs/blocks/run-blocks.sh
- ../config/fixturenet-sushiswap-subgraph-v3/run-v3.sh:/app/subgraphs/v3/run-v3.sh
- sushiswap_core_deployment:/app/subgraphs/v3/core-deployments/docker
- sushiswap_periphery_deployment:/app/subgraphs/v3/periphery-deployments/docker
extra_hosts:
- "host.docker.internal:host-gateway"

volumes:
sushiswap_core_deployment:
sushiswap_periphery_deployment:
39 changes: 39 additions & 0 deletions app/data/compose/docker-compose-go-nitro.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
version: '3.7'

services:
go-nitro:
image: cerc/go-nitro:local
hostname: go-nitro
restart: on-failure
depends_on:
# Wait for Nitro contracts to be deployed
nitro-contracts:
condition: service_completed_successfully
environment:
NITRO_CHAIN_URL: ${NITRO_CHAIN_URL:-ws://fixturenet-eth-geth-1:8546}
NITRO_PK: ${NITRO_PK:-2d999770f7b5d49b694080f987b82bbc9fc9ac2b4dcc10b0f8aba7d700f69c6d}
NITRO_CHAIN_PK: ${NITRO_CHAIN_PK:-570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597}
NITRO_USE_DURABLE_STORE: ${NITRO_USE_DURABLE_STORE:-true}
NITRO_DURABLE_STORE_FOLDER: ${NITRO_DURABLE_STORE_FOLDER:-/app/data/nitro-store}
CERC_NA_ADDRESS: ${CERC_NA_ADDRESS}
CERC_VPA_ADDRESS: ${CERC_VPA_ADDRESS}
CERC_CA_ADDRESS: ${CERC_CA_ADDRESS}
entrypoint: ["bash", "-c", "/app/run-nitro-node.sh"]
volumes:
- go_nitro_data:/app/data
- nitro_deployment:/app/deployment
- ../config/go-nitro/run-nitro-node.sh:/app/run-nitro-node.sh
healthcheck:
test: ["CMD", "nc", "-vz", "localhost", "4005"]
interval: 10s
timeout: 5s
retries: 10
start_period: 10s
ports:
- "3005"
- "4005"
- "5005:5005"

volumes:
go_nitro_data:
nitro_deployment:
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ services:
condition: service_healthy
ipfs:
condition: service_healthy
lotus-node-1:
condition: service_healthy
extra_hosts:
- host.docker.internal:host-gateway
environment:
Expand All @@ -17,9 +15,13 @@ services:
postgres_user: graph-node
postgres_pass: password
postgres_db: graph-node
# TODO: Get endpoint from env
ethereum: 'lotus-fixturenet:http://lotus-node-1:1234/rpc/v1'
GRAPH_LOG: info
ethereum: ${ETH_NETWORKS:-lotus-fixturenet:http://lotus-node-1:1234/rpc/v1}
GRAPH_LOG: debug
ETHEREUM_REORG_THRESHOLD: 3
entrypoint: ["bash", "-c"]
# Wait for ETH RPC endpoint to be up when running with fixturenet-lotus
command: |
"wait_for ${ETH_RPC_HOST:-lotus-node-1}:${ETH_RPC_PORT:-1234} -t 1800 -- start"
ports:
- "8000"
- "8001"
Expand Down
15 changes: 15 additions & 0 deletions app/data/compose/docker-compose-mainnet-eth-api-proxy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: '3.8'

services:
redis:
hostname: mainnet-eth-api-proxy-redis
image: redis:7-alpine
command: redis-server --save "" --appendonly no --maxmemory-policy allkeys-lru --maxmemory 1G

eth-api-proxy:
hostname: mainnet-eth-api-proxy
image: cerc/eth-api-proxy:local
env_file:
- ../config/mainnet-eth-api-proxy/ethpxy.env
ports:
- 8547
51 changes: 51 additions & 0 deletions app/data/compose/docker-compose-mainnet-eth-keycloak.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
version: '3.8'

services:
keycloak-db:
image: postgres:14-alpine
env_file:
- ../config/mainnet-eth-keycloak/keycloak.env
healthcheck:
test: ["CMD", "nc", "-v", "localhost", "5432"]
interval: 30s
timeout: 10s
retries: 10
start_period: 3s
volumes:
- mainnet_eth_keycloak_db:/var/lib/postgresql/data
ports:
- 5432

keycloak:
image: cerc/keycloak:local
env_file:
- ../config/mainnet-eth-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/mainnet-eth-keycloak/import:/import
ports:
- 8080
command: ["start"]
depends_on:
keycloak-db:
condition: service_healthy

keycloak-reg-ui:
image: cerc/keycloak-reg-ui:local
env_file:
- ../config/mainnet-eth-keycloak/keycloak.env
volumes:
- ../config/mainnet-eth-keycloak/ui:/config
ports:
- 80

keycloak-reg-api:
image: cerc/keycloak-reg-api:local
env_file:
- ../config/mainnet-eth-keycloak/keycloak.env
ports:
- 9292

volumes:
mainnet_eth_keycloak_db:
25 changes: 25 additions & 0 deletions app/data/compose/docker-compose-mainnet-eth-metrics.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: "3.2"
services:
prometheus:
restart: always
image: prom/prometheus
depends_on:
mainnet-eth-geth-1:
condition: service_healthy
env_file:
- ../config/mainnet-eth-metrics/metrics.env
volumes:
- ../config/mainnet-eth-metrics/prometheus/etc:/etc/prometheus
ports:
- "9090"
grafana:
restart: always
image: grafana/grafana
env_file:
- ../config/mainnet-eth-metrics/metrics.env
volumes:
- ../config/mainnet-eth-metrics/grafana/etc/provisioning/dashboards:/etc/grafana/provisioning/dashboards
- ../config/mainnet-eth-metrics/grafana/etc/provisioning/datasources:/etc/grafana/provisioning/datasources
- ../config/mainnet-eth-metrics/grafana/etc/dashboards:/etc/grafana/dashboards
ports:
- "3000"
Loading

0 comments on commit b3b57b6

Please sign in to comment.