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

[Infrastructure] LocalNet on Kubernetes #354

Merged
merged 77 commits into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
f7a82ba
tilt + PO + localnet
okdas Nov 12, 2022
62683a5
--wip-- [skip ci]
okdas Nov 12, 2022
67132eb
--wip-- [skip ci]
okdas Nov 15, 2022
764c722
observability stack
okdas Nov 19, 2022
c2c0fd5
--wip-- [skip ci]
okdas Nov 21, 2022
2960669
grafana is auto provisioned with observability stack
okdas Nov 22, 2022
1455a40
--wip-- [skip ci]
okdas Nov 29, 2022
ca9ebeb
stabilizing tilt
okdas Dec 6, 2022
1fd8bb1
--wip-- [skip ci]
okdas Dec 7, 2022
048947c
more changes to grafana, tilt and docs
okdas Dec 7, 2022
2fb9f04
more docs
okdas Dec 10, 2022
e66bd74
let tilt ignore the same stuff as git, so it wont get triggered by ve…
okdas Dec 10, 2022
cc95782
note about changing pocket-operator code
okdas Dec 10, 2022
5198b1d
Merge branch 'main' into dk-localnet-pocket-operator
okdas Dec 10, 2022
f0aa697
Update Makefile
okdas Dec 14, 2022
8b50310
Update Makefile
okdas Dec 14, 2022
52a44d7
Update Makefile
okdas Dec 14, 2022
846ba6c
requested changes so far
okdas Dec 14, 2022
558768e
more requested changes
okdas Dec 14, 2022
03f3ba3
Merge branch 'main' into dk-localnet-pocket-operator
okdas Dec 27, 2022
5b824af
some requested changes
okdas Dec 28, 2022
d53eded
Merge branch 'main' into dk-localnet-pocket-operator
okdas Jan 4, 2023
5225c3e
add mermaid diagram
okdas Jan 5, 2023
b2cb5af
clarify location of the config files
okdas Jan 5, 2023
80d790d
--wip-- [skip ci]
okdas Jan 5, 2023
c94cb4f
localnet without operator
okdas Jan 10, 2023
78f09da
Merge branch 'main' into dk-localnet-pocket-operator
okdas Jan 10, 2023
372bb6c
latest config
okdas Jan 11, 2023
b92bc03
Merge branch 'main' into dk-localnet-pocket-operator
okdas Jan 11, 2023
1b103d7
fully working operatorless localnet
okdas Jan 11, 2023
0f354d9
auto update now works too
okdas Jan 11, 2023
7631fd3
--wip-- [skip ci]
okdas Jan 12, 2023
1d57ceb
bump documentation
okdas Jan 14, 2023
ac40457
change config a bit
okdas Jan 14, 2023
06c8ef3
this is not needed anymore
okdas Jan 19, 2023
cba72f7
Merge branch 'main' into dk-localnet-pocket-operator
okdas Jan 19, 2023
a778f2c
can scale validators automatically
okdas Jan 20, 2023
2e47e2c
change keys
okdas Jan 28, 2023
fa24420
Merge branch 'main' into dk-localnet-pocket-operator
okdas Jan 28, 2023
ebd5dd8
also replace pubkeys
okdas Jan 28, 2023
defca3b
complete changing the keys // tests passed
okdas Jan 30, 2023
03e5a04
bring bck state hashes
okdas Jan 30, 2023
36b1e5f
Merge branch 'main' into dk-localnet-pocket-operator
okdas Jan 31, 2023
19d6ba4
wip
okdas Jan 31, 2023
fae2775
wip
okdas Jan 31, 2023
28c2ee0
add/change changelogs
okdas Jan 31, 2023
27d0daf
create localnet_config.yaml when it doesn exist
okdas Feb 1, 2023
294ae17
Updated gitinore for Tilt
Olshansk Jan 31, 2023
bc846f3
Made the Makefile help command work
Olshansk Feb 1, 2023
792f973
Renamed the readme file and fixed default formatting
Olshansk Feb 1, 2023
25a4a36
Update error messages
Olshansk Feb 1, 2023
cc96bf3
Update error messages
Olshansk Feb 1, 2023
8364117
WIP commit - review + removing $ everywhere
Olshansk Feb 1, 2023
1261079
Update all the documentation
Olshansk Feb 1, 2023
f75fde2
feat(localnet): initcontainer to wait for postgres
deblasis Feb 2, 2023
b46d2d3
also install helm
okdas Feb 2, 2023
7188a2e
requested changes so far
okdas Feb 2, 2023
1bf5fd4
more requested changes
okdas Feb 3, 2023
54a7629
update links
okdas Feb 3, 2023
7ec2217
include demo
okdas Feb 3, 2023
33a45cf
Update build/localnet/README.md
okdas Feb 3, 2023
469e67a
Update build/localnet/README.md
okdas Feb 3, 2023
a8df9d9
Update build/localnet/README.md
okdas Feb 3, 2023
5a5c042
Update build/localnet/README.md
okdas Feb 3, 2023
62561c6
Update build/localnet/Tiltfile
okdas Feb 3, 2023
46d3f74
Update build/localnet/README.md
okdas Feb 3, 2023
2135d26
Update build/localnet/README.md
okdas Feb 3, 2023
fe98bce
Update build/localnet/README.md
okdas Feb 3, 2023
1e59e9c
Update build/localnet/Tiltfile
okdas Feb 3, 2023
1c17e68
clarify postgres ports
okdas Feb 3, 2023
f3d083b
Merge branch 'main' into dk-localnet-pocket-operator
okdas Feb 3, 2023
8e864f3
fix changelogs
okdas Feb 3, 2023
93851be
oops, this got lost!
okdas Feb 3, 2023
3347fbe
Update build/localnet/README.md
okdas Feb 6, 2023
b8ba1c9
Merge branch 'main' into dk-localnet-pocket-operator
okdas Feb 6, 2023
5a1325b
change date on changelog
okdas Feb 6, 2023
da4a402
redundant changelog
okdas Feb 6, 2023
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
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ install_cli_deps: ## Installs `protoc-gen-go`, `mockgen`, 'protoc-go-inject-tag'
go install "github.com/favadi/protoc-go-inject-tag@latest"
go install "github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.11.0"
curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash
Copy link
Contributor

Choose a reason for hiding this comment

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

On my machine (Windows with Ubuntu 20.04 running in WSL2)

this command fails with

 @alex  curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash
+ brew bundle --file=-
Error: Formulae dependency graph sorting failed (likely due to a circular dependency):
binutils: ["linux-headers@5.15", "glibc", "zlib", "gcc@5"]
zstd: ["linux-headers@5.15", "glibc", "lz4", "xz", "zlib", "gcc@5"]
Please run the following commands and try again:
  brew update
  brew uninstall --ignore-dependencies --force binutils zstd
  brew install binutils zstd

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I guess that helm CLI binary is a requirement that should be considered in the install_cli_deps as well

Copy link
Member Author

@okdas okdas Feb 2, 2023

Choose a reason for hiding this comment

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

this command fails with

Oh no, I was sure tilt install script can be executed on Linux because the same script is offered for both macOS and Linux. https://docs.tilt.dev/install.html

Looking at the script, even on Linux, they check if brew CLI is available. That is probably because Homebrew supports Linux. When brew cli is available, they try to install tilt with it. Do you use brew a lot on your Linux WSL2 set up? It is possible your local brew set up might be out of date, have you tried to run the commands mentioned to fix this?

It would be easier to install tilt with go install like we do with other binaries, but unfortunately this is not supported.

Also, I guess that helm CLI binary is a requirement that should be considered in the install_cli_deps as well

Thanks for mentioning this, I added a helm install script to that make target. 🫡

curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash

.PHONY: develop_start
develop_start: ## Run all of the make commands necessary to develop on the project
Expand Down Expand Up @@ -445,7 +446,7 @@ clear_genesis_and_config: ## Clear the genesis and config files for LocalNet

.PHONY: localnet_up
Olshansk marked this conversation as resolved.
Show resolved Hide resolved
localnet_up: ## Starts up a k8s LocalNet with all necessary dependencies (tl;dr `tilt up`)
tilt up
tilt up --file=build/localnet/Tiltfile

.PHONY: localnet_client_debug
localnet_client_debug: ## Opens a `client debug` cli to interact with blockchain (e.g. change pacemaker mode, reset to genesis, etc). Though the node binary updates automatiacally on every code change (i.e. hot reloads), if client is already open you need to re-run this command to execute freshly compiled binary.
Expand All @@ -465,8 +466,8 @@ localnet_logs_validators_follow: ## Outputs logs from all validators and follows

.PHONY: localnet_down
localnet_down: ## Stops LocalNet and cleans up dependencies (tl;dr `tilt down` + postgres database)
tilt down
kubectl delete pvc data-dependencies-postgresql-0
tilt down --file=build/localnet/Tiltfile
kubectl delete pvc --ignore-not-found=true data-dependencies-postgresql-0

Olshansk marked this conversation as resolved.
Show resolved Hide resolved
.PHONY: check_cross_module_imports
check_cross_module_imports: ## Lists cross-module imports
Expand Down
File renamed without changes.
104 changes: 62 additions & 42 deletions build/localnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
This guide shows how to deploy a LocalNet using [pocket-operator](https://github.com/pokt-network/pocket-operator).
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

- [Dependencies](#dependencies)
- [Enabling Kubernetes](#enabling-kubernetes)
- [Choosing Kubernetes Distribution](#choosing-kubernetes-distribution)
- [Enabling Kubernetes For Docker Desktop](#enabling-kubernetes-for-docker-desktop)
- [LocalNet](#localnet)
- [Starting LocalNet](#starting-localnet)
- [Viewing Logs](#viewing-logs)
Expand All @@ -13,30 +14,40 @@ This guide shows how to deploy a LocalNet using [pocket-operator](https://github
- [Stopping \& Clean Resources](#stopping--clean-resources)
- [Interacting w/ LocalNet](#interacting-w-localnet)
- [Make Targets](#make-targets)
- [Addresses and keys on LocalNet](#addresses-and-keys-on-localnet)
- [How to change configuration files](#how-to-change-configuration-files)
- [How does it work?](#how-does-it-work)
- [Troubleshooting](#troubleshooting)
- [Why?](#why)
- [Force Trigger an Update](#force-trigger-an-update)
- [Force Restart](#force-restart)
- [Full Cleanup](#full-cleanup)
- [Docker Desktop](#docker-desktop)
- [How to change configuration files](#how-to-change-configuration-files)
- [Code Structure](#code-structure)

## Dependencies

All necessary dependencies, except Kubernetes cluster, are installed automatically when running `make install_cli_deps`. The following dependencies are required:

1. [tilt](https://docs.tilt.dev/install.html)
- Note: automatically installed when running `make install_cli_deps`
2. `Kubernetes cluster`: [installation options](https://docs.tilt.dev/choosing_clusters.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`: required to template the yaml manifests for the dependencies (e.g. postgres, grafana). Installation instructions available [here](https://helm.sh/docs/intro/install).
4. [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

While any Kubernetes distribution should work, we verified that LocalNet works on:
- [Rancher Desktop](https://rancherdesktop.io/), which is GUI powered by a popular distribution `k3s`.
- [kind](https://kind.sigs.k8s.io/) - official Kubernetes distribution that runs inside docker containers.

Here is a list of alternative set ups that should work: https://docs.tilt.dev/choosing_clusters.html

### Enabling Kubernetes
### Enabling Kubernetes For Docker Desktop

You may need to manually enable Kubernetes if using Docker desktop:
You may need to manually enable Kubernetes if using Docker Desktop:

![Docker desktop kubernetes](https://user-images.githubusercontent.com/1892194/216165581-1372e2b8-c630-4211-8ced-5ec59b129330.png)


okdas marked this conversation as resolved.
Show resolved Hide resolved
## LocalNet

### Starting LocalNet
Expand All @@ -45,6 +56,8 @@ You may need to manually enable Kubernetes if using Docker desktop:
make localnet_up
```

This action will create a file called `localnet_config.yaml` in the root of the repo if it doesn't exist. The default configuration can be found in [Tiltfile](Tiltfile#L11).

### Viewing Logs

The developer can then view logs either from a browser or terminal.
Expand All @@ -67,6 +80,11 @@ When starting a k8s LocalNet, `localnet_config.yaml` is generated (with default

The config file can be modified to scale the number of actors up/down. As long as `localnet_up` is running, the changes should be automatically applied within seconds.

Olshansk marked this conversation as resolved.
Show resolved Hide resolved
[Watch demo](https://user-images.githubusercontent.com/4950477/216490690-8ac4c16a-25e1-4202-b2e5-03215030c82c.mp4)

![Watch demo](https://user-images.githubusercontent.com/4950477/216490690-8ac4c16a-25e1-4202-b2e5-03215030c82c.mp4)

okdas marked this conversation as resolved.
Show resolved Hide resolved

### Stopping & Clean Resources

```bash
Expand All @@ -93,17 +111,24 @@ Open a `client debug` cli. It allows to interact with blockchain, e.g. change pa
make localnet_client_debug
```

## How does it work?
### Addresses and keys on LocalNet

[tilt](https://tilt.dev/) reads the [`Tiltfile`](../../Tiltfile), where LocalNet configs are specified. `Tiltfile` is written in [Starlark](https://github.com/bazelbuild/starlark), a dialect of Python.
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.
Olshansk marked this conversation as resolved.
Show resolved Hide resolved

The k8s manifests that `tilt` submits to the cluster can be found in [this directory](./):
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). For example, `420043b854e78f2d5f03895bba9ef16972913320` is a validator #420.
okdas marked this conversation as resolved.
Show resolved Hide resolved

- **[dependencies](./dependencies/)**: a helm chart that installs all necessary dependencies to run and observe LocalNet (postgresql, prometheus, grafana, etc).
- **[4 Validators](./v1-validator-template.sh)**: The validator binary that runs inside of the container gets updated automatically and process restarted on each code change (i.e. hot reloads).
- **[V1 CLI client](./cli-client.yaml)**: This binary that can be used to perform debug operations. Run `make localnet_client_debug` to execute commands such as `ResetToGenesis` or `TogglePacemakerMode`. This binary is also automatically updated when you make changes to the codebase.

Tilt continuously monitors files on local filesystem, and it rebuilds the binary and distributes it to the pods on every code change. This allows developers to iterate on the code and see the changes immediately.
## How to change configuration files

Currently, we provide [a config file](./manifests/configs.yaml) that is shared between all validators and a pocket client. We make use of `pocket` client feature that allows us to override configuration via environment variables. You can check a [validator template](./templates/v1-validator-template.yaml.tpl) as a reference.

## How does it work?

[tilt](https://tilt.dev/) reads the [`Tiltfile`](./Tiltfile), where LocalNet configs are specified. `Tiltfile` is written in [Starlark](https://github.com/bazelbuild/starlark), a dialect of Python.

The k8s manifests that `tilt` submits to the cluster can be found in [this directory](./). Please refer to [code structure](#code-structure) for more details where different parts are located.

Tilt continuously monitors files on local filesystem in [specific directories](Tiltfile#L27), and it rebuilds the binary and distributes it to the pods on every code change. This allows developers to iterate on the code and see the changes immediately.
okdas marked this conversation as resolved.
Show resolved Hide resolved

## Troubleshooting

Expand Down Expand Up @@ -132,34 +157,29 @@ If force triggering an update didn't work, try the following:

If a force restart didn't help, try rebuilding local kubernetes cluster using the tool you're managing your cluster with (e.g. Docker Desktop, Rancher Desktop, k3s, k3d, minikube, etc).

### Docker Desktop

# TODO_IN_THIS_COMMIT

## How to change configuration files

Currently, we provide [a config file](./configs.yaml) that is shared between all validators and a pocket client. We make use of `pocket` client feature that allows us to override configuration via environment variables. You can look at [one of the validators](../../build/localnet/v1-validator1.yaml) as a reference.

## Code Structure

```bash
build/localnet # TODO_IN_THIS_COMMIT
├── README.md # TODO_IN_THIS_COMMIT
├── cli-client.yaml # TODO_IN_THIS_COMMIT
├── configs.yaml # TODO_IN_THIS_COMMIT
├── dependencies # TODO_IN_THIS_COMMIT
│   ├── Chart.yaml # TODO_IN_THIS_COMMIT
│   ├── dashboards # TODO_IN_THIS_COMMIT
│   │   ├── README.md # TODO_IN_THIS_COMMIT
│   │   └── raintree-telemetry-graphs.json # TODO_IN_THIS_COMMIT
│   ├── requirements.yaml # TODO_IN_THIS_COMMIT
│   ├── templates # TODO_IN_THIS_COMMIT
│   │   ├── _helpers.tpl # TODO_IN_THIS_COMMIT
│   │   ├── dashboards.yml # TODO_IN_THIS_COMMIT
│   │   └── datasources.yml # TODO_IN_THIS_COMMIT
│   └── values.yaml # TODO_IN_THIS_COMMIT
├── network.yaml # TODO_IN_THIS_COMMIT
├── private-keys.yaml # TODO_IN_THIS_COMMIT
├── v1-validator-template.sh # TODO_IN_THIS_COMMIT
└── v1-validator-template.yaml # TODO_IN_THIS_COMMIT
build/localnet
├── README.md # This file
├── Tiltfile # This file
okdas marked this conversation as resolved.
Show resolved Hide resolved
├── dependencies # Helm chart that installs all the dependencies needed to run and observe LocalNet
okdas marked this conversation as resolved.
Show resolved Hide resolved
│   ├── Chart.yaml # Main file of the helm chart, contains metadata
│   ├── dashboards # Directory with all the dashboards that are automatically imported to Grafana
│   │   ├── README.md # README file with instructions on how to add a new dashboard
│   │   └── raintree-telemetry-graphs.json # Raintree Telemetry dashboard
│   ├── requirements.yaml # Specifies dependencies of the chart, this allows us to install all the dependencies with a single command
│   ├── templates # Additional Kubernetes manifests that we need to connect different dependencies together
│   │   ├── _helpers.tpl
│   │   ├── dashboards.yml
│   │   └── datasources.yml
│   └── values.yaml # Configuration values that override the default values of the dependencies, this allows us to connect dependencies together and make them available to our LocalNet services
├── manifests # Static YAML Kubernetes manifests that are consumed by `tilt`
│   ├── cli-client.yaml # Pod that has the latest binary of the pocket client. Makefile targets run CLI in this pod.
│   ├── configs.yaml # Location of the config files (default configs for all validators and a genesis file) that are shared between all actors
okdas marked this conversation as resolved.
Show resolved Hide resolved
│   ├── network.yaml # Networking configuration that is shared between different actors, currently a Service that points to all validators
│   └── private-keys.yaml # Pre-generated private keys for everything
okdas marked this conversation as resolved.
Show resolved Hide resolved
└── templates # Templates for Kubernetes manifests that are consumed by `tilt`
├── v1-validator-template.sh # Shell script that generates Kubenetes manifests for validators, consumed by `tilt`
└── v1-validator-template.yaml.tpl # Template for a single validator, consumed by `v1-validator-template.sh`
```
52 changes: 31 additions & 21 deletions Tiltfile → build/localnet/Tiltfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,29 @@ load("ext://helm_resource", "helm_resource", "helm_repo")
load("ext://namespace", "namespace_create")
load("ext://restart_process", "docker_build_with_restart")

tiltfile_dir = os.path.dirname(config.main_dir)
Copy link
Member

Choose a reason for hiding this comment

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

Thank you for doing this! I think it's going to make the codebase much easier to understand

root_dir = os.path.dirname(tiltfile_dir + '/../..')
localnet_config_path = root_dir + "/localnet_config.yaml"

# Create localnet config file from defaults, and if some default configuration doesn't exist in it - populate with default values
localnet_config_defaults = {"validators": {"count": 4}}

localnet_config_file = read_yaml(
"localnet_config.yaml", default=localnet_config_defaults
localnet_config_path, default=localnet_config_defaults
)

localnet_config = {}
localnet_config.update(localnet_config_defaults)
localnet_config.update(localnet_config_file)

# Create a default config file if it does not exist
if localnet_config_file != localnet_config:
print("Updating localnet_config.yaml")
local("cat - > localnet_config.yaml", stdin=encode_yaml(localnet_config))
if (localnet_config_file != localnet_config) or (not os.path.exists(localnet_config_path)):
print("Updating " + localnet_config_path + " with defaults")
local("cat - > " + localnet_config_path, stdin=encode_yaml(localnet_config))

# List of directories Tilt watches to trigger a hot-reload on changes
# List of directories Tilt watches to trigger a hot-reload on changes. Potentially can be replaced with a list of excluded directories.
okdas marked this conversation as resolved.
Show resolved Hide resolved
deps = [
"app",
# 'build',
"consensus",
"p2p",
"persistance",
Expand All @@ -34,6 +38,8 @@ deps = [
"logger",
]

deps_full_path = [root_dir + "/" + depdir for depdir in deps]

# Deploy dependencies (grafana, postgres, prometheus) and wire it up with localnet
helm_repo(
"grafana",
Expand All @@ -51,30 +57,34 @@ helm_repo(

# Avoid downloading dependencies if no missing/outdated charts
check_helm_dependencies = local(
"helm dependency list build/localnet/dependencies | awk '{print $4}' | grep -Ev 'ok|STATUS'"
"helm dependency list dependencies | awk '{print $4}' | grep -Ev 'ok|STATUS'"
)
helm_dependencies_not_ok_count = len(str(check_helm_dependencies).splitlines())
if helm_dependencies_not_ok_count > 1:
local("helm dependency update build/localnet/dependencies")
local("helm dependency update dependencies")

k8s_yaml(helm("build/localnet/dependencies", name="dependencies", namespace="default"))
k8s_yaml(helm("dependencies", name="dependencies", namespace="default"))

# Builds the pocket binary. Note target OS is linux, because no matter what your OS is, container runs linux natively or in VM.
local_resource(
"pocket: Watch & Compile",
"GOOS=linux go build -o bin/pocket-linux app/pocket/main.go",
deps=deps,
"GOOS=linux go build -o {root_dir}/bin/pocket-linux {root_dir}/app/pocket/main.go".format(
root_dir=root_dir
),
deps=deps_full_path,
)
local_resource(
"debug client: Watch & Compile",
"GOOS=linux go build -tags=debug -o bin/client-linux app/client/*.go",
deps=deps,
"GOOS=linux go build -tags=debug -o {root_dir}/bin/client-linux {root_dir}/app/client/*.go".format(
root_dir=root_dir
),
deps=deps_full_path,
)

# Builds and maintains the validator container image after the binary is built on local machine, restarts a process on code change
docker_build_with_restart(
"validator-image",
".",
root_dir,
dockerfile_contents="""FROM debian:bullseye
COPY bin/pocket-linux /usr/local/bin/pocket
WORKDIR /
Expand All @@ -91,7 +101,7 @@ WORKDIR /
# Builds and maintains the client container image after the binary is built on local machine
docker_build_with_restart(
"client-image",
".",
root_dir,
dockerfile_contents="""FROM debian:bullseye
WORKDIR /
COPY bin/client-linux /usr/local/bin/client
Expand All @@ -105,19 +115,19 @@ COPY bin/client-linux /usr/local/bin/client
# Pushes localnet manifests to the cluster.
k8s_yaml(
[
"build/localnet/private-keys.yaml",
"build/localnet/configs.yaml",
"build/localnet/cli-client.yaml",
"build/localnet/network.yaml",
"manifests/private-keys.yaml",
"manifests/configs.yaml",
"manifests/cli-client.yaml",
"manifests/network.yaml",
local(
"build/localnet/v1-validator-template.sh %s"
"templates/v1-validator-template.sh %s"
% localnet_config["validators"]["count"],
quiet=True,
),
]
)

# # Exposes postgres port to 5432 on the host machine.
# An example of how to expose postgres port to 5432 on the host machine in case developer wants to connect to postgres directly
okdas marked this conversation as resolved.
Show resolved Hide resolved
# k8s_resource(new_name='postgres',
# objects=['pocket-database:postgresql'],
# extra_pod_selectors=[{'cluster-name': 'pocket-database'}],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ spec:
imagePullPolicy: IfNotPresent
command: ["sleep", "infinity"]
env:
- name: POCKET_P2P_IS_CLIENT_ONLY
value: "true"
- name: CONFIG_PATH
value: "/var/pocket/config/config.json"
- name: GENESIS_PATH
Expand Down Expand Up @@ -62,7 +64,6 @@ spec:
volumes:
- name: config-volume
configMap:
# should client have it's own config?
name: v1-validator-default-config
defaultMode: 420
- name: genesis-volume
Expand Down
File renamed without changes.
File renamed without changes.
Loading