Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
runs-on: ubuntu-latest
needs: test-multiple-go-versions
# Until we have developer environments, we don't need the images built on other that main branches.
if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'push-image')
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

strategy:
matrix:
# Build dev & prod images
Expand Down
2 changes: 2 additions & 0 deletions build/Dockerfile.debian.dev
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,6 @@ RUN go get -d -v ./app/pocket
RUN go build -o /usr/local/bin/pocket ./app/pocket
RUN go build -tags=debug -o /usr/local/bin/client ./app/client

RUN go build -o /usr/local/bin/cluster-manager ./build/localnet/cluster-manager

CMD ["/usr/local/bin/pocket"]
5 changes: 5 additions & 0 deletions build/docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.0.0.30] - 2023-03-31

- Improve LocalNet documentation by adding a TLDR commands to provision LocalNet with `kind`.
- Include `cluster-manager` to `-dev` flavor of container images.

## [0.0.0.29] - 2023-03-30

- `cluster-manager` now waits for `v1-validator001` to be online AND responsive by checking the `/v1/health` endpoint (dogfooding)
Expand Down
46 changes: 34 additions & 12 deletions build/localnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

This guide shows how to deploy a LocalNet using [pocket-operator](https://github.com/pokt-network/pocket-operator).

- [TLDR](#tldr)
- [Dependencies](#dependencies)
- [Choosing Kubernetes Distribution](#choosing-kubernetes-distribution)
- [Enabling Kubernetes For Docker Desktop](#enabling-kubernetes-for-docker-desktop)
- [How to create Kind Kubernetes cluster](#how-to-create-kind-kubernetes-cluster)
- [LocalNet](#localnet)
- [Starting LocalNet](#starting-localnet)
- [Viewing Logs](#viewing-logs)
Expand All @@ -24,28 +25,49 @@ This guide shows how to deploy a LocalNet using [pocket-operator](https://github
- [Full Cleanup](#full-cleanup)
- [Code Structure](#code-structure)


## TLDR

If you feel adventurous, and you know what you're doing, here is a rapid guide to start LocalNet:

1. Install Docker
2. Install Kind (e.g., `brew install kind`)
3. Create Kind cluster (e.g., `kind create cluster`)
4. Start LocalNet (e.g., `make localnet_up`)

Otherwise, please continue with the full guide.

## Dependencies

All necessary dependencies, except Kubernetes cluster, are installed automatically when running `make install_cli_deps`. The following dependencies are required:
All necessary dependencies, except Docker and Kubernetes cluster, are installed automatically when running `make install_cli_deps`. The following dependencies are required for LocalNet to function:

1. [tilt](https://docs.tilt.dev/install.html)
2. `Kubernetes cluster`: refer to [Choosing Kubernetes Distribution](#choosing-kubernetes-distribution) section for more details.
3. `kubectl`: CLI is required and should be configured to access the cluster. This should happen automatically if using Docker Desktop, Rancher Desktop, k3s, k3d, minikube, etc.
4. [helm](https://helm.sh/docs/intro/install): required to template the yaml manifests for the dependencies (e.g. postgres, grafana). Installation instructions available .
2. [Docker](https://docs.docker.com/engine/install/) or [Docker Desktop](https://www.docker.com/products/docker-desktop/)
3. `Kubernetes cluster`: refer to [Choosing Kubernetes Distribution](#choosing-kubernetes-distribution) section for more details.
4. `kubectl`: CLI is required and should be configured to access the cluster. This should happen automatically if using Docker Desktop, Rancher Desktop, k3s, k3d, minikube, etc.
5. [helm](https://helm.sh/docs/intro/install): required to template the YAML manifests for the dependencies (e.g., Postgres, Grafana). Installation instructions available.

### Choosing Kubernetes Distribution

tl;dr If you are not familiar with kubernetes, we highly recommend using [kind](https://kind.sigs.k8s.io/) - the official Kubernetes distribution that runs inside docker containers. It is what most of the core team uses.
While [any Kubernetes distribution](https://docs.tilt.dev/choosing_clusters.html) should work, we've had success and recommend to use [Kind](https://kind.sigs.k8s.io/docs/user/quick-start/#installation). To run Kind Kubernetes clusters, you need to have [Docker](https://www.docker.com/products/docker-desktop/) installed.

If you have a personal preference, any kubernetes distribution should work. We've seen some people use [Rancher Desktop](https://rancherdesktop.io/), a GUI powered by a popular distribution `k3s`, but it has also led to some issues.
#### How to create Kind Kubernetes cluster

Here is a list of alternative set ups that should work: docs.tilt.dev/choosing_clusters.html
Kind depends solely on Docker. To install Kind, follow [this page](https://kind.sigs.k8s.io/docs/user/quick-start/#installation).

### Enabling Kubernetes For Docker Desktop
Create a new cluster:

You may need to manually enable Kubernetes if using Docker Desktop:
```bash
kind create cluster
```

Make sure your Kubernetes context is pointed to new kind cluster:

```bash
kubectl config current-context
```

![Docker desktop kubernetes](https://user-images.githubusercontent.com/1892194/216165581-1372e2b8-c630-4211-8ced-5ec59b129330.png)
should return `kind-kind`. Now you can start LocalNet!

## LocalNet

Expand Down Expand Up @@ -109,7 +131,7 @@ make localnet_client_debug

### Addresses and keys on LocalNet

You can find private keys and addresses for all actors in the [private-keys.yaml](./manifests/private-keys.yaml) file. They have been pre-generated and follow a specific pattern - they start with pre-determined numbers for easier troubleshooting and debugging.
You can find private keys and addresses for all actors in the [private-keys.yaml](./manifests/private-keys.yaml) file. They have been pre-generated and follow a specific pattern they start with pre-determined numbers for easier troubleshooting and debugging.

Addresses begin with `YYYXX` number, where `YYY` is a number of an actor and `XX` is [a type of actor](../../shared/core/types/proto/actor.proto#L7).

Expand Down
7 changes: 7 additions & 0 deletions docs/development/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Please note that this repository is under very active development and breaking c
- [Running LocalNet](#running-localnet)
- [\[Advanced\] Kubernetes](#advanced-kubernetes)
- [\[Basic\] Docker Compose](#basic-docker-compose)
- [Build a container image from development's branch](#build-a-container-image-from-developments-branch)
- [TODO: Improvements to be added by the core team](#todo-improvements-to-be-added-by-the-core-team)
- [Profiling](#profiling)
- [Code Organization](#code-organization)
Expand Down Expand Up @@ -243,6 +244,12 @@ make client_start && make client_connect
✔ TriggerNextView # Commit the transaction
```

### Build a container image from development's branch

_tl;dr Attach the `push-image` label to the PR to build and push an image from your branch_

If you need to test or run non-merged pocket code outside LocalNet, for example on DevNet, TestNet or somewhere else, you can force the CI to build and push a container image. This can be done by attaching a `push-image` label on your Pull Request. Next CI build will push the container image to our [container registry](../releases/README.md#container-images).

### TODO: Improvements to be added by the core team

A lot of features have been added since this doc was first added. See `docs/demo`. We should update it to:
Expand Down
9 changes: 4 additions & 5 deletions docs/releases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,19 @@ For example, `X.Y.Z[-<pre_release_tag][+branch_name][+short_hash][+dirty]` is th

## Container Images

Our images are hosted on Github's Container Registry (GHCR) and are available at `ghcr.io/poktnetwork/pocket-v1`. You can find the list of latest images [here](https://github.com/pokt-network/pocket/pkgs/container/pocket-v1).
Our images are hosted on GitHub’s Container Registry (GHCR) and are available at `ghcr.io/poktnetwork/pocket-v1`. You can find the list of latest images [here](https://github.com/pokt-network/pocket/pkgs/container/pocket-v1).

### Tags

Code built from the default branch (i.e. `main`) is tagged as `latest`.
Code built from the default branch (i.e., `main`) is tagged as `latest`.

Code built from commits in Pull Requests, is tagged as `pr-<number>`, as well as `sha-<7 digit sha>`.
Code built from commits in Pull Requests, is tagged as `pr-<number>`, as well as `sha-<7 digit sha>`. You can optionally build an image from a Pull Request by attaching a `push-image` label to the pull request to force CI to upload a container image from a non-main branch.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should protocol-infra docs reference this convention?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Once releases are managed, they will be tagged with the version number (e.g. `v0.0.1-alpha.pre.1`).
Once releases are managed, they will be tagged with the version number (e.g., `v0.0.1-alpha.pre.1`).

### Extended images with additional tooling

Extended images with additional tooling are built to aid in troubleshoot and debugging. The extended image is formatted as `<tag>-dev`. For example, `latest-dev`, or `pr-123-dev`.

## [TODO] Magefile build system

Once the V1 implementation reaches the stage of testable binaries, we are looking to use [Mage](https://magefile.org/) which is being tracked in [pocket/issues/43](https://github.com/pokt-network/pocket/issues/43) that'll inject a version with the `-version` flag.
Expand Down