Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update examples #502

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions examples/getting-started-bash/Makefile
Original file line number Diff line number Diff line change
@@ -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)
64 changes: 64 additions & 0 deletions examples/getting-started-bash/README.md
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: getting-started
version: v0.2.6

chains:
- id: osmosis-1
name: osmosis
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: getting-started
version: v0.2.6

chains:
- id: osmosis-1
name: osmosis
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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
34 changes: 34 additions & 0 deletions examples/getting-started-js/configs/starship.yaml
Original file line number Diff line number Diff line change
@@ -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
52 changes: 52 additions & 0 deletions examples/getting-started-js/configs/tiny-starship.yaml
Original file line number Diff line number Diff line change
@@ -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"