forked from cerc-io/stack-orchestrator
Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2937a07cd8 | ||
|
|
6ae3c252ea | ||
|
|
178de8f496 | ||
|
|
05cdd2ed01 | ||
|
|
e801c28f60 | ||
|
|
eb70f2526e | ||
|
|
199a4036a8 | ||
|
|
f0b711912a | ||
|
|
d3d3f92953 | ||
|
|
c3101bc25a | ||
|
|
6c49520e69 | ||
|
|
70d34e6751 | ||
|
|
c6de6d6067 | ||
|
|
69b6b9a873 | ||
|
|
430b884d72 |
@@ -5,8 +5,9 @@ services:
|
|||||||
image: cerc/laconicd:local
|
image: cerc/laconicd:local
|
||||||
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
command: ["sh", "/docker-entrypoint-scripts.d/create-fixturenet.sh"]
|
||||||
volumes:
|
volumes:
|
||||||
# TODO: look at folding this script into the container
|
# TODO: look at folding these scripts into the container
|
||||||
- ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
- ../config/fixturenet-laconicd/create-fixturenet.sh:/docker-entrypoint-scripts.d/create-fixturenet.sh
|
||||||
|
- ../config/fixturenet-laconicd/export-mykey.sh:/docker-entrypoint-scripts.d/export-mykey.sh
|
||||||
# TODO: determine which of the ports below is really needed
|
# TODO: determine which of the ports below is really needed
|
||||||
ports:
|
ports:
|
||||||
- "6060"
|
- "6060"
|
||||||
@@ -18,4 +19,7 @@ services:
|
|||||||
- "9090"
|
- "9090"
|
||||||
- "9091"
|
- "9091"
|
||||||
- "1317"
|
- "1317"
|
||||||
|
cli:
|
||||||
|
image: cerc/laconic-registry-cli:local
|
||||||
|
volumes:
|
||||||
|
- ../config/fixturenet-laconicd/registry-cli-config-template.yml:/registry-cli-config-template.yml
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# Add-on pod to include foundry tooling within a fixturenet
|
||||||
|
services:
|
||||||
|
foundry:
|
||||||
|
image: ghcr.io/foundry-rs/foundry:latest
|
||||||
|
command: ["while :; do sleep 600; done"]
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
echo y | laconicd keys export mykey --unarmored-hex --unsafe
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
services:
|
||||||
|
cns:
|
||||||
|
restEndpoint: 'http://laconicd:1317'
|
||||||
|
gqlEndpoint: 'http://laconicd:9473/api'
|
||||||
|
userKey: REPLACE_WITH_MYKEY
|
||||||
|
bondId:
|
||||||
|
chainId: laconic_9000-1
|
||||||
@@ -48,10 +48,13 @@ RUN npm config set @lirewine:registry ${CERC_NPM_URL} \
|
|||||||
# TODO: the image at this point could be made a base image for several different CLI images
|
# TODO: the image at this point could be made a base image for several different CLI images
|
||||||
# that install different Node-based CLI commands
|
# that install different Node-based CLI commands
|
||||||
|
|
||||||
# DEBUG, remove
|
|
||||||
RUN yarn info @cerc-io/laconic-registry-cli
|
|
||||||
|
|
||||||
# Globally install the cli package
|
# Globally install the cli package
|
||||||
RUN yarn global add @cerc-io/laconic-registry-cli
|
RUN yarn global add @cerc-io/laconic-registry-cli
|
||||||
|
|
||||||
ENTRYPOINT ["laconic"]
|
# Add scripts
|
||||||
|
RUN mkdir /scripts
|
||||||
|
ENV PATH="${PATH}:/scripts"
|
||||||
|
COPY ./import-key.sh /scripts
|
||||||
|
|
||||||
|
# Default command sleeps forever so docker doesn't kill it
|
||||||
|
CMD ["sh", "-c", "while :; do sleep 600; done"]
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
sed 's/REPLACE_WITH_MYKEY/'${1}'/' registry-cli-config-template.yml > config.yml
|
||||||
@@ -19,3 +19,4 @@ eth-probe
|
|||||||
keycloak
|
keycloak
|
||||||
tx-spammer
|
tx-spammer
|
||||||
kubo
|
kubo
|
||||||
|
foundry
|
||||||
|
|||||||
@@ -1,98 +0,0 @@
|
|||||||
# fixturenet-eth
|
|
||||||
|
|
||||||
Instructions for deploying a local a geth + lighthouse blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator (the installation of which is covered [here](https://github.com/cerc-io/stack-orchestrator#user-mode)):
|
|
||||||
|
|
||||||
## Clone required repositories
|
|
||||||
```
|
|
||||||
$ laconic-so --stack fixturenet-eth setup-repositories
|
|
||||||
```
|
|
||||||
|
|
||||||
## Build the fixturenet-eth containers
|
|
||||||
```
|
|
||||||
$ laconic-so --stack fixturenet-eth build-containers
|
|
||||||
```
|
|
||||||
This should create several container images in the local image registry:
|
|
||||||
|
|
||||||
* cerc/go-ethereum
|
|
||||||
* cerc/lighthouse
|
|
||||||
* cerc/fixturenet-eth-geth
|
|
||||||
* cerc/fixturenet-eth-lighthouse
|
|
||||||
|
|
||||||
## Deploy the stack
|
|
||||||
```
|
|
||||||
$ laconic-so --stack fixturenet-eth deploy-system up
|
|
||||||
```
|
|
||||||
|
|
||||||
## Check status
|
|
||||||
|
|
||||||
```
|
|
||||||
$ container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh
|
|
||||||
Waiting for geth to generate DAG ..................................................... DONE!
|
|
||||||
Waiting for beacon phase0 .... DONE!
|
|
||||||
Waiting for beacon altair .... DONE!
|
|
||||||
Waiting for beacon bellatrix pre-merge .... DONE!
|
|
||||||
Waiting for beacon bellatrix merge .... DONE!
|
|
||||||
|
|
||||||
$ docker ps -f 'name=laconic' --format 'table {{.Names}}\t{{.Ports}}' | cut -d'-' -f3- | sort
|
|
||||||
NAMES PORTS
|
|
||||||
fixturenet-eth-bootnode-geth-1 8545-8546/tcp, 30303/udp, 0.0.0.0:55847->9898/tcp, 0.0.0.0:55848->30303/tcp
|
|
||||||
fixturenet-eth-bootnode-lighthouse-1
|
|
||||||
fixturenet-eth-geth-1-1 8546/tcp, 30303/tcp, 30303/udp, 0.0.0.0:55851->8545/tcp
|
|
||||||
fixturenet-eth-geth-2-1 8545-8546/tcp, 30303/tcp, 30303/udp
|
|
||||||
fixturenet-eth-lighthouse-1-1 0.0.0.0:55858->8001/tcp
|
|
||||||
fixturenet-eth-lighthouse-2-1
|
|
||||||
```
|
|
||||||
|
|
||||||
## Additional pieces
|
|
||||||
|
|
||||||
Several other containers can used with the basic `fixturenet-eth`:
|
|
||||||
|
|
||||||
* `ipld-eth-db` (enables statediffing)
|
|
||||||
* `ipld-eth-server` (GQL and Ethereum API server, requires `ipld-eth-db`)
|
|
||||||
* `ipld-eth-beacon-db` and `ipld-eth-beacon-indexer` (for indexing Beacon chain blocks)
|
|
||||||
* `eth-probe` (captures eth1 tx gossip)
|
|
||||||
* `keycloak` (nginx proxy with keycloak auth for API authentication)
|
|
||||||
* `tx-spammer` (generates and sends automated transactions to the fixturenet)
|
|
||||||
|
|
||||||
It is not necessary to use them all at once, but a complete example follows:
|
|
||||||
|
|
||||||
```
|
|
||||||
# Setup
|
|
||||||
$ laconic-so setup-repositories --include cerc-io/go-ethereum,cerc-io/ipld-eth-db,cerc-io/ipld-eth-server,cerc-io/ipld-eth-beacon-db,cerc-io/ipld-eth-beacon-indexer,cerc-io/eth-probe,cerc-io/tx-spammer
|
|
||||||
|
|
||||||
# Build
|
|
||||||
$ laconic-so build-containers --include cerc/go-ethereum,cerc/lighthouse,cerc/fixturenet-eth-geth,cerc/fixturenet-eth-lighthouse,cerc/ipld-eth-db,cerc/ipld-eth-server,cerc/ipld-eth-beacon-db,cerc/ipld-eth-beacon-indexer,cerc/eth-probe,cerc/keycloak,cerc/tx-spammer
|
|
||||||
|
|
||||||
# Deploy
|
|
||||||
$ laconic-so deploy-system --include db,fixturenet-eth,ipld-eth-server,ipld-eth-beacon-db,ipld-eth-beacon-indexer,eth-probe,keycloak,tx-spammer up
|
|
||||||
|
|
||||||
# Status
|
|
||||||
|
|
||||||
$ container-build/cerc-fixturenet-eth-lighthouse/scripts/status.sh
|
|
||||||
Waiting for geth to generate DAG.... DONE!
|
|
||||||
Waiting for beacon phase0.... DONE!
|
|
||||||
Waiting for beacon altair.... DONE!
|
|
||||||
Waiting for beacon bellatrix pre-merge.... DONE!
|
|
||||||
Waiting for beacon bellatrix merge.... DONE!
|
|
||||||
|
|
||||||
$ docker ps -f 'name=laconic' --format 'table {{.Names}}\t{{.Ports}}' | cut -d'-' -f3- | sort
|
|
||||||
NAMES PORTS
|
|
||||||
eth-probe-db-1 0.0.0.0:55849->5432/tcp
|
|
||||||
eth-probe-mq-1
|
|
||||||
eth-probe-probe-1
|
|
||||||
fixturenet-eth-bootnode-geth-1 8545-8546/tcp, 30303/udp, 0.0.0.0:55847->9898/tcp, 0.0.0.0:55848->30303/tcp
|
|
||||||
fixturenet-eth-bootnode-lighthouse-1
|
|
||||||
fixturenet-eth-geth-1-1 8546/tcp, 30303/tcp, 30303/udp, 0.0.0.0:55851->8545/tcp
|
|
||||||
fixturenet-eth-geth-2-1 8545-8546/tcp, 30303/tcp, 30303/udp
|
|
||||||
fixturenet-eth-lighthouse-1-1 0.0.0.0:55858->8001/tcp
|
|
||||||
fixturenet-eth-lighthouse-2-1
|
|
||||||
ipld-eth-beacon-db-1 127.0.0.1:8076->5432/tcp
|
|
||||||
ipld-eth-beacon-indexer-1
|
|
||||||
ipld-eth-db-1 127.0.0.1:8077->5432/tcp
|
|
||||||
ipld-eth-server-1 127.0.0.1:8081-8082->8081-8082/tcp
|
|
||||||
keycloak-1 8443/tcp, 0.0.0.0:55857->8080/tcp
|
|
||||||
keycloak-db-1 0.0.0.0:55850->5432/tcp
|
|
||||||
keycloak-nginx-1 0.0.0.0:55859->80/tcp
|
|
||||||
migrations-1
|
|
||||||
tx-spammer-1
|
|
||||||
```
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
version: "1.0"
|
|
||||||
name: fixturenet-eth-statediff
|
|
||||||
decription: "Loaded Ethereum Fixturenet"
|
|
||||||
repos:
|
|
||||||
- cerc-io/go-ethereum
|
|
||||||
- cerc-io/tx-spammer
|
|
||||||
- cerc-io/ipld-eth-db
|
|
||||||
containers:
|
|
||||||
- cerc/lighthouse
|
|
||||||
- cerc/fixturenet-eth-geth
|
|
||||||
- cerc/fixturenet-eth-lighthouse
|
|
||||||
- cerc/ipld-eth-db
|
|
||||||
- cerc/tx-spammer
|
|
||||||
pods:
|
|
||||||
- fixturenet-eth
|
|
||||||
- tx-spammer
|
|
||||||
- ipld-eth-db
|
|
||||||
@@ -11,3 +11,4 @@ containers:
|
|||||||
- cerc/fixturenet-eth-lighthouse
|
- cerc/fixturenet-eth-lighthouse
|
||||||
pods:
|
pods:
|
||||||
- fixturenet-eth
|
- fixturenet-eth
|
||||||
|
- foundry
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
# This file should be re-generated running: scripts/update-version-file.sh script
|
# This file should be re-generated running: scripts/update-version-file.sh script
|
||||||
v1.0.21-c52f9e6
|
v1.0.22-4fdb442
|
||||||
|
|||||||
+20
-9
@@ -56,10 +56,11 @@ def command(ctx, include, exclude, cluster, command, extra_args):
|
|||||||
|
|
||||||
if not dry_run:
|
if not dry_run:
|
||||||
if command == "up":
|
if command == "up":
|
||||||
if debug:
|
container_exec_env = _make_runtime_env(ctx.obj)
|
||||||
os.environ["CERC_SCRIPT_DEBUG"] = "true"
|
for attr, value in container_exec_env.items():
|
||||||
|
os.environ[attr] = value
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Running compose up for extra_args: {extra_args_list}")
|
print(f"Running compose up with container_exec_env: {container_exec_env}, extra_args: {extra_args_list}")
|
||||||
for pre_start_command in cluster_context.pre_start_commands:
|
for pre_start_command in cluster_context.pre_start_commands:
|
||||||
_run_command(ctx.obj, cluster_context.cluster, pre_start_command)
|
_run_command(ctx.obj, cluster_context.cluster, pre_start_command)
|
||||||
docker.compose.up(detach=True, services=extra_args_list)
|
docker.compose.up(detach=True, services=extra_args_list)
|
||||||
@@ -74,10 +75,8 @@ def command(ctx, include, exclude, cluster, command, extra_args):
|
|||||||
print("Usage: exec <service> <cmd>")
|
print("Usage: exec <service> <cmd>")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
service_name = extra_args_list[0]
|
service_name = extra_args_list[0]
|
||||||
command_to_exec = extra_args_list[1:]
|
command_to_exec = ["sh", "-c"] + extra_args_list[1:]
|
||||||
container_exec_env = {
|
container_exec_env = _make_runtime_env(ctx.obj)
|
||||||
"CERC_SCRIPT_DEBUG": "true"
|
|
||||||
} if debug else {}
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f"Running compose exec {service_name} {command_to_exec}")
|
print(f"Running compose exec {service_name} {command_to_exec}")
|
||||||
docker.compose.execute(service_name, command_to_exec, envs=container_exec_env)
|
docker.compose.execute(service_name, command_to_exec, envs=container_exec_env)
|
||||||
@@ -139,6 +138,15 @@ def get_stack_status(ctx, stack):
|
|||||||
False
|
False
|
||||||
|
|
||||||
|
|
||||||
|
def _make_runtime_env(ctx):
|
||||||
|
container_exec_env = {
|
||||||
|
"CERC_HOST_UID": f"{os.getuid()}",
|
||||||
|
"CERC_HOST_GID": f"{os.getgid()}"
|
||||||
|
}
|
||||||
|
container_exec_env.update({"CERC_SCRIPT_DEBUG": "true"} if ctx.debug else {})
|
||||||
|
return container_exec_env
|
||||||
|
|
||||||
|
|
||||||
def _make_cluster_context(ctx, include, exclude, cluster):
|
def _make_cluster_context(ctx, include, exclude, cluster):
|
||||||
|
|
||||||
if ctx.local_stack:
|
if ctx.local_stack:
|
||||||
@@ -151,10 +159,13 @@ def _make_cluster_context(ctx, include, exclude, cluster):
|
|||||||
compose_dir = Path(__file__).absolute().parent.joinpath("data", "compose")
|
compose_dir = Path(__file__).absolute().parent.joinpath("data", "compose")
|
||||||
|
|
||||||
if cluster is None:
|
if cluster is None:
|
||||||
# Create default unique, stable cluster name from confile file path
|
# Create default unique, stable cluster name from confile file path and stack name if provided
|
||||||
# TODO: change this to the config file path
|
# TODO: change this to the config file path
|
||||||
path = os.path.realpath(sys.argv[0])
|
path = os.path.realpath(sys.argv[0])
|
||||||
hash = hashlib.md5(path.encode()).hexdigest()
|
unique_cluster_descriptor = f"{path},{ctx.stack},{include},{exclude}"
|
||||||
|
if ctx.debug:
|
||||||
|
print(f"pre-hash descriptor: {unique_cluster_descriptor}")
|
||||||
|
hash = hashlib.md5(unique_cluster_descriptor.encode()).hexdigest()
|
||||||
cluster = f"laconic-{hash}"
|
cluster = f"laconic-{hash}"
|
||||||
if ctx.verbose:
|
if ctx.verbose:
|
||||||
print(f"Using cluster name: {cluster}")
|
print(f"Using cluster name: {cluster}")
|
||||||
|
|||||||
@@ -55,5 +55,6 @@ def cli(ctx, stack, quiet, verbose, dry_run, local_stack, debug, continue_on_err
|
|||||||
cli.add_command(setup_repositories.command, "setup-repositories")
|
cli.add_command(setup_repositories.command, "setup-repositories")
|
||||||
cli.add_command(build_containers.command, "build-containers")
|
cli.add_command(build_containers.command, "build-containers")
|
||||||
cli.add_command(build_npms.command, "build-npms")
|
cli.add_command(build_npms.command, "build-npms")
|
||||||
|
cli.add_command(deploy_system.command, "deploy") # deploy is an alias for deploy-system
|
||||||
cli.add_command(deploy_system.command, "deploy-system")
|
cli.add_command(deploy_system.command, "deploy-system")
|
||||||
cli.add_command(version.command, "version")
|
cli.add_command(version.command, "version")
|
||||||
|
|||||||
Reference in New Issue
Block a user