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

refactoring for cluster as submodule #8

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
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 .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -363,4 +363,4 @@ z.sh
volumes/
backup/
docker-compose.yaml

.venv
23 changes: 18 additions & 5 deletions plebnet_generate.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
# Generates docker-compose for n nodes.
#!/usr/bin/env python3
# Generates docker-compose from command line.
#
# For each service identified at command line, this we identify other dependent services and add them to the config.

# +
from omegaconf import OmegaConf
import sys

sys.path.append('.')
sys.path.append("/usr/local/lib/python3.7/site-packages")
sys.path.append("/usr/local/lib/python3.8/site-packages")
sys.path.append("/usr/local/lib/python3.9/site-packages")
sys.path.append("/usr/local/lib/python3.10/site-packages")
sys.path.append("/usr/local/lib/python3.11/site-packages")
#print(sys.path)

from omegaconf import OmegaConf

architectures = {
"Intel x64": 'x86_64-linux-gnu',
Expand All @@ -12,8 +23,7 @@
'ARM64 linux': 'aarch64-linux-gnu',
}

from omegaconf import OmegaConf

# +
cli_args = OmegaConf.from_cli()

try:
Expand Down Expand Up @@ -62,7 +72,10 @@ def get_service_values(i, node_counts, **kwargs):
for service in list(conf.services):
service_nodes = node_counts[service]
print(service, service_nodes)
for i in range(service_nodes):
# print(type(service))
# print(type(service_nodes))
int_node_count = int(service_nodes)
for i in range(int_node_count):
service_values = get_service_values(i, node_counts, TRIPLET=triplet)
service_name = '{}-{}'.format(service, str(i))
conf.services[service_name] = get_service(
Expand Down
16 changes: 8 additions & 8 deletions up-generic.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
#This is for internal testing only
: ${TRIPLET:=x86_64-linux-gnu}
: ${bitcoind=1}
: ${bitcoind=5}
: ${lnd=1}
: ${tor=1}

python plebnet_generate.py TRIPLET=$TRIPLET bitcoind=$bitcoind lnd=$lnd tor=$tor
$(which python3) plebnet_generate.py TRIPLET=$TRIPLET bitcoind=$bitcoind lnd=$lnd tor=$tor

#Remove
docker-compose down
Expand All @@ -16,17 +15,18 @@ sudo rm -rf volumes
mkdir volumes
for (( i=0; i<=$bitcoind-1; i++ ))
do
mkdir volumes/bitcoin_datadir_$i
mkdir -p volumes/bitcoin_datadir_$i
done
for (( i=0; i<=$lnd-1; i++ ))
do
mkdir volumes/lnd_datadir_$i
mkdir -p volumes/lnd_datadir_$i
done
rm -rf volumes/tor_*dir_*
for (( i=0; i<=$tor-1; i++ ))
do
mkdir volumes/tor_datadir_$i
mkdir volumes/tor_servicesdir_$i
mkdir volumes/tor_torrcdir_$i
mkdir -p volumes/tor_datadir_$i
mkdir -p volumes/tor_servicesdir_$i
mkdir -p volumes/tor_torrcdir_$i
done

docker-compose build --build-arg TRIPLET=$TRIPLET
Expand Down