From 4e14220c28f350398f342dbed994c272bc96f466 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Thu, 30 Nov 2023 11:07:50 +0530 Subject: [PATCH] Update osmosis frontend stack to serve app --- .../docker-compose-osmosis-front-end.yml | 8 +- .../data/stacks/osmosis/README.md | 93 +++++++++++++++++-- .../data/stacks/osmosis/stack.yml | 28 +++--- 3 files changed, 104 insertions(+), 25 deletions(-) diff --git a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml index bcdc48e2..663fc7d5 100644 --- a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml +++ b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml @@ -5,4 +5,10 @@ services: image: cerc/osmosis-front-end:local restart: always ports: - - "3002:3002" #TODO make `3000` when using the deployment feature + - "3000" + healthcheck: + test: ["CMD", "nc", "-vz", "localhost", "3000"] + interval: 20s + timeout: 5s + retries: 15 + start_period: 5s diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index d98909ed..d3e8421c 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -1,24 +1,74 @@ # self-hosted osmosis -Build and deploy: -- 1) self-hosted gitea, -- 2) an ipfs node, -- 3) the osmosis front end, -- 4) a laconicd chain +Instructions to build and deploy: +- self-hosted gitea +- an ipfs node +- the osmosis front end +- a laconicd chain +## Setup + +Clone required repositories: + +```bash +laconic-so --stack osmosis setup-repositories + +# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command +``` + +Build the container images: ``` # support image for the gitea package registry laconic-so --stack build-support build-containers -# todo: pre-run clone - -# clones and builds several things -laconic-so --stack osmosis setup-repositories laconic-so --stack osmosis build-containers -laconic-so --stack osmosis deploy up ``` +## Create a deployment + +First, create a spec file for the deployment, which will map the stack's ports and volumes to the host: +```bash +laconic-so --stack osmosis deploy init --output osmosis-spec.yml +``` + +### Ports + +Edit `network` in spec file to map container ports to same ports in host + +``` +... +ports: + osmosis-front-end: + - '3000:3000' + ipfs: + - 0.0.0.0:8080:8080 + - 0.0.0.0:4001:4001 + - 0.0.0.0:5001:5001 +``` + +### Data volumes +Container data volumes are bind-mounted to specified paths in the host filesystem. +The default setup (generated by `laconic-so deploy init`) places the volumes in the `./data` subdirectory of the deployment directory. The default mappings can be customized by editing the "spec" file generated by `laconic-so deploy init`. + +--- + +Once you've made any needed changes to the spec file, create a deployment from it: +```bash +laconic-so --stack osmosis deploy create --spec-file osmosis-spec.yml --deployment-dir osmosis-deployment +``` + +## Start the stack + +Start the deployment: +```bash +laconic-so deployment --dir osmosis-deployment start +``` + +* List and check the health status of all the containers using `docker ps` and wait for them to be `healthy` + +## Laconic registry + Setup a test chain: ``` export CERC_NPM_REGISTRY_URL=https://git.vdb.to/api/packages/cerc-io/npm/ @@ -33,3 +83,26 @@ laconic-so --stack fixturenet-laconic-loaded deploy up ``` then `docker exec` into the `laconicd` container and either export the private key or create a new one and send funds to it. Use that private key for `LACONIC_HOTWALLET_KEY`. + +## Clean up + +To stop all osmosis services running in the background, while preserving chain data: + +```bash +laconic-so deployment --dir osmosis-deployment stop +``` + +To stop all osmosis services and also delete data: + +```bash +laconic-so deployment --dir osmosis-deployment stop --delete-volumes +``` + +To stop stack running Laconic registry + +```bash +laconic-so --stack fixturenet-laconic-loaded deploy down + +# Delete volumes +laconic-so --stack fixturenet-laconic-loaded deploy down --delete-volumes +``` diff --git a/stack_orchestrator/data/stacks/osmosis/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml index b57d74ab..43c49d0b 100644 --- a/stack_orchestrator/data/stacks/osmosis/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -1,27 +1,27 @@ version: "0.1" name: osmosis repos: - # these are for gitea + # For gitea - git.vdb.to/cerc-io/hosting@names-for-so - gitea.com/gitea/act_runner - # add the osmosis FE + # For osmosis frontend - github.com/osmosis-labs/osmosis-frontend containers: - cerc/act-runner - cerc/act-runner-task-executor - # note: osmosis builds but doesn't run - cerc/osmosis-front-end pods: - - name: gitea - repository: cerc-io/hosting - path: gitea - pre_start_command: "run-this-first.sh" - post_start_command: "initialize-gitea.sh" - # todo, e.g., mirroring all of osmosis repos: https://git.vdb.to/cerc-io/hosting/pulls/42 - - name: act-runner - repository: cerc-io/hosting - path: act-runner - pre_start_command: "pre_start.sh" - post_start_command: "post_start.sh" - osmosis-front-end - kubo + # TODO: Fix pod config for deployment command + # TODO: mirroring all of osmosis repos: https://git.vdb.to/cerc-io/hosting/pulls/42 + # - name: gitea + # repository: cerc-io/hosting + # path: gitea + # pre_start_command: "run-this-first.sh" + # post_start_command: "initialize-gitea.sh" + # - name: act-runner + # repository: cerc-io/hosting + # path: act-runner + # pre_start_command: "pre_start.sh" + # post_start_command: "post_start.sh"