Merge main
This commit is contained in:
commit
6e23398484
@ -16,6 +16,7 @@
|
||||
import os
|
||||
from abc import ABC, abstractmethod
|
||||
from .deploy import get_stack_status
|
||||
from decouple import config
|
||||
|
||||
|
||||
def get_stack(config, stack):
|
||||
@ -69,3 +70,10 @@ class package_registry_stack(base_stack):
|
||||
|
||||
def get_url(self):
|
||||
return self.url
|
||||
|
||||
|
||||
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/"
|
||||
return config("CERC_NPM_REGISTRY_URL", default=default_npm_registry_url)
|
||||
|
@ -28,6 +28,7 @@ import click
|
||||
import importlib.resources
|
||||
from pathlib import Path
|
||||
from .util import include_exclude_check, get_parsed_stack_config
|
||||
from .base import get_npm_registry_url
|
||||
|
||||
# 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)"
|
||||
@ -84,7 +85,7 @@ def command(ctx, include, exclude, force_rebuild, extra_build_args):
|
||||
|
||||
# TODO: make this configurable
|
||||
container_build_env = {
|
||||
"CERC_NPM_REGISTRY_URL": config("CERC_NPM_REGISTRY_URL", default="http://gitea.local:3000/api/packages/cerc-io/npm/"),
|
||||
"CERC_NPM_REGISTRY_URL": get_npm_registry_url(),
|
||||
"CERC_NPM_AUTH_TOKEN": config("CERC_NPM_AUTH_TOKEN", default=""),
|
||||
"CERC_REPO_BASE_DIR": dev_root_path,
|
||||
"CERC_CONTAINER_BASE_DIR": container_build_dir,
|
||||
|
17
app/data/compose/docker-compose-mainnet-go-opera.yml
Normal file
17
app/data/compose/docker-compose-mainnet-go-opera.yml
Normal file
@ -0,0 +1,17 @@
|
||||
version: "3.8"
|
||||
|
||||
services:
|
||||
go-opera:
|
||||
restart: unless-stopped
|
||||
image: cerc/go-opera:local
|
||||
entrypoint: ["sh", "/docker-entrypoint-scripts.d/start-node.sh"]
|
||||
volumes:
|
||||
- ../config/mainnet-go-opera/start-node.sh:/docker-entrypoint-scripts.d/start-node.sh
|
||||
# TODO: ports taken from dockerfile, determine which are needed
|
||||
ports:
|
||||
- "5050:5050" # p2p port, needed
|
||||
- "5050:5050/udp"
|
||||
- "18545:18545" # http rpc port
|
||||
- "18546:18546" # websockets rpc port
|
||||
#- "18547" # unknown
|
||||
#- "19090" # unknown
|
1
app/data/config/mainnet-go-opera/go-opera.env
Normal file
1
app/data/config/mainnet-go-opera/go-opera.env
Normal file
@ -0,0 +1 @@
|
||||
|
7
app/data/config/mainnet-go-opera/start-node.sh
Normal file
7
app/data/config/mainnet-go-opera/start-node.sh
Normal file
@ -0,0 +1,7 @@
|
||||
#!/bin/bash
|
||||
|
||||
# download genesis file
|
||||
wget https://download.fantom.network/mainnet-109331-no-history.g
|
||||
|
||||
./opera --genesis=mainnet-109331-no-history.g --db.preset ldb-1 --syncmode snap --http --http.addr="0.0.0.0" --http.corsdomain="*" --http.api=eth,web3,net,txpool,ftm --ws --ws.addr="0.0.0.0" --ws.origins="*" --ws.api=eth,web3,net,txpool,ftm --cache 8192
|
||||
#tail -f /dev/null
|
12
app/data/container-build/cerc-go-opera/build.sh
Executable file
12
app/data/container-build/cerc-go-opera/build.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
# Build cerc/go-opera
|
||||
source ${CERC_CONTAINER_BASE_DIR}/build-base.sh
|
||||
|
||||
# Checkout appropriate release; refer to https://docs.fantom.foundation/
|
||||
OPERA_TAG=${OPERA_TAG:-release/1.1.2-rc.5}
|
||||
git -C ${CERC_REPO_BASE_DIR}/go-opera checkout ${OPERA_TAG}
|
||||
|
||||
# Repo's dockerfile gives build error because it's hardcoded for go 1.17; go 1.19 is required
|
||||
sed -i 's/FROM golang:1\.[0-9]*-alpine as builder/FROM golang:1.19-alpine as builder/' ${CERC_REPO_BASE_DIR}/go-opera/docker/Dockerfile.opera
|
||||
|
||||
docker build -f ${CERC_REPO_BASE_DIR}/go-opera/docker/Dockerfile.opera -t cerc/go-opera:local ${build_command_args} ${CERC_REPO_BASE_DIR}/go-opera
|
@ -41,3 +41,4 @@ cerc/watcher-azimuth
|
||||
cerc/ipld-eth-state-snapshot
|
||||
cerc/watcher-gelato
|
||||
cerc/lotus
|
||||
cerc/go-opera
|
||||
|
@ -27,3 +27,4 @@ fixturenet-pocket
|
||||
watcher-azimuth
|
||||
watcher-gelato
|
||||
fixturenet-lotus
|
||||
mainnet-go-opera
|
||||
|
@ -34,3 +34,4 @@ github.com/cerc-io/ipld-eth-state-snapshot
|
||||
github.com/cerc-io/gelato-watcher-ts
|
||||
github.com/filecoin-project/lotus
|
||||
git.vdb.to/cerc-io/test-project
|
||||
github.com/Fantom-foundation/go-opera
|
||||
|
88
app/data/stacks/mainnet-go-opera/README.md
Normal file
88
app/data/stacks/mainnet-go-opera/README.md
Normal file
@ -0,0 +1,88 @@
|
||||
# Opera (Fantom)
|
||||
|
||||
Deploy a Fantom API node.
|
||||
|
||||
## Clone required repositories
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera setup-repositories
|
||||
```
|
||||
|
||||
## Build the fixturenet-eth containers
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera build-containers
|
||||
```
|
||||
|
||||
## Deploy the stack
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera deploy up
|
||||
```
|
||||
|
||||
## Check logs
|
||||
|
||||
```
|
||||
$ laconic-so --stack mainnet-go-opera deploy logs
|
||||
```
|
||||
|
||||
You'll see something like:
|
||||
|
||||
```
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | Connecting to download.fantom.network (65.108.45.88:443)
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | saving to 'mainnet-109331-no-history.g'
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | mainnet-109331-no-hi 100% |********************************| 16326 0:00:00 ETA
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | 'mainnet-109331-no-history.g' saved
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.034] Maximum peer count total=50
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.034] Smartcard socket not found, disabling err="stat /run/pcscd/pcscd.comm: no such file or directory"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.034] Genesis file is a known preset name="Mainnet-109331 without history"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.052] Applying genesis state
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.052] - Reading epochs unit 0
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.054] - Reading blocks unit 0
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.530] Applied genesis state name=main id=250 genesis=0x4a53c5445584b3bfc20dbfb2ec18ae20037c716f3ba2d9e1da768a9deca17cb4
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.531] Regenerated local transaction journal transactions=0 accounts=0
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.532] Starting peer-to-peer node instance=go-opera/v1.1.2-rc.5-50cd051d-1677276206/linux-amd64/go1.19.10
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.536] New local node record seq=1 id=5e40f984908317cd ip=127.0.0.1 udp=5050 tcp=5050
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.537] Started P2P networking self=enode://3ffb15988ca5a79b63dbe48be89d9d8b48dc4845d318fe08231a0ab49d3b23476e2561044311dc257405f882f7c52ff7b128c8bd1b6d85cf7205a6fed6555443@127.0.0.1:5050
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.537] IPC endpoint opened url=/root/.opera/opera.ipc
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] HTTP server started endpoint=[::]:18545 prefix= cors=* vhosts=localhost
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] WebSocket enabled url=ws://[::]:18546
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] Rebuilding state snapshot
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] EVM snapshot module=gossip-store at=000000..000000 generating=true
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] Resuming state snapshot generation accounts=0 slots=0 storage=0.00B elapsed="189.74µs"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:33.538] Generated state snapshot accounts=0 slots=0 storage=0.00B elapsed="265.061µs"
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:34.788] New LLR summary last_epoch=0 last_block=37676611 new_evs=0 new_ers=0 new_bvs=64 new_brs=0 age=none
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:35.040] New local node record seq=2 id=5e40f984908317cd ip=186.233.184.56 udp=5050 tcp=5050
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:42.788] New LLR summary last_epoch=114604 last_block=37753891 new_evs=24581 new_ers=5272 new_bvs=233257 new_brs=780 age=1y1mo5d
|
||||
laconic-f028f14527b95e2eb97f0c0229d00939-go-opera-1 | INFO [06-20|13:32:50.827] New LLR summary last_epoch=115574 last_block=38118749 new_evs=4907 new_ers=971 new_bvs=1098760 new_brs=3768 age=1y1mo2d
|
||||
```
|
||||
|
||||
Consecutive lines of "New LLR summary" shows that your node is sync'ing.
|
||||
|
||||
## Use the opera admin console
|
||||
|
||||
```
|
||||
$ docker exec -it $(docker ps -q --filter "name=go-opera") /bin/sh
|
||||
```
|
||||
|
||||
then:
|
||||
|
||||
```
|
||||
$ ./opera attach
|
||||
```
|
||||
|
||||
and check the node info:
|
||||
|
||||
```
|
||||
> admin.nodeInfo
|
||||
```
|
||||
|
||||
Run `exit` twice to return to your terminal.
|
||||
|
||||
## Clean up
|
||||
|
||||
Stop all services running in the background:
|
||||
|
||||
```bash
|
||||
$ laconic-so --stack mainnet-go-opera deploy down
|
||||
```
|
9
app/data/stacks/mainnet-go-opera/stack.yml
Normal file
9
app/data/stacks/mainnet-go-opera/stack.yml
Normal file
@ -0,0 +1,9 @@
|
||||
version: "1.1"
|
||||
name: mainnet-opera
|
||||
decription: "Fantom mainnet node"
|
||||
repos:
|
||||
- github.com/Fantom-foundation/go-opera
|
||||
containers:
|
||||
- cerc/go-opera
|
||||
pods:
|
||||
- mainnet-go-opera
|
44
scripts/cloud-init-dev-mode-install.yaml
Normal file
44
scripts/cloud-init-dev-mode-install.yaml
Normal file
@ -0,0 +1,44 @@
|
||||
#cloud-config
|
||||
|
||||
# Used for easily testing stacks-in-development on cloud platforms
|
||||
# Assumes Ubuntu, edit the last line if targeting a different OS
|
||||
|
||||
# Once SSH'd into the server, run:
|
||||
# `$ cd stack-orchestrator`
|
||||
# `$ git checkout <branch>
|
||||
# `$ ./scripts/developer-mode-setup.sh`
|
||||
# `$ source ./venv/bin/activate`
|
||||
|
||||
# Followed by the stack instructions.
|
||||
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
|
||||
groups:
|
||||
- docker
|
||||
|
||||
system_info:
|
||||
default_user:
|
||||
groups: [ docker ]
|
||||
|
||||
packages:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- curl
|
||||
- jq
|
||||
- git
|
||||
- gnupg
|
||||
- lsb-release
|
||||
- unattended-upgrades
|
||||
- python3.10-venv
|
||||
- pip
|
||||
|
||||
runcmd:
|
||||
- mkdir -p /etc/apt/keyrings
|
||||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
- apt-get update
|
||||
- apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
- systemctl enable docker
|
||||
- systemctl start docker
|
||||
- git clone https://github.com/cerc-io/stack-orchestrator.git /home/ubuntu/stack-orchestrator
|
35
scripts/cloud-init-user-mode-install.yaml
Normal file
35
scripts/cloud-init-user-mode-install.yaml
Normal file
@ -0,0 +1,35 @@
|
||||
#cloud-config
|
||||
|
||||
# Used for installing Stack Orchestrator on platforms that support `cloud-init`
|
||||
# Tested on Ubuntu
|
||||
|
||||
package_update: true
|
||||
package_upgrade: true
|
||||
|
||||
groups:
|
||||
- docker
|
||||
|
||||
system_info:
|
||||
default_user:
|
||||
groups: [ docker ]
|
||||
|
||||
packages:
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
- curl
|
||||
- jq
|
||||
- git
|
||||
- gnupg
|
||||
- lsb-release
|
||||
- unattended-upgrades
|
||||
|
||||
runcmd:
|
||||
- mkdir -p /etc/apt/keyrings
|
||||
- curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg
|
||||
- echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
- apt-get update
|
||||
- apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||
- systemctl enable docker
|
||||
- systemctl start docker
|
||||
- curl -L -o /usr/local/bin/laconic-so https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so
|
||||
- chmod +x /usr/local/bin/laconic-so
|
Loading…
Reference in New Issue
Block a user