-
Notifications
You must be signed in to change notification settings - Fork 33
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
Changes from 6 commits
Commits
Show all changes
77 commits
Select commit
Hold shift + click to select a range
f7a82ba
tilt + PO + localnet
okdas 62683a5
--wip-- [skip ci]
okdas 67132eb
--wip-- [skip ci]
okdas 764c722
observability stack
okdas c2c0fd5
--wip-- [skip ci]
okdas 2960669
grafana is auto provisioned with observability stack
okdas 1455a40
--wip-- [skip ci]
okdas ca9ebeb
stabilizing tilt
okdas 1fd8bb1
--wip-- [skip ci]
okdas 048947c
more changes to grafana, tilt and docs
okdas 2fb9f04
more docs
okdas e66bd74
let tilt ignore the same stuff as git, so it wont get triggered by ve…
okdas cc95782
note about changing pocket-operator code
okdas 5198b1d
Merge branch 'main' into dk-localnet-pocket-operator
okdas f0aa697
Update Makefile
okdas 8b50310
Update Makefile
okdas 52a44d7
Update Makefile
okdas 846ba6c
requested changes so far
okdas 558768e
more requested changes
okdas 03f3ba3
Merge branch 'main' into dk-localnet-pocket-operator
okdas 5b824af
some requested changes
okdas d53eded
Merge branch 'main' into dk-localnet-pocket-operator
okdas 5225c3e
add mermaid diagram
okdas b2cb5af
clarify location of the config files
okdas 80d790d
--wip-- [skip ci]
okdas c94cb4f
localnet without operator
okdas 78f09da
Merge branch 'main' into dk-localnet-pocket-operator
okdas 372bb6c
latest config
okdas b92bc03
Merge branch 'main' into dk-localnet-pocket-operator
okdas 1b103d7
fully working operatorless localnet
okdas 0f354d9
auto update now works too
okdas 7631fd3
--wip-- [skip ci]
okdas 1d57ceb
bump documentation
okdas ac40457
change config a bit
okdas 06c8ef3
this is not needed anymore
okdas cba72f7
Merge branch 'main' into dk-localnet-pocket-operator
okdas a778f2c
can scale validators automatically
okdas 2e47e2c
change keys
okdas fa24420
Merge branch 'main' into dk-localnet-pocket-operator
okdas ebd5dd8
also replace pubkeys
okdas defca3b
complete changing the keys // tests passed
okdas 03e5a04
bring bck state hashes
okdas 36b1e5f
Merge branch 'main' into dk-localnet-pocket-operator
okdas 19d6ba4
wip
okdas fae2775
wip
okdas 28c2ee0
add/change changelogs
okdas 27d0daf
create localnet_config.yaml when it doesn exist
okdas 294ae17
Updated gitinore for Tilt
Olshansk bc846f3
Made the Makefile help command work
Olshansk 792f973
Renamed the readme file and fixed default formatting
Olshansk 25a4a36
Update error messages
Olshansk cc96bf3
Update error messages
Olshansk 8364117
WIP commit - review + removing $ everywhere
Olshansk 1261079
Update all the documentation
Olshansk f75fde2
feat(localnet): initcontainer to wait for postgres
deblasis b46d2d3
also install helm
okdas 7188a2e
requested changes so far
okdas 1bf5fd4
more requested changes
okdas 54a7629
update links
okdas 7ec2217
include demo
okdas 33a45cf
Update build/localnet/README.md
okdas 469e67a
Update build/localnet/README.md
okdas a8df9d9
Update build/localnet/README.md
okdas 5a5c042
Update build/localnet/README.md
okdas 62561c6
Update build/localnet/Tiltfile
okdas 46d3f74
Update build/localnet/README.md
okdas 2135d26
Update build/localnet/README.md
okdas fe98bce
Update build/localnet/README.md
okdas 1e59e9c
Update build/localnet/Tiltfile
okdas 1c17e68
clarify postgres ports
okdas f3d083b
Merge branch 'main' into dk-localnet-pocket-operator
okdas 8e864f3
fix changelogs
okdas 93851be
oops, this got lost!
okdas 3347fbe
Update build/localnet/README.md
okdas b8ba1c9
Merge branch 'main' into dk-localnet-pocket-operator
okdas 5a1325b
change date on changelog
okdas da4a402
redundant changelog
okdas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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", | ||
|
@@ -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", | ||
|
@@ -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 / | ||
|
@@ -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 | ||
|
@@ -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'}], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 theinstall_cli_deps
as wellThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. Whenbrew
cli is available, they try to installtilt
with it. Do you usebrew
a lot on your Linux WSL2 set up? It is possible your localbrew
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
withgo install
like we do with other binaries, but unfortunately this is not supported.Thanks for mentioning this, I added a helm install script to that make target. 🫡