From 32b24af2b6c73bf9bb372231da09e6c2f46823f2 Mon Sep 17 00:00:00 2001 From: zramsay Date: Mon, 6 Nov 2023 16:00:05 +0000 Subject: [PATCH 01/13] osmosis FE stack --- app/data/container-build/cerc-osmosis-front-end/build.sh | 4 ++++ app/data/stacks/osmosis-front-end/README.md | 7 +++++++ app/data/stacks/osmosis-front-end/stack.yml | 8 ++++++++ .../data/compose/docker-compose-osmosis-front-end.yml | 8 ++++++++ 4 files changed, 27 insertions(+) create mode 100644 app/data/container-build/cerc-osmosis-front-end/build.sh create mode 100644 app/data/stacks/osmosis-front-end/README.md create mode 100644 app/data/stacks/osmosis-front-end/stack.yml create mode 100644 stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml diff --git a/app/data/container-build/cerc-osmosis-front-end/build.sh b/app/data/container-build/cerc-osmosis-front-end/build.sh new file mode 100644 index 00000000..22f2c346 --- /dev/null +++ b/app/data/container-build/cerc-osmosis-front-end/build.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash +# Build the osmosis front end image +source ${CERC_CONTAINER_BASE_DIR}/build-base.sh +docker build -t cerc/osmosis-front-end:local -f ${CERC_REPO_BASE_DIR}/osmosis-frontend/docker/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/osmosis-frontend diff --git a/app/data/stacks/osmosis-front-end/README.md b/app/data/stacks/osmosis-front-end/README.md new file mode 100644 index 00000000..199dda68 --- /dev/null +++ b/app/data/stacks/osmosis-front-end/README.md @@ -0,0 +1,7 @@ +# self-hosted osmosis front-end + +``` +laconic-so --stack osmosis-front-end setup-repositories +laconic-so --stack osmosis-front-end build-containers +laconic-so --stack osmosis-front-end deploy up +``` diff --git a/app/data/stacks/osmosis-front-end/stack.yml b/app/data/stacks/osmosis-front-end/stack.yml new file mode 100644 index 00000000..d4601c19 --- /dev/null +++ b/app/data/stacks/osmosis-front-end/stack.yml @@ -0,0 +1,8 @@ +version: "0.1" +name: osmosis-front-end +repos: + - github.com/osmosis-labs/osmosis-frontend +containers: + - cerc/osmosis-front-end +pods: + - osmosis-front-end diff --git a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml new file mode 100644 index 00000000..32392882 --- /dev/null +++ b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml @@ -0,0 +1,8 @@ +version: "3.2" + +services: + osmosis-front-end: + image: cerc/osmosis-front-end:local + restart: always + ports: + - "3000:3000" #TODO make `3000` when using the deployment feature -- 2.45.2 From 7963fd4ccd634cef90c97ae9d00504c669f1f5f5 Mon Sep 17 00:00:00 2001 From: zramsay Date: Mon, 6 Nov 2023 16:01:37 +0000 Subject: [PATCH 02/13] chmod --- app/data/container-build/cerc-osmosis-front-end/build.sh | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 app/data/container-build/cerc-osmosis-front-end/build.sh diff --git a/app/data/container-build/cerc-osmosis-front-end/build.sh b/app/data/container-build/cerc-osmosis-front-end/build.sh old mode 100644 new mode 100755 -- 2.45.2 From 28c5ff184f7df8f3c8cd18307dc58258960b0303 Mon Sep 17 00:00:00 2001 From: zramsay Date: Wed, 8 Nov 2023 16:19:52 +0000 Subject: [PATCH 03/13] dont use 3000 --- .../data/compose/docker-compose-osmosis-front-end.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 32392882..bcdc48e2 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,4 @@ services: image: cerc/osmosis-front-end:local restart: always ports: - - "3000:3000" #TODO make `3000` when using the deployment feature + - "3002:3002" #TODO make `3000` when using the deployment feature -- 2.45.2 From d1a2021ce365ebae3fa7177d470402d9672ea587 Mon Sep 17 00:00:00 2001 From: zramsay Date: Tue, 14 Nov 2023 19:57:22 +0000 Subject: [PATCH 04/13] fix for neww stack format --- .../data/container-build/cerc-osmosis-front-end/build.sh | 0 .../data/stacks/osmosis}/README.md | 2 +- .../data/stacks/osmosis}/stack.yml | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename {app => stack_orchestrator}/data/container-build/cerc-osmosis-front-end/build.sh (100%) rename {app/data/stacks/osmosis-front-end => stack_orchestrator/data/stacks/osmosis}/README.md (83%) rename {app/data/stacks/osmosis-front-end => stack_orchestrator/data/stacks/osmosis}/stack.yml (84%) diff --git a/app/data/container-build/cerc-osmosis-front-end/build.sh b/stack_orchestrator/data/container-build/cerc-osmosis-front-end/build.sh similarity index 100% rename from app/data/container-build/cerc-osmosis-front-end/build.sh rename to stack_orchestrator/data/container-build/cerc-osmosis-front-end/build.sh diff --git a/app/data/stacks/osmosis-front-end/README.md b/stack_orchestrator/data/stacks/osmosis/README.md similarity index 83% rename from app/data/stacks/osmosis-front-end/README.md rename to stack_orchestrator/data/stacks/osmosis/README.md index 199dda68..8ea6c195 100644 --- a/app/data/stacks/osmosis-front-end/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -1,4 +1,4 @@ -# self-hosted osmosis front-end +# self-hosted osmosis ``` laconic-so --stack osmosis-front-end setup-repositories diff --git a/app/data/stacks/osmosis-front-end/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml similarity index 84% rename from app/data/stacks/osmosis-front-end/stack.yml rename to stack_orchestrator/data/stacks/osmosis/stack.yml index d4601c19..5b8b744d 100644 --- a/app/data/stacks/osmosis-front-end/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -1,5 +1,5 @@ version: "0.1" -name: osmosis-front-end +name: osmosis repos: - github.com/osmosis-labs/osmosis-frontend containers: -- 2.45.2 From 98c251876ad2aaee2b6cf2611a68f033a4292605 Mon Sep 17 00:00:00 2001 From: zramsay Date: Tue, 14 Nov 2023 20:26:26 +0000 Subject: [PATCH 05/13] updates --- .../data/compose/docker-compose-kubo.yml | 2 +- .../data/stacks/osmosis/stack.yml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/stack_orchestrator/data/compose/docker-compose-kubo.yml b/stack_orchestrator/data/compose/docker-compose-kubo.yml index 2e4ae419..b50dd15a 100644 --- a/stack_orchestrator/data/compose/docker-compose-kubo.yml +++ b/stack_orchestrator/data/compose/docker-compose-kubo.yml @@ -3,7 +3,7 @@ version: "3.2" # See: https://docs.ipfs.tech/install/run-ipfs-inside-docker/#set-up services: ipfs: - image: ipfs/kubo:master-2023-02-20-714a968 + image: ipfs/kubo:v0.24.0 restart: always volumes: - ipfs-import:/import diff --git a/stack_orchestrator/data/stacks/osmosis/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml index 5b8b744d..76b6a4fe 100644 --- a/stack_orchestrator/data/stacks/osmosis/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -1,8 +1,27 @@ version: "0.1" name: osmosis repos: + # these are for gitea + - git.vdb.to/cerc-io/hosting@names-for-so + - gitea.com/gitea/act_runner + # add the osmosis FE - 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., include cloning all of osmosis + - 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 -- 2.45.2 From 9762299b6a14ae16b6db6dd6ed265672a3804804 Mon Sep 17 00:00:00 2001 From: zramsay Date: Wed, 15 Nov 2023 13:24:52 -0500 Subject: [PATCH 06/13] update osmosis readme --- .../data/stacks/osmosis/README.md | 34 +++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index 8ea6c195..d98909ed 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -1,7 +1,35 @@ # self-hosted osmosis +Build and deploy: +- 1) self-hosted gitea, +- 2) an ipfs node, +- 3) the osmosis front end, +- 4) a laconicd chain + + ``` -laconic-so --stack osmosis-front-end setup-repositories -laconic-so --stack osmosis-front-end build-containers -laconic-so --stack osmosis-front-end deploy up +# 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 ``` + +Setup a test chain: +``` +export CERC_NPM_REGISTRY_URL=https://git.vdb.to/api/packages/cerc-io/npm/ + +laconic-so --stack fixturenet-laconic-loaded setup-repositories --include git.vdb.to/cerc-io/laconicd,git.vdb.to/cerc-io/laconic-sdk,git.vdb.to/cerc-io/laconic-registry-cli,git.vdb.to/cerc-io/laconic-console + +laconic-so --stack fixturenet-laconic-loaded build-containers + +export LACONIC_HOSTED_ENDPOINT=http:// + +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`. -- 2.45.2 From d1c58caf178e7dba49ec40e33bf6740a49b5d8a7 Mon Sep 17 00:00:00 2001 From: Zach Date: Tue, 28 Nov 2023 12:10:03 -0500 Subject: [PATCH 07/13] Update stack.yml --- stack_orchestrator/data/stacks/osmosis/stack.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack_orchestrator/data/stacks/osmosis/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml index 76b6a4fe..b57d74ab 100644 --- a/stack_orchestrator/data/stacks/osmosis/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -17,7 +17,7 @@ pods: path: gitea pre_start_command: "run-this-first.sh" post_start_command: "initialize-gitea.sh" - # todo, e.g., include cloning all of osmosis + # 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 -- 2.45.2 From 4e14220c28f350398f342dbed994c272bc96f466 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Thu, 30 Nov 2023 11:07:50 +0530 Subject: [PATCH 08/13] 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" -- 2.45.2 From 1d754a7c9b81af3bad2db67858fb2c9a529cb351 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Wed, 6 Dec 2023 16:36:55 +0530 Subject: [PATCH 09/13] Host osmosis app static build using python server --- .../docker-compose-osmosis-front-end.yml | 22 +++++++++++- .../data/config/osmosis/build-app.sh | 18 ++++++++++ .../cerc-osmosis-front-end/build.sh | 2 +- .../data/stacks/osmosis/README.md | 36 +++++++++++++++---- .../data/stacks/osmosis/stack.yml | 6 ++-- 5 files changed, 74 insertions(+), 10 deletions(-) create mode 100755 stack_orchestrator/data/config/osmosis/build-app.sh 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 663fc7d5..23cea8b4 100644 --- a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml +++ b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml @@ -3,7 +3,24 @@ version: "3.2" services: osmosis-front-end: image: cerc/osmosis-front-end:local - restart: always + restart: on-failure + environment: + - NEXT_PUBLIC_WEB_API_BASE_URL=${CERC_WEB_API_BASE_URL} + working_dir: /app/packages/web + command: ["./build-app.sh"] + volumes: + - ../config/osmosis/build-app.sh:/app/packages/web/build-app.sh + - app_builds:/app-builds + + python-server: + image: python:3 + depends_on: + osmosis-front-end: + condition: service_completed_successfully + restart: on-failure + command: ["python3", "-m", "http.server", "-d" ,"/app-builds/osmosis/build", "4000"] + volumes: + - app_builds:/app-builds ports: - "3000" healthcheck: @@ -12,3 +29,6 @@ services: timeout: 5s retries: 15 start_period: 5s + +volumes: + app_builds: diff --git a/stack_orchestrator/data/config/osmosis/build-app.sh b/stack_orchestrator/data/config/osmosis/build-app.sh new file mode 100755 index 00000000..09813063 --- /dev/null +++ b/stack_orchestrator/data/config/osmosis/build-app.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e +if [ -n "$CERC_SCRIPT_DEBUG" ]; then + set -x +fi + +# Check and exit if a deployment already exists (on restarts) +if [ -d /app-builds/osmosis/build ]; then + echo "Build already exists, remove volume to rebuild" + exit 0 +fi + +yarn build:static + +# Move build to app-builds +mkdir /app-builds/osmosis +cp -r ./out /app-builds/osmosis/build diff --git a/stack_orchestrator/data/container-build/cerc-osmosis-front-end/build.sh b/stack_orchestrator/data/container-build/cerc-osmosis-front-end/build.sh index 22f2c346..c4a9f27e 100755 --- a/stack_orchestrator/data/container-build/cerc-osmosis-front-end/build.sh +++ b/stack_orchestrator/data/container-build/cerc-osmosis-front-end/build.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash # Build the osmosis front end image source ${CERC_CONTAINER_BASE_DIR}/build-base.sh -docker build -t cerc/osmosis-front-end:local -f ${CERC_REPO_BASE_DIR}/osmosis-frontend/docker/Dockerfile ${build_command_args} ${CERC_REPO_BASE_DIR}/osmosis-frontend +docker build -t cerc/osmosis-front-end:local -f ${CERC_REPO_BASE_DIR}/osmosis-frontend/docker/Dockerfile.static ${build_command_args} ${CERC_REPO_BASE_DIR}/osmosis-frontend diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index d3e8421c..663516d5 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -39,15 +39,14 @@ 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 + proxy-server: + - '4000:4000' + python-server: + - '3000:3000' ``` ### 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`. @@ -58,6 +57,31 @@ Once you've made any needed changes to the spec file, create a deployment from i laconic-so --stack osmosis deploy create --spec-file osmosis-spec.yml --deployment-dir osmosis-deployment ``` +## Set env variables + +Inside the deployment directory, open the file `config.env` and set the following env variables: + + ```bash + # Osmosis API base URL + # Set this to proxy server endpoint for uniswap app + # (Eg. http://localhost:4000) + # (Eg. https://abc.xyz.com) + CERC_WEB_API_BASE_URL= + + # Optional + + # TODO: Change to CERC_ENABLE_PROXY after rebase + # Whether to run the proxy server + # (Disable only if proxy not required to be run) (Default: true) + ENABLE_PROXY= + + # Proxy server configuration + # Used only if proxy is enabled + + # Upstream API URL + CERC_PROXY_UPSTREAM=https://app.osmosis.zone + ``` + ## Start the stack Start the deployment: diff --git a/stack_orchestrator/data/stacks/osmosis/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml index 43c49d0b..cc0e4e77 100644 --- a/stack_orchestrator/data/stacks/osmosis/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -5,14 +5,16 @@ repos: - git.vdb.to/cerc-io/hosting@names-for-so - gitea.com/gitea/act_runner # For osmosis frontend - - github.com/osmosis-labs/osmosis-frontend + - github.com/cerc-io/osmosis-frontend@ng-export-static # TODO: Update branch after merge containers: - cerc/act-runner - cerc/act-runner-task-executor + - cerc/watcher-ts - cerc/osmosis-front-end pods: - - osmosis-front-end - kubo + - proxy-server + - osmosis-front-end # TODO: Fix pod config for deployment command # TODO: mirroring all of osmosis repos: https://git.vdb.to/cerc-io/hosting/pulls/42 # - name: gitea -- 2.45.2 From 5ee0bdf00ee186dfb551135ed21c88749dea2025 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Wed, 6 Dec 2023 17:36:30 +0530 Subject: [PATCH 10/13] Fix mapped ports in deployment for containers --- .../compose/docker-compose-osmosis-front-end.yml | 2 +- stack_orchestrator/data/stacks/osmosis/README.md | 15 +++++++++------ stack_orchestrator/data/stacks/osmosis/stack.yml | 1 + 3 files changed, 11 insertions(+), 7 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 23cea8b4..b3b8aaab 100644 --- a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml +++ b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml @@ -18,7 +18,7 @@ services: osmosis-front-end: condition: service_completed_successfully restart: on-failure - command: ["python3", "-m", "http.server", "-d" ,"/app-builds/osmosis/build", "4000"] + command: ["python3", "-m", "http.server", "-d" ,"/app-builds/osmosis/build", "3000"] volumes: - app_builds:/app-builds ports: diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index 663516d5..de3f0384 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -22,7 +22,7 @@ Build the container images: # support image for the gitea package registry laconic-so --stack build-support build-containers -laconic-so --stack osmosis build-containers +laconic-so --stack osmosis build-containers ``` ## Create a deployment @@ -38,11 +38,12 @@ Edit `network` in spec file to map container ports to same ports in host ``` ... -ports: - proxy-server: - - '4000:4000' - python-server: - - '3000:3000' +network: + ports: + proxy-server: + - '4000:4000' + python-server: + - '3000:3000' ``` ### Data volumes @@ -91,6 +92,8 @@ 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` +* The web app can be accessed at http://localhost:3000 + ## Laconic registry Setup a test chain: diff --git a/stack_orchestrator/data/stacks/osmosis/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml index cc0e4e77..2362c3cd 100644 --- a/stack_orchestrator/data/stacks/osmosis/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -5,6 +5,7 @@ repos: - git.vdb.to/cerc-io/hosting@names-for-so - gitea.com/gitea/act_runner # For osmosis frontend + - github.com/cerc-io/watcher-ts@v0.2.78 - github.com/cerc-io/osmosis-frontend@ng-export-static # TODO: Update branch after merge containers: - cerc/act-runner -- 2.45.2 From 6b575f757636f02f8e70e610bc2f359f9561b708 Mon Sep 17 00:00:00 2001 From: Prathamesh Musale Date: Thu, 7 Dec 2023 11:09:59 +0530 Subject: [PATCH 11/13] Update instructions --- .../data/config/osmosis/build-app.sh | 2 +- .../data/stacks/osmosis/README.md | 18 ++++++++++++------ .../data/stacks/osmosis/stack.yml | 10 +++++----- .../data/stacks/uniswap-urbit-app/README.md | 13 ++++++++++--- 4 files changed, 28 insertions(+), 15 deletions(-) diff --git a/stack_orchestrator/data/config/osmosis/build-app.sh b/stack_orchestrator/data/config/osmosis/build-app.sh index 09813063..2f3cfd01 100755 --- a/stack_orchestrator/data/config/osmosis/build-app.sh +++ b/stack_orchestrator/data/config/osmosis/build-app.sh @@ -14,5 +14,5 @@ fi yarn build:static # Move build to app-builds -mkdir /app-builds/osmosis +mkdir -p /app-builds/osmosis cp -r ./out /app-builds/osmosis/build diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index de3f0384..6e5dd7af 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -65,16 +65,15 @@ Inside the deployment directory, open the file `config.env` and set the followin ```bash # Osmosis API base URL # Set this to proxy server endpoint for uniswap app - # (Eg. http://localhost:4000) - # (Eg. https://abc.xyz.com) - CERC_WEB_API_BASE_URL= + # (Eg. http://localhost:4000 - in case stack is being run locally with proxy enabled) + # (Eg. https://abc.xyz.com - in case https://abc.xyz.com is pointed to the proxy endpoint) + CERC_WEB_API_BASE_URL=http://localhost:4000 # Optional - # TODO: Change to CERC_ENABLE_PROXY after rebase # Whether to run the proxy server # (Disable only if proxy not required to be run) (Default: true) - ENABLE_PROXY= + CERC_ENABLE_PROXY= # Proxy server configuration # Used only if proxy is enabled @@ -113,16 +112,23 @@ then `docker exec` into the `laconicd` container and either export the private k ## Clean up -To stop all osmosis services running in the background, while preserving chain data: +To stop all osmosis services running in the background, while preserving data: ```bash +# Only stop the docker containers laconic-so deployment --dir osmosis-deployment stop + +# Run 'start' to restart the deployment ``` To stop all osmosis services and also delete data: ```bash +# Stop the docker containers laconic-so deployment --dir osmosis-deployment stop --delete-volumes + +# Remove deployment directory (deployment will have to be recreated for a re-run) +rm -r osmosis-deployment ``` To stop stack running Laconic registry diff --git a/stack_orchestrator/data/stacks/osmosis/stack.yml b/stack_orchestrator/data/stacks/osmosis/stack.yml index 2362c3cd..a0669b71 100644 --- a/stack_orchestrator/data/stacks/osmosis/stack.yml +++ b/stack_orchestrator/data/stacks/osmosis/stack.yml @@ -2,14 +2,14 @@ version: "0.1" name: osmosis repos: # For gitea - - git.vdb.to/cerc-io/hosting@names-for-so - - gitea.com/gitea/act_runner + # - git.vdb.to/cerc-io/hosting@names-for-so + # - gitea.com/gitea/act_runner # For osmosis frontend - github.com/cerc-io/watcher-ts@v0.2.78 - - github.com/cerc-io/osmosis-frontend@ng-export-static # TODO: Update branch after merge + - github.com/cerc-io/osmosis-frontend@laconic containers: - - cerc/act-runner - - cerc/act-runner-task-executor + # - cerc/act-runner + # - cerc/act-runner-task-executor - cerc/watcher-ts - cerc/osmosis-front-end pods: diff --git a/stack_orchestrator/data/stacks/uniswap-urbit-app/README.md b/stack_orchestrator/data/stacks/uniswap-urbit-app/README.md index 6818dd94..7f49c16f 100644 --- a/stack_orchestrator/data/stacks/uniswap-urbit-app/README.md +++ b/stack_orchestrator/data/stacks/uniswap-urbit-app/README.md @@ -78,9 +78,9 @@ Inside the deployment directory, open the file `config.env` and set the followin # Uniswap API GQL Endpoint # Set this to GQL proxy server endpoint for uniswap app - # (Eg. http://localhost:4000/v1/graphql) - # (Eg. https://abc.xyz.com/v1/graphql) - CERC_UNISWAP_GQL= + # (Eg. http://localhost:4000/v1/graphql - in case stack is being run locally with proxy enabled) + # (Eg. https://abc.xyz.com/v1/graphql - in case https://abc.xyz.com is pointed to the proxy endpoint) + CERC_UNISWAP_GQL=http://localhost:4000/v1/graphql # Optional @@ -150,11 +150,18 @@ laconic-so deployment --dir uniswap-urbit-app-deployment start To stop all uniswap-urbit-app services running in the background, while preserving data: ```bash +# Only stop the docker containers laconic-so deployment --dir uniswap-urbit-app-deployment stop + +# Run 'start' to restart the deployment ``` To stop all uniswap-urbit-app services and also delete data: ```bash +# Stop the docker containers laconic-so deployment --dir uniswap-urbit-app-deployment stop --delete-volumes + +# Remove deployment directory (deployment will have to be recreated for a re-run) +rm -r uniswap-urbit-app-deployment ``` -- 2.45.2 From 746447f5fca5f5fb610e54b99239ab7b17862a7d Mon Sep 17 00:00:00 2001 From: Nabarun Date: Fri, 8 Dec 2023 14:58:48 +0530 Subject: [PATCH 12/13] Use nginx server to host files and handle page reloads --- .../compose/docker-compose-osmosis-front-end.yml | 14 +++++++------- .../data/config/osmosis/nginx/web-app.conf | 16 ++++++++++++++++ stack_orchestrator/data/stacks/osmosis/README.md | 4 ++-- 3 files changed, 25 insertions(+), 9 deletions(-) create mode 100644 stack_orchestrator/data/config/osmosis/nginx/web-app.conf 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 b3b8aaab..f4a25b54 100644 --- a/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml +++ b/stack_orchestrator/data/compose/docker-compose-osmosis-front-end.yml @@ -12,19 +12,19 @@ services: - ../config/osmosis/build-app.sh:/app/packages/web/build-app.sh - app_builds:/app-builds - python-server: - image: python:3 + nginx: + image: nginx:1.23-alpine + restart: always depends_on: osmosis-front-end: condition: service_completed_successfully - restart: on-failure - command: ["python3", "-m", "http.server", "-d" ,"/app-builds/osmosis/build", "3000"] volumes: - - app_builds:/app-builds + - ../config/osmosis/nginx:/etc/nginx/conf.d + - app_builds:/usr/share/nginx ports: - - "3000" + - "80" healthcheck: - test: ["CMD", "nc", "-vz", "localhost", "3000"] + test: ["CMD", "nc", "-vz", "localhost", "80"] interval: 20s timeout: 5s retries: 15 diff --git a/stack_orchestrator/data/config/osmosis/nginx/web-app.conf b/stack_orchestrator/data/config/osmosis/nginx/web-app.conf new file mode 100644 index 00000000..784df3b2 --- /dev/null +++ b/stack_orchestrator/data/config/osmosis/nginx/web-app.conf @@ -0,0 +1,16 @@ +server { + listen 80; + listen [::]:80; + server_name _; + + error_page 500 502 503 504 /50x.html; + + location / { + root /usr/share/nginx/osmosis/build; + index index.html index.htm index.nginx-debian.html; + + # First attempt to serve request as file, then as html, + # then as directory, then fall back to displaying a 404. + try_files $uri $uri.html $uri/ /index.html =404; + } +} diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index 6e5dd7af..b8700edc 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -42,8 +42,8 @@ network: ports: proxy-server: - '4000:4000' - python-server: - - '3000:3000' + niginx: + - '3000:80' ``` ### Data volumes -- 2.45.2 From da26381b355cce32cefb38a3c269d212ff8cee58 Mon Sep 17 00:00:00 2001 From: Nabarun Date: Mon, 11 Dec 2023 11:42:06 +0530 Subject: [PATCH 13/13] Fix typo --- stack_orchestrator/data/stacks/osmosis/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stack_orchestrator/data/stacks/osmosis/README.md b/stack_orchestrator/data/stacks/osmosis/README.md index b8700edc..4c13c93c 100644 --- a/stack_orchestrator/data/stacks/osmosis/README.md +++ b/stack_orchestrator/data/stacks/osmosis/README.md @@ -42,7 +42,7 @@ network: ports: proxy-server: - '4000:4000' - niginx: + nginx: - '3000:80' ``` -- 2.45.2