Compare commits

..
15 Commits
Author SHA1 Message Date
dboreham e29ae7ac93 Merge pull request #210 from cerc-io/dboreham/laconicd-stack-doc
Update fixturenet-laconicd docs

Former-commit-id: 75376d7baf
2023-03-07 16:05:21 -07:00
dboreham edd7d549d9 Update fixturenet-laconicd docs
Former-commit-id: 89b33c0e38
2023-03-07 16:04:43 -07:00
dboreham 4092a127ef Merge pull request #208 from cerc-io/dboreham/implement-logs-command
Implement logs command

Former-commit-id: ba5cc68794
2023-03-07 11:58:41 -07:00
dboreham fae8fbed5e Implement logs command
Former-commit-id: b488d82b8f
2023-03-07 11:57:24 -07:00
dboreham a900945698 Update version
Former-commit-id: f97b1e4720
2023-03-07 10:14:20 -07:00
dboreham 2937a07cd8 Merge pull request #207 from cerc-io/dboreham/run-cli-in-cluster
Run laconic registry cli in cluster

Former-commit-id: d80fb5dd16
2023-03-07 10:10:26 -07:00
dboreham 6ae3c252ea Very basic key export/import implementation
Former-commit-id: 8a8fef6845
2023-03-07 10:08:04 -07:00
dboreham 178de8f496 Add simple export/import scheme
Former-commit-id: 277be07dcd
2023-03-07 09:07:15 -07:00
dboreham 05cdd2ed01 Merge pull request #205 from cerc-io/dboreham/eth-tooling
Add foundry cli to fixturenet-eth

Former-commit-id: 99fcdf9d40
2023-03-06 15:20:07 -07:00
dboreham e801c28f60 Add foundry cli to fixturenet-eth
Former-commit-id: b43886a1a9
2023-03-06 15:19:19 -07:00
dboreham eb70f2526e Initial commit
Former-commit-id: 49c524e8ed
2023-03-04 18:45:57 -07:00
dboreham 199a4036a8 Merge pull request #203 from cerc-io/dboreham/pass-uid-to-compose-up
Pass environment variables for both exec and up

Former-commit-id: f7285be425
2023-03-02 10:56:53 -07:00
dboreham f0b711912a Pass environment variables for both exec and up
Former-commit-id: be6a473772
2023-03-02 10:53:48 -07:00
dboreham d3d3f92953 Merge pull request #202 from cerc-io/dboreham/remove-debug-output
Remove debug output

Former-commit-id: c0b4cefdce
2023-03-02 10:35:26 -07:00
dboreham c3101bc25a Remove debug output
Former-commit-id: f99dbfbdf5
2023-03-02 10:32:18 -07:00
13 changed files with 104 additions and 30 deletions
@@ -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
+1
View File
@@ -19,3 +19,4 @@ eth-probe
keycloak keycloak
tx-spammer tx-spammer
kubo kubo
foundry
+9 -4
View File
@@ -11,20 +11,25 @@ To use a user-supplied registry set these environment variables:
Leave `CERC_NPM_REGISTRY_URL` un-set to use the local gitea registry. Leave `CERC_NPM_REGISTRY_URL` un-set to use the local gitea registry.
### Build support containers ### 1. Build support containers
``` ```
$ laconic-so --stack build-support build-containers $ laconic-so --stack build-support build-containers
``` ```
### Deploy Gitea Package Registry Note that the scheme/gerbil builder container can take a while to build so if you aren't going to build scheme projects it can be skipped with:
```
$ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
```
### 2. Deploy Gitea Package Registry
``` ```
$ laconic-so --stack package-registry setup-repositories $ laconic-so --stack package-registry setup-repositories
$ laconic-so --stack package-registry deploy-system up $ laconic-so --stack package-registry deploy up
This is your gitea access token: 84fe66a73698bf11edbdccd0a338236b7d1d5c45. Keep it safe and secure, it can not be fetched again from gitea. This is your gitea access token: 84fe66a73698bf11edbdccd0a338236b7d1d5c45. Keep it safe and secure, it can not be fetched again from gitea.
$ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
``` ```
Now npm packages can be built: Now npm packages can be built:
### Build npm Packages ### Build npm Packages
Ensure that `CERC_NPM_AUTH_TOKEN` is set with the token printed above when the package-registry stack was deployed (the actual token value will be different than shown in this example):
``` ```
$ export CERC_NPM_AUTH_TOKEN=84fe66a73698bf11edbdccd0a338236b7d1d5c45
$ laconic-so build-npms --include laconic-sdk $ laconic-so build-npms --include laconic-sdk
``` ```
+1
View File
@@ -11,3 +11,4 @@ containers:
- cerc/fixturenet-eth-lighthouse - cerc/fixturenet-eth-lighthouse
pods: pods:
- fixturenet-eth - fixturenet-eth
- foundry
+41 -9
View File
@@ -1,18 +1,50 @@
# Laconicd Fixturenet # Laconicd Fixturenet
Instructions for deploying a local Laconic 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)): Instructions for deploying a local Laconic blockchain "fixturenet" for development and testing purposes using laconic-stack-orchestrator.
## Clone required repositories ## 1. Install Laconic Stack Orchestrator
Installation is covered in detail [here](https://github.com/cerc-io/stack-orchestrator#user-mode) but if you're on Linux and already have docker installed it should be as simple as:
``` ```
$ laconic-so setup-repositories --include cerc-io/laconicd,cerc-io/laconic-sdk,cerc-io/laconic-registry-cli $ mkdir my-working-dir
$ cd my-working-dir
$ curl -L -o ./laconic-so https://github.com/cerc-io/stack-orchestrator/releases/latest/download/laconic-so
$ chmod +x ./laconic-so
$ export PATH=$PATH:$(pwd) # Or move laconic-so to ~/bin or your favorite on-path directory
``` ```
## Build the laconicd container ## 2. Prepare the local build environment
Note that this step needs only to be done once on a new machine.
Detailed instructions can be found [here](../build-support/README.md). For the impatient run these commands:
``` ```
$ laconic-so build-containers --include cerc/laconicd $ laconic-so --stack build-support build-containers --exclude cerc/builder-gerbil
$ laconic-so --stack package-registry setup-repositories
$ laconic-so --stack package-registry deploy-system up
``` ```
This should create a container with tag `cerc/laconicd` in the local image registry. Then add the localhost alias `gitea.local` and set `CERC_NPM_AUTH_TOKEN` to the token printed when the package-registry stack was deployed above:
## Deploy the stack
``` ```
$ laconic-so deploy-system --include fixturenet-laconicd up $ sudo vi /etc/hosts
$ export CERC_NPM_AUTH_TOKEN=<my-token>
```
## 3. Clone required repositories
```
$ laconic-so --stack fixturenet-laconicd setup-repositories
```
## 4. Build the stack's packages and containers
```
$ laconic-so --stack fixturenet-laconicd build-npms
$ laconic-so --stack fixturenet-laconicd build-containers
```
## 5. Deploy the stack
```
$ laconic-so --stack fixturenet-laconicd deploy up
```
Correct operation should be verified by checking the laconicd container's logs with:
```
$ laconic-so --stack fixturenet-laconicd deploy logs
```
## 6. Test with the Registry CLI
```
$ laconic-so --stack fixturenet-laconicd deploy exec laconicd "sh /docker-entrypoint-scripts.d/export-mykey.sh"
$ laconic-so --stack fixturenet-laconicd deploy exec cli "sh /scripts/import-key.sh xxxxxxxxxxxxxxxxxxxxxxx"
$ laconic-so --stack fixturenet-laconicd deploy exec cli "laconic cns status"
``` ```
Correct operation should be verified by checking the laconicd container's log.
@@ -0,0 +1,5 @@
# Package Registry Stack
The Package Registry Stack supports a build environment that requires a package registry (initially for NPM packages only).
Setup instructions can be found [here](../build-support/README.md).
+1 -1
View File
@@ -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.22-4fdb442 v1.0.24-d80fb5d
+17 -10
View File
@@ -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,12 +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_HOST_UID": f"{os.getuid()}",
"CERC_HOST_GID": f"{os.getgid()}"
}
container_exec_env.update({"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)
@@ -117,7 +114,8 @@ def command(ctx, include, exclude, cluster, command, extra_args):
elif command == "logs": elif command == "logs":
if verbose: if verbose:
print("Running compose logs") print("Running compose logs")
docker.compose.logs() logs_output = docker.compose.logs(services=extra_args_list if extra_args_list != None else [])
print(logs_output)
def get_stack_status(ctx, stack): def get_stack_status(ctx, stack):
@@ -141,6 +139,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: