From ac45ae6e1347cf6b7a65d96982ee33220b89e0b5 Mon Sep 17 00:00:00 2001 From: Anmol1696 Date: Mon, 24 Jun 2024 18:43:27 +0530 Subject: [PATCH] start to update examples to have bash and non bash system --- examples/getting-started-bash/Makefile | 66 +++++++++++++++++++ examples/getting-started-bash/README.md | 64 ++++++++++++++++++ .../configs/starship.yaml | 3 + .../configs/tiny-starship.yaml | 3 + .../scripts/dev-setup.sh | 0 .../scripts/install.sh | 0 .../scripts/port-forward.sh | 0 .../Makefile | 0 .../README.md | 1 + .../getting-started-js/configs/starship.yaml | 34 ++++++++++ .../configs/tiny-starship.yaml | 52 +++++++++++++++ 11 files changed, 223 insertions(+) create mode 100644 examples/getting-started-bash/Makefile create mode 100644 examples/getting-started-bash/README.md rename examples/{getting-started => getting-started-bash}/configs/starship.yaml (91%) rename examples/{getting-started => getting-started-bash}/configs/tiny-starship.yaml (94%) rename examples/{getting-started => getting-started-bash}/scripts/dev-setup.sh (100%) rename examples/{getting-started => getting-started-bash}/scripts/install.sh (100%) rename examples/{getting-started => getting-started-bash}/scripts/port-forward.sh (100%) rename examples/{getting-started => getting-started-js}/Makefile (100%) rename examples/{getting-started => getting-started-js}/README.md (96%) create mode 100644 examples/getting-started-js/configs/starship.yaml create mode 100644 examples/getting-started-js/configs/tiny-starship.yaml diff --git a/examples/getting-started-bash/Makefile b/examples/getting-started-bash/Makefile new file mode 100644 index 000000000..c8c428a56 --- /dev/null +++ b/examples/getting-started-bash/Makefile @@ -0,0 +1,66 @@ +NAME = starship-getting-started +FILE = configs/starship.yaml +TINY_FILE = configs/tiny-starship.yaml + +HELM_REPO = starship +HELM_CHART = devnet +HELM_VERSION = v0.2.6 + +############################################################################### +### All commands ### +############################################################################### + +.PHONY: setup +setup: setup-deps setup-kind + +.PHONY: stop +stop: stop-forward delete + +.PHONY: clean +clean: stop clean-kind + +############################################################################### +### Dependency check ### +############################################################################### + +.PHONY: check +setup-deps: + bash $(CURDIR)/scripts/dev-setup.sh + +############################################################################### +### Helm Charts ### +############################################################################### + +install: + bash $(CURDIR)/scripts/install.sh --config $(FILE) --name $(NAME) --version $(HELM_VERSION) + +install-tiny: + $(MAKE) install FILE=$(TINY_FILE) + +delete: + -helm delete $(NAME) + +############################################################################### +### Port forward ### +############################################################################### + +.PHONY: port-forward +port-forward: + bash $(CURDIR)/scripts/port-forward.sh --config=$(FILE) + +.PHONY: stop-forward +stop-forward: + -pkill -f "port-forward" + +############################################################################### +### Local Kind Setup ### +############################################################################### +KIND_CLUSTER=starship + +.PHONY: setup-kind +setup-kind: + kind create cluster --name $(KIND_CLUSTER) + +.PHONY: clean-kind +clean-kind: + kind delete cluster --name $(KIND_CLUSTER) diff --git a/examples/getting-started-bash/README.md b/examples/getting-started-bash/README.md new file mode 100644 index 000000000..afbd49f3a --- /dev/null +++ b/examples/getting-started-bash/README.md @@ -0,0 +1,64 @@ +# Getting Started + +Simple self-contained example to get started with Starship. + +## TLDR +```bash +cd getting-started-bash/ + +# Install the starship instance and run port-forward +make install +# OR, if you are low on resources on local machine +make install-tiny + +# Once the pods are running, run +make port-forward + +# Stop the cluster with +make stop +``` + +For more detailed step-by-step approach checkout the rest of the README. + +## Dependencies +Make sure you have the dependencies installed. Run the following command to install the dependencies. +```bash +make setup-deps +# Will install +# - kind +# - kubectl +# - helm +# - yq +``` + +Additionally, you would also need `docker` to be running on your machine as well. + +## Spin up a cluster (if you don't have one already) +Recommend to use Docker Desktop for Mac/Windows or Minikube for Linux. + +## Deploy Starship +Run the following commands to deploy starship on the cluster. +```bash +make install +# OR, if low on resources on local machine +make install-tiny +``` + +This will run the following nodes: +* Osmosis node +* Gaia node +* Hermes relayer between the two +* Ping Pub explorer + +## Connect to cluster +Port forward ports from the cluster to your local machine. +```bash +make port-forward +``` + +## Interact with the chains +You can then interact with the chain on localhost at +* Osmosis: http://localhost:26653/status +* Cosmos: http://localhost:26657/status +* Ping Pub: http://localhost:8080 +* Local Chain Registry: http://localhost:8081/chains diff --git a/examples/getting-started/configs/starship.yaml b/examples/getting-started-bash/configs/starship.yaml similarity index 91% rename from examples/getting-started/configs/starship.yaml rename to examples/getting-started-bash/configs/starship.yaml index b4a6f1743..24b975f66 100644 --- a/examples/getting-started/configs/starship.yaml +++ b/examples/getting-started-bash/configs/starship.yaml @@ -1,3 +1,6 @@ +name: getting-started +version: v0.2.6 + chains: - id: osmosis-1 name: osmosis diff --git a/examples/getting-started/configs/tiny-starship.yaml b/examples/getting-started-bash/configs/tiny-starship.yaml similarity index 94% rename from examples/getting-started/configs/tiny-starship.yaml rename to examples/getting-started-bash/configs/tiny-starship.yaml index a240dd3ef..3e393e31f 100644 --- a/examples/getting-started/configs/tiny-starship.yaml +++ b/examples/getting-started-bash/configs/tiny-starship.yaml @@ -1,3 +1,6 @@ +name: getting-started +version: v0.2.6 + chains: - id: osmosis-1 name: osmosis diff --git a/examples/getting-started/scripts/dev-setup.sh b/examples/getting-started-bash/scripts/dev-setup.sh similarity index 100% rename from examples/getting-started/scripts/dev-setup.sh rename to examples/getting-started-bash/scripts/dev-setup.sh diff --git a/examples/getting-started/scripts/install.sh b/examples/getting-started-bash/scripts/install.sh similarity index 100% rename from examples/getting-started/scripts/install.sh rename to examples/getting-started-bash/scripts/install.sh diff --git a/examples/getting-started/scripts/port-forward.sh b/examples/getting-started-bash/scripts/port-forward.sh similarity index 100% rename from examples/getting-started/scripts/port-forward.sh rename to examples/getting-started-bash/scripts/port-forward.sh diff --git a/examples/getting-started/Makefile b/examples/getting-started-js/Makefile similarity index 100% rename from examples/getting-started/Makefile rename to examples/getting-started-js/Makefile diff --git a/examples/getting-started/README.md b/examples/getting-started-js/README.md similarity index 96% rename from examples/getting-started/README.md rename to examples/getting-started-js/README.md index 8a80ee9d3..368e03e27 100644 --- a/examples/getting-started/README.md +++ b/examples/getting-started-js/README.md @@ -66,3 +66,4 @@ You can then interact with the chain on localhost at * Osmosis: http://localhost:26653/status * Cosmos: http://localhost:26657/status * Ping Pub: http://localhost:8080 +* Local Chain Registry: http://localhost:8081/chains diff --git a/examples/getting-started-js/configs/starship.yaml b/examples/getting-started-js/configs/starship.yaml new file mode 100644 index 000000000..24b975f66 --- /dev/null +++ b/examples/getting-started-js/configs/starship.yaml @@ -0,0 +1,34 @@ +name: getting-started +version: v0.2.6 + +chains: + - id: osmosis-1 + name: osmosis + numValidators: 1 + ports: + rest: 1313 + rpc: 26653 + - id: gaia-1 + name: cosmoshub + numValidators: 1 + ports: + rest: 1317 + rpc: 26657 + +relayers: + - name: osmos-gaia + type: hermes + replicas: 1 + chains: + - osmosis-1 + - gaia-1 + +explorer: + enabled: true + ports: + rest: 8080 + +registry: + enabled: true + ports: + rest: 8081 diff --git a/examples/getting-started-js/configs/tiny-starship.yaml b/examples/getting-started-js/configs/tiny-starship.yaml new file mode 100644 index 000000000..3e393e31f --- /dev/null +++ b/examples/getting-started-js/configs/tiny-starship.yaml @@ -0,0 +1,52 @@ +name: getting-started +version: v0.2.6 + +chains: + - id: osmosis-1 + name: osmosis + numValidators: 1 + ports: + rest: 1313 + rpc: 26653 + resources: + cpu: "0.3" + memory: "300M" + - id: gaia-1 + name: cosmoshub + numValidators: 1 + ports: + rest: 1317 + rpc: 26657 + resources: + cpu: "0.3" + memory: "300M" + +relayers: + - name: osmos-gaia + type: hermes + replicas: 1 + chains: + - osmosis-1 + - gaia-1 + resources: + cpu: "0.1" + memory: "100M" + +registry: + enabled: true + ports: + rest: 8081 + resources: + cpu: "0.1" + memory: "100M" + +# configure default resources +resources: + node: + cpu: "0.3" + memory: "300M" + +exposer: + resources: + cpu: "0.1" + memory: "100M"