From 0d4e48c6134fcf7d6e0f522ca83ac75a0b95986f Mon Sep 17 00:00:00 2001 From: Anmol Date: Thu, 23 May 2024 15:56:39 +0530 Subject: [PATCH] docs: make docs part for starship v2 (#449) * make docs part for starship v2 * update final steps * add section for starship cli --- docs/pages/_meta.json | 1 + docs/pages/cli/_meta.json | 3 ++ docs/pages/cli/index.mdx | 29 ++++++++++++++++ docs/pages/get-started/_meta.json | 1 - docs/pages/get-started/step-1.mdx | 9 ++--- docs/pages/get-started/step-2.mdx | 58 ++++++++++++++++--------------- docs/pages/get-started/step-3.mdx | 36 +++++++++---------- docs/pages/get-started/step-4.mdx | 28 +++------------ docs/pages/get-started/step-5.mdx | 48 ------------------------- 9 files changed, 88 insertions(+), 125 deletions(-) create mode 100644 docs/pages/cli/_meta.json create mode 100644 docs/pages/cli/index.mdx delete mode 100644 docs/pages/get-started/step-5.mdx diff --git a/docs/pages/_meta.json b/docs/pages/_meta.json index 05bceb03..297680ad 100644 --- a/docs/pages/_meta.json +++ b/docs/pages/_meta.json @@ -2,6 +2,7 @@ "index": "Introduction", "get-started": "Get Started", "config": "Configuration", + "cli": "CLI", "tests": "E2E Tests", "advanced": "Advanced Usage" } diff --git a/docs/pages/cli/_meta.json b/docs/pages/cli/_meta.json new file mode 100644 index 00000000..0995e8c3 --- /dev/null +++ b/docs/pages/cli/_meta.json @@ -0,0 +1,3 @@ +{ + "index": "Introduction" +} \ No newline at end of file diff --git a/docs/pages/cli/index.mdx b/docs/pages/cli/index.mdx new file mode 100644 index 00000000..f72b5933 --- /dev/null +++ b/docs/pages/cli/index.mdx @@ -0,0 +1,29 @@ +# Client + +## Install the Cli + +```sh +npm install -g @starship-ci/cli +``` + +### Install dependencies +```sh +starship install +``` + +### Run starship + +```sh +starship setup --config ./config/settings.json +starship deploy --config ./config/settings.json +starship start-ports --config ./config/settings.json +``` + +### Teardown starship + +```sh +starship undeploy --config ./config/settings.json +starship teardown --config ./config/settings.json +``` + + diff --git a/docs/pages/get-started/_meta.json b/docs/pages/get-started/_meta.json index f42f0ca5..e77ab730 100644 --- a/docs/pages/get-started/_meta.json +++ b/docs/pages/get-started/_meta.json @@ -3,5 +3,4 @@ "step-2": "Step 2: Setup Build Tools", "step-3": "Step 3: Setup Build Scripts", "step-4": "Step 4: Interact with the chains", - "step-5": "TLDR" } \ No newline at end of file diff --git a/docs/pages/get-started/step-1.mdx b/docs/pages/get-started/step-1.mdx index b1766191..3b096292 100644 --- a/docs/pages/get-started/step-1.mdx +++ b/docs/pages/get-started/step-1.mdx @@ -14,13 +14,12 @@ In this step, we will setup the dependencies for our project. We will use ## 1.1) Installation Run the following commands to get the dependencies installed. ```bash -bash <(curl -Ls https://raw.githubusercontent.com/cosmology-tech/starship/main/scripts/dev-setup.sh) +npm install -g @starship-ci/cli ``` -This will fetch all the dependencies and install them in the `~/.local/bin` directory. -Please add it to your `PATH` variable with +Run following command to install all the dependencies ```bash -export PATH=$PATH:~/.local/bin +starship install ``` ## 1.2) Manual Installation @@ -29,6 +28,4 @@ the required dependencies * `docker`: https://docs.docker.com/get-docker/ * `kubectl`: https://kubernetes.io/docs/tasks/tools/ -* `kind`: https://kind.sigs.k8s.io/docs/user/quick-start/#installation * `helm`: https://helm.sh/docs/intro/install/ -* `yq`: https://github.com/mikefarah/yq/#install diff --git a/docs/pages/get-started/step-2.mdx b/docs/pages/get-started/step-2.mdx index bd8364b6..2bfda5bf 100644 --- a/docs/pages/get-started/step-2.mdx +++ b/docs/pages/get-started/step-2.mdx @@ -1,38 +1,13 @@ # **Step 2:** Kubernetes Cluster -In this step, we will setup a Kubernetes cluster using `kind` or `Docker Desktop`. +In this step, we will setup a Kubernetes cluster using `Docker Desktop` or `kind`. Optionally if you have a Kubernetes cluster already, you can skip this step. By the end of this tutorial you should be able to run `kubectl get nodes` and see a list of nodes. Please **follow any one of the following** sections to setup a Kubernetes cluster. -## 2.1.1) Setup with Kind Cluster - -### Prechecks -Make sure kind is installed -```bash -kind version -# -# kind v0.18.0 go1.20.2 linux/amd64 -``` - -Make sure docker is running, and you have access to it. -```bash -docker ps -``` - -### Create kind cluster -Run -```bash -kind create cluster --name starship -``` - -Note: Kind will create an entry in the kubeconfig file and set the context to the new cluster. - -Detailed Reference: https://kind.sigs.k8s.io/docs/user/quick-start/#creating-a-cluster - -## 2.1.2) Setup with Docker Desktop +## 2.1.1) Recommended: Setup with Docker Desktop Docker Desktop includes a standalone Kubernetes server and client, as well as Docker CLI integration that runs on your machine. ### Enable kubernetes @@ -56,9 +31,36 @@ kubectl config use-context docker-desktop Detailed Reference: https://docs.docker.com/desktop/kubernetes/ +## 2.1.2) Alternative: Setup with Kind Cluster + +### Install Kind +Follow the steps in the official documentation to install kind: https://kind.sigs.k8s.io/docs/user/quick-start/ + +Make sure kind is installed +```bash +kind version +# +# kind v0.18.0 go1.20.2 linux/amd64 +``` + +Make sure docker is running, and you have access to it. +```bash +docker ps +``` + +### Create kind cluster +Run +```bash +kind create cluster --name starship +``` + +Note: Kind will create an entry in the kubeconfig file and set the context to the new cluster. + +Detailed Reference: https://kind.sigs.k8s.io/docs/user/quick-start/#creating-a-cluster + ## 2.2) Check Access to kubernetes -Kind will run a k8s cluster with docker. You can check the nodes with +Once you are connected to a kubernetes cluster, you should be able to run the following command and see a list of nodes. ```bash kubectl get nodes ``` diff --git a/docs/pages/get-started/step-3.mdx b/docs/pages/get-started/step-3.mdx index 0d0fa851..18075989 100644 --- a/docs/pages/get-started/step-3.mdx +++ b/docs/pages/get-started/step-3.mdx @@ -9,9 +9,7 @@ We use helm as the package manager for starship. Run ```bash -helm repo add starship https://cosmology-tech.github.io/starship/ -helm repo update -helm search repo starship/devnet --version 0.2.0 +starship setup ``` ## 3.2) Define the desired infrastructure @@ -29,7 +27,7 @@ Create a directory to play around in ```bash mkdir getting-started cd getting-started -touch starship.yaml +touch config.yaml ``` Add following content to `starship.yaml` with the following content @@ -56,11 +54,6 @@ relayers: - osmosis-1 - gaia-1 -explorer: - enabled: true - ports: - rest: 8080 - registry: enabled: true ports: @@ -76,15 +69,15 @@ For the tutorial we will keep it simple. ## 3.3) Spin up the infrastructure Spin up the infrastructure with ```bash -helm install -f starship.yaml tutorial starship/devnet --version 0.2.0 - -# Where -# -f starship.yaml: use the starship.yaml file as the configuration -# tutorial: name of the helm release -# starship/devnet: helm chart to use -# --version 0.1.45: version of the helm chart to use +starship start --helmFile config.yaml ``` +This command will: +* Create the necessary kubernetes resources +* Deploy the chains and relayers and registry +* Wait for pods to be in `Running` state +* Runs port forwarding for the chains and registry to local ports + This will take some time to spin up the infrastructure, you can check the status in another terminal with ```bash kubectl get pods @@ -92,5 +85,12 @@ kubectl get pods watch kubectl get pods ``` -You would need to wait for the pods to be in `Running` state. -This can take up to 2-5 minutes, depending on the underlying machine. +## 3.4) Check the status of the infrastructure +```bash +starship get-pods +``` + +Check chain registry status +```bash +curl http://localhost:8081/chains | jq +``` diff --git a/docs/pages/get-started/step-4.mdx b/docs/pages/get-started/step-4.mdx index f67d4a21..a452a394 100644 --- a/docs/pages/get-started/step-4.mdx +++ b/docs/pages/get-started/step-4.mdx @@ -17,22 +17,7 @@ osmosis-1-genesis-0 2/2 Running 0 37m registry-7f9f9f9f9f-2q2q2 1/1 Running 0 37m ``` -## 4.2) Connect to the cluster -Once the pods are in `Running` state, you can port forward all the nodes to local host with handy scripts -```bash -cd getting-started/ - -# Download the port-forward script -curl -Ls https://raw.githubusercontent.com/cosmology-tech/starship/main/scripts/port-forward.sh > port-forward.sh -# Make it executable -chmod +x port-forward.sh -# Run it with the config file -./port-forward.sh --config=starship.yaml -``` - -This will forward the `ports` of the nodes in the `starship.yaml` to your local machine. - -## 4.3) Interact with the chains +## 4.2) Interact with the chains You can then interact with the chain on localhost at * Osmosis: http://localhost:26653/status * Cosmos: http://localhost:26657/status @@ -62,7 +47,7 @@ You can check the following endpoints on the registry service to get an idea of * http://localhost:8081/chains/osmosis-1/keys: all the mnemonics for osmosis chain * http://localhost:8081/chains/gaia-1/keys: all the mnemonics for osmosis chain -## 4.4) Check chain logs +## 4.3) Check chain logs You can check the logs of the chain with ```bash # Osmosis logs @@ -76,20 +61,15 @@ kubectl logs gaia-1-genesis-0 kubectl logs -f gaia-1-genesis-0 ``` -## 4.5) Cleanup +## 4.4) Cleanup Once you are done with playing around, cleanup the resources with ```bash # delete helm chart -helm delete tutorial +starship stop # cleanup port forwarding pkill -f "port-forward" ``` -Remove kind cluster (if used) with -```bash -kind delete clusters starship -``` - If you are using Docker Desktop for kubernetes cluster, please Disable it in Settings, Kubernetes diff --git a/docs/pages/get-started/step-5.mdx b/docs/pages/get-started/step-5.mdx deleted file mode 100644 index 01aa3144..00000000 --- a/docs/pages/get-started/step-5.mdx +++ /dev/null @@ -1,48 +0,0 @@ -# **Step 5:** All in one place - -## TLDR -We have created some handy example directory for the tutorial you just went through. -You can find it at [examples/tutorial](https://github.com/cosmology-tech/starship/tree/main/examples/getting-started). -Directory structure is as follows -```bash -Makefile -configs/ - starship.yaml - tiny-starship.yaml -scripts/ - dev-setup.sh - port-forward.sh -README.md -``` - -Download the example directory with [URL](https://download-directory.github.io/?url=https%3A%2F%2Fgithub.com%2Fcosmology-tech%2Fstarship%2Ftree%2Fmain%2Fexamples%2Fgetting-started) - -```bash -mkdir tldr-getting-started/ - -# copy the downloaded zip file to the directory -unzip ~/Downloads/cosmology-tech\ starship\ main\ examples-getting-started.zip -d tldr-getting-started/ -``` - -Now you can run the commands from the example directory -```bash -cd tldr-getting-started/ - -# Install dependencies, install starship helm chart, create kind cluster -make clean setup - -# Install the starship instance and run port-forward -make start -# OR, if you are low on resources on local machine -make start-tiny - -# Stop the cluster with -make stop -``` - -Checkout the README.md for more details on the commands, you can even run the commands individually, if some commands are having trouble. - -Once you are done, you can all the resources with -```bash -make clean -```