Skip to content

Commit

Permalink
Merge branch 'main' into chaos_mesh_integration
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla committed Mar 20, 2024
2 parents b024f3a + 20eddf2 commit 9c85559
Show file tree
Hide file tree
Showing 51 changed files with 962 additions and 1,004 deletions.
8 changes: 7 additions & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
# Contribution Guidelines

Hello! Thanks for your interest in joining the mission to accelerate the mass adoption of crypto for personal
sovereignty! We welcome contributions from anyone on the internet, and are grateful for even the smallest of fixes!
sovereignty! We welcome contributions from anyone on the internet.

Note, however, that all the contributions are subject to review, and not every contribution is guaranteed to be merged.
It is highly advised to reach out to developers (for example, by creating an issue) before preparing a significant
change in the codebase, and explicitly confirm that this contribution will be considered for merge. Otherwise, it is
possible to discover that a feature you have spent some time on does not align with the core team vision or capacity to
maintain a high quality of given submission long term.

## Ways to contribute

Expand Down
4 changes: 0 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@ COPY --from=builder /app/target/release/tester .
FROM debian:stable-slim as executor-runtime

COPY /node/tools/docker_binaries/executor /node/
COPY /node/tools/k8s_configs/ /node/k8s_config
COPY /node/tools/docker-config/ /node/docker_config
COPY docker-entrypoint.sh /node/
COPY k8s_entrypoint.sh /node/

WORKDIR /node
RUN chmod +x docker-entrypoint.sh
RUN chmod +x k8s_entrypoint.sh

ENTRYPOINT ["./docker-entrypoint.sh"]
Expand Down
50 changes: 9 additions & 41 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
.PHONY: node nodes_config docker_nodes_config node_docker consensus_docker_example clean clean_docker addresses_file blank_configs
NODE?=0
DOCKER_IP=172.12.0.10
IP?=127.0.0.1:3054
EXECUTABLE_NODE_DIR=node/tools
NODES=4
SEED_NODES=1

# Locally run commands

node:
export RUST_LOG=INFO && cd ${EXECUTABLE_NODE_DIR}/nodes-config/node_${NODE} && cargo run -- --database ../../database/node_${NODE}
export RUST_LOG=INFO && cd ${EXECUTABLE_NODE_DIR}/nodes-config/${IP} && cargo run -- --database ../../database/node_${NODE}

nodes_config:
cd ${EXECUTABLE_NODE_DIR} && cargo run --bin localnet_config -- --input-addrs addresses.txt --output-dir nodes-config
Expand All @@ -21,28 +20,12 @@ docker_build_executor:
docker_node_image:
docker build -t consensus-node --target=executor-runtime .

docker_nodes_config:
cd ${EXECUTABLE_NODE_DIR} && cargo run --bin localnet_config -- --input-addrs docker-config/addresses.txt --output-dir docker-config

docker_node:
$(MAKE) docker_node_image
docker run -d --name consensus-node-${NODE} --env NODE_ID="consensus-node-${NODE}" consensus-node

consensus_docker_example:
mkdir -p ${EXECUTABLE_NODE_DIR}/docker-config
cd ${EXECUTABLE_NODE_DIR}/docker-config && rm -rf addresses.txt && echo 172.12.0.10:3054 >> addresses.txt && echo 172.12.0.11:3054 >> addresses.txt
$(MAKE) docker_nodes_config
$(MAKE) docker_node_image
docker-compose up -d

stop_docker_nodes:
docker stop consensus-node-1 consensus-node-2
# Kubernetes commands

start_k8s_nodes:
cd ${EXECUTABLE_NODE_DIR} && cargo run --bin deployer generate-config --nodes ${NODES}
$(MAKE) docker_node_image
minikube image load consensus-node:latest
cd ${EXECUTABLE_NODE_DIR} && cargo run --release --bin deployer deploy --nodes ${NODES} --seed-nodes ${SEED_NODES}
cd ${EXECUTABLE_NODE_DIR} && cargo run --release --bin deployer -- --nodes ${NODES} --seed-nodes ${SEED_NODES}

install_chaos_mesh:
curl -sSL https://mirrors.chaos-mesh.org/v2.6.3/install.sh | bash
Expand All @@ -55,26 +38,11 @@ clean: clean_docker clean_k8s

clean_k8s:
rm -rf ${EXECUTABLE_NODE_DIR}/k8s_configs
kubectl delete deployments --all
kubectl delete pods --all
kubectl delete deployments --all -n consensus
kubectl delete pods --all -n consensus
kubectl delete services --all -n consensus
kubectl delete namespaces consensus

clean_docker:
docker rm -f consensus-node-1
docker rm -f consensus-node-2
docker network rm -f node-net
docker image rm -f consensus-node
docker image rm -f consensus-node:latest
docker image rm -f test-suite

addresses_file:
mkdir -p ${EXECUTABLE_NODE_DIR}/docker-config
cd ${EXECUTABLE_NODE_DIR}/docker-config && \
rm -rf addresses.txt && \
touch addresses.txt && \
for n in $$(seq 0 $$((${NODES} - 1))); do echo 0.0.0.$$n:3054 >> addresses.txt; done

blank_configs: addresses_file docker_node_configs
for n in $$(seq 0 $$((${NODES} - 1))); do \
jq '.publicAddr = "0.0.0.0:3054"' node/tools/docker-config/nodes-config/node_$$n/config.json | \
jq '.gossipStaticOutbound = "[]"' > node/tools/docker-config/nodes-config/node_$$n/config.tmp && \
mv -f node/tools/docker-config/nodes-config/node_$$n/config.tmp node/tools/docker-config/nodes-config/node_$$n/config.json; \
done
34 changes: 0 additions & 34 deletions compose.yaml

This file was deleted.

3 changes: 1 addition & 2 deletions k8s_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
# This file works as an entrypoint of the kubernetes cluster running the node binary copied inside of it.

cd k8s_config/${NODE_ID}
export RUST_LOG=INFO
../../executor $@
./executor $@
Loading

0 comments on commit 9c85559

Please sign in to comment.