Skip to content

Commit

Permalink
docs: make docs part for starship v2 (#449)
Browse files Browse the repository at this point in the history
* make docs part for starship v2

* update final steps

* add section for starship cli
  • Loading branch information
Anmol1696 committed May 23, 2024
1 parent 74b9309 commit 0d4e48c
Show file tree
Hide file tree
Showing 9 changed files with 88 additions and 125 deletions.
1 change: 1 addition & 0 deletions docs/pages/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"index": "Introduction",
"get-started": "Get Started",
"config": "Configuration",
"cli": "CLI",
"tests": "E2E Tests",
"advanced": "Advanced Usage"
}
3 changes: 3 additions & 0 deletions docs/pages/cli/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"index": "Introduction"
}
29 changes: 29 additions & 0 deletions docs/pages/cli/index.mdx
Original file line number Diff line number Diff line change
@@ -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
```


1 change: 0 additions & 1 deletion docs/pages/get-started/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
9 changes: 3 additions & 6 deletions docs/pages/get-started/step-1.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
58 changes: 30 additions & 28 deletions docs/pages/get-started/step-2.mdx
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
```
36 changes: 18 additions & 18 deletions docs/pages/get-started/step-3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -56,11 +54,6 @@ relayers:
- osmosis-1
- gaia-1

explorer:
enabled: true
ports:
rest: 8080

registry:
enabled: true
ports:
Expand All @@ -76,21 +69,28 @@ 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
# OR, to watch the 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
```
28 changes: 4 additions & 24 deletions docs/pages/get-started/step-4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
48 changes: 0 additions & 48 deletions docs/pages/get-started/step-5.mdx

This file was deleted.

0 comments on commit 0d4e48c

Please sign in to comment.