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

1678820315/aaa87c7/618d46e: rebase for submodule cluster #7

Draft
wants to merge 14 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
91 changes: 91 additions & 0 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
SHELL := /bin/bash

PWD ?= pwd_unknown

THIS_FILE := $(lastword $(MAKEFILE_LIST))
export THIS_FILE
TIME := $(shell date +%s)
export TIME

ifeq ($(docker),)
DOCKER := $(shell which docker)
else
DOCKER := $(docker)
endif
export DOCKER

ifeq ($(compose),)
DOCKER_COMPOSE := $(shell which docker-compose)
else
DOCKER_COMPOSE := $(compose)
endif
export DOCKER_COMPOSE



PYTHON := $(shell which python)
export PYTHON
PYTHON2 := $(shell which python2)
export PYTHON2
PYTHON3 := $(shell which python3)
export PYTHON3

PIP := $(shell which pip)
export PIP
PIP2 := $(shell which pip2)
export PIP2
PIP3 := $(shell which pip3)
export PIP3

python_version_full := $(wordlist 2,4,$(subst ., ,$(shell python3 --version 2>&1)))
python_version_major := $(word 1,${python_version_full})
python_version_minor := $(word 2,${python_version_full})
python_version_patch := $(word 3,${python_version_full})

my_cmd.python.3 := $(PYTHON3) some_script.py3
my_cmd := ${my_cmd.python.${python_version_major}}

PYTHON_VERSION := ${python_version_major}.${python_version_minor}.${python_version_patch}
PYTHON_VERSION_MAJOR := ${python_version_major}
PYTHON_VERSION_MINOR := ${python_version_minor}

export python_version_major
export python_version_minor
export python_version_patch
export PYTHON_VERSION

# PROJECT_NAME defaults to name of the current directory.
ifeq ($(project),)
PROJECT_NAME := $(notdir $(PWD))
else
PROJECT_NAME := $(project)
endif
export PROJECT_NAME




.PHONY: venv
venv:
test -d .venv || $(PYTHON3) -m virtualenv .venv
( \
source .venv/bin/activate; pip install -r requirements.txt; \
);
@echo "To activate (venv)"
@echo "try:"
@echo ". .venv/bin/activate"
@echo "or:"
@echo "make test-venv"
##: test-venv source .venv/bin/activate; pip install -r requirements.txt;
test-venv:
# insert test commands here
test -d .venv || $(PYTHON3) -m virtualenv .venv
( \
source .venv/bin/activate; pip install -r requirements.txt; \
);
#######################
.PHONY: prune-network
prune-network:
$(DOCKER_COMPOSE) -p $(PROJECT_NAME) down
docker network rm $(PROJECT_NAME)_default 2>/dev/null || echo "retry..."
#######################
5 changes: 3 additions & 2 deletions bitcoin-signet/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ FROM debian:buster-slim as builder
ARG BITCOIN_VERSION=23.0
ARG TRIPLET=${TRIPLET}


#RUN apt-add-repository ppa:bitcoin/bitcoin && apt-get update && apt-get install bitcoin
#RUN /lib64/ld-linux-x86-64.so.2 /bin/chmod +x /bin/chmod

Expand All @@ -15,7 +14,9 @@ WORKDIR /tmp
# install bitcoin binaries
RUN BITCOIN_URL="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
BITCOIN_FILE="bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
wget -qO "${BITCOIN_FILE}" "${BITCOIN_URL}" && \
BITCOIN_SHA_URL="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS" && \
wget -qO "${BITCOIN_FILE}" "${BITCOIN_URL}" && wget -qO SHA256SUMS.asc "${BITCOIN_SHA_URL}" && \
grep "${BITCOIN_FILE}" SHA256SUMS.asc | sha256sum -c - && \
mkdir -p bin && \
tar -xzvf "${BITCOIN_FILE}" -C /tmp/bin --strip-components=2 "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-cli" "bitcoin-${BITCOIN_VERSION}/bin/bitcoind" "bitcoin-${BITCOIN_VERSION}/bin/bitcoin-wallet"

Expand Down
2 changes: 1 addition & 1 deletion bitcoin-signet/bitcoin.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ zmqpubrawblock=tcp://0.0.0.0:28332
zmqpubrawtx=tcp://0.0.0.0:28333
zmqpubhashblock=tcp://0.0.0.0:28334
signetchallenge=512102ee856c56a5aaadd1656f849bafa4c9dacc86a2878fe546c6189185f842ae2c1851ae
addnode=104.131.10.218:38333
addnode=104.131.10.218:38333
13 changes: 0 additions & 13 deletions bitcoin-signet/docker-entrypoint.sh

This file was deleted.

12 changes: 3 additions & 9 deletions docker-compose.yaml.template
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ networks: {}
services:
bitcoind:
build:
context: ./bitcoin-signet
context: ../bitcoin-signet
dockerfile: Dockerfile
args:
- TRIPLET=${TRIPLET}
Expand All @@ -25,10 +25,7 @@ services:
source: ${oc.env:PWD}/volumes/bitcoin_datadir_${bitcoind_i}
target: /root/.bitcoin/
lnd:
build:
context: ./lnd-signet
dockerfile: Dockerfile
image: playground-cluster-lnd
image: ghcr.io/plebnet-playground/playground-lnd:latest
links:
- bitcoind-${bitcoind_i}
- tor-${tor_i}
Expand Down Expand Up @@ -60,10 +57,7 @@ services:
target: /root/.lnd/
tor:
restart: unless-stopped
build:
context: ./tor
dockerfile: Dockerfile
image: playground-cluster-tor
image: ghcr.io/plebnet-playground/playground-tor:latest
container_name: playground-tor-${tor_i}
environment:
TRIPLET: '${TRIPLET}'
Expand Down
2 changes: 1 addition & 1 deletion lnd-signet/docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ if [[ "$@" = "lnd" ]]; then
exec lnd "--tor.targetipaddress=${localhostip}"
else
exec "$@"
fi
fi
59 changes: 0 additions & 59 deletions lnd-signet/docker-initwalletcreate.sh

This file was deleted.

24 changes: 0 additions & 24 deletions make-bitcoin-config.sh

This file was deleted.

43 changes: 0 additions & 43 deletions make-lnd-config.sh

This file was deleted.

4 changes: 2 additions & 2 deletions plebnet_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ def get_service_values(i, node_counts, **kwargs):
service_values,
conf.services[service])
# remove build for additional nodes
if i > 0:
conf.services[service_name].pop('build')
# if i > 0:
# conf.services[service_name].pop('build')
conf.services.pop(service)
try:
OmegaConf.resolve(conf)
Expand Down
22 changes: 0 additions & 22 deletions tor/docker-entrypoint.sh

This file was deleted.

5 changes: 0 additions & 5 deletions tor/torrc

This file was deleted.

25 changes: 13 additions & 12 deletions up-generic.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
#This is for internal testing only
if [ -z "$1" ]; then
$1=5
fi
: ${TRIPLET:=x86_64-linux-gnu}
: ${bitcoind=1}
: ${lnd=1}
: ${tor=1}
: ${bitcoind=$1}
: ${lnd=$1}
: ${tor=$1}

python plebnet_generate.py TRIPLET=$TRIPLET bitcoind=$bitcoind lnd=$lnd tor=$tor

#Remove
docker-compose down
sudo rm -rf volumes

docker-compose down

#Create Datafile
mkdir -p 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
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
Loading