diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2a4d0b80c..7fd705fd7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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') strategy: matrix: # Build dev & prod images diff --git a/build/Dockerfile.debian.dev b/build/Dockerfile.debian.dev index 79993e409..2ec71e003 100644 --- a/build/Dockerfile.debian.dev +++ b/build/Dockerfile.debian.dev @@ -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"] diff --git a/build/docs/CHANGELOG.md b/build/docs/CHANGELOG.md index e4f85e442..b28d06bcf 100644 --- a/build/docs/CHANGELOG.md +++ b/build/docs/CHANGELOG.md @@ -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) diff --git a/build/localnet/README.md b/build/localnet/README.md index 6482798dd..bd59bfe67 100644 --- a/build/localnet/README.md +++ b/build/localnet/README.md @@ -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) @@ -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 @@ -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). diff --git a/docs/development/README.md b/docs/development/README.md index 67ba440d4..5809cb438 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -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) @@ -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: diff --git a/docs/releases/README.md b/docs/releases/README.md index 9b0fd381a..adbbdcb1f 100644 --- a/docs/releases/README.md +++ b/docs/releases/README.md @@ -26,20 +26,19 @@ For example, `X.Y.Z[-`, as well as `sha-<7 digit sha>`. +Code built from commits in Pull Requests, is tagged as `pr-`, 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. -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 `-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.