Skip to content

Commit e745c44

Browse files
authored
Merge pull request #35 from PLEBNET-PLAYGROUND/compose-template
Compose template + change to TRIPLET syntax vs ARCH
2 parents 2798cfa + 745704f commit e745c44

File tree

12 files changed

+196
-55
lines changed

12 files changed

+196
-55
lines changed

.github/workflows/plebnet-playground.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ jobs:
4848
sudo apt install python python3
4949
sudo apt install -y mkdocs
5050
pip install -r docs/requirements.txt
51+
pip install -r requirements.txt
5152
make init report
5253
play
5354
make install
@@ -66,6 +67,7 @@ jobs:
6667
sudo apt install python python3
6768
sudo apt install -y mkdocs
6869
pip install -r docs/requirements.txt
70+
pip install -r requirements.txt
6971
make init report
7072
play
7173
make install

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*.sln.docstates
1212
/signet/*
1313
up.sh
14-
14+
docker-compose.yaml
1515
# User-specific files (MonoDevelop/Xamarin Studio)
1616
*.userprefs
1717

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,6 @@
22
"cSpell.words": [
33
"Plebnet",
44
"bitcoind"
5-
]
5+
],
6+
"cSpell.enabled": true
67
}

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,30 @@ cd plebnet-playground-docker
3232
| arm 32-bit linux | arm-linux-gnueabihf |
3333
| ARM64 linux | aarch64-linux-gnu |
3434

35-
36-
### Install and start containers (Intel x64 example)
35+
### Services
36+
| Service | Description |
37+
| ----------- | ----------- |
38+
| bitcoind | Bitcoin Core Daemon |
39+
| lnd | Lightning Labs LND Daemon |
40+
| tor | tor network daemon |
41+
| rtl | Ride The Lightning Daemon |
42+
| thunderhub | Thunderhub Lightning UI |
43+
| docs | MKDocs documentation |
44+
| notebook | Jupyter Notebook environment setup for lightning development |
45+
| dashboard | Jupyter Dashboard |
46+
47+
### Install and start all services (Intel x64 example)
3748
***
49+
50+
```sh
51+
TRIPLET=x86_64-linux-gnu ./install.sh
3852
```
39-
./install.sh x86_64-linux-gnu
40-
docker-compose up -d
53+
54+
### Install and start just the `bitcoind`,`lnd` services (comma seperate them)
55+
```sh
56+
TRIPLET=x86_64-linux-gnu services=bitcoind,lnd ./install.sh
4157
```
58+
4259
### Stop containers
4360
***
4461
```

bitcoin-signet/Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM debian:buster-slim as builder
22

33
ARG BITCOIN_VERSION=22.0
4-
ARG ARCH=${ARCH}
4+
ARG TRIPLET=${TRIPLET}
55

66

77
#RUN apt-add-repository ppa:bitcoin/bitcoin && apt-get update && apt-get install bitcoin
@@ -13,8 +13,8 @@ RUN apt-get update && \
1313
WORKDIR /tmp
1414

1515
# install bitcoin binaries
16-
RUN BITCOIN_URL="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-${ARCH}.tar.gz" && \
17-
BITCOIN_FILE="bitcoin-${BITCOIN_VERSION}-${ARCH}.tar.gz" && \
16+
RUN BITCOIN_URL="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
17+
BITCOIN_FILE="bitcoin-${BITCOIN_VERSION}-${TRIPLET}.tar.gz" && \
1818
BITCOIN_SHA_URL="https://bitcoincore.org/bin/bitcoin-core-${BITCOIN_VERSION}/SHA256SUMS" && \
1919
wget -qO "${BITCOIN_FILE}" "${BITCOIN_URL}" && wget -qO SHA256SUMS.asc "${BITCOIN_SHA_URL}" && \
2020
grep "${BITCOIN_FILE}" SHA256SUMS.asc | sha256sum -c - && \

btcd/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
ARG ARCH=amd64
1+
ARG TRIPLET=amd64
22
FROM golang:1.14-alpine3.12 AS build-container
33
USER root
44
ENV GO111MODULE=on
@@ -10,9 +10,9 @@ WORKDIR /root/btcd
1010
ARG BTCD_VERSION=63438c6d3661a7dec09013f7731035abdf1eb4bc
1111
RUN git fetch --all && git checkout ${BTCD_VERSION}
1212
RUN set -ex \
13-
&& if [ "${ARCH}" = "amd64" ]; then export GOARCH=amd64; fi \
14-
&& if [ "${ARCH}" = "arm32v7" ]; then export GOARCH=arm; fi \
15-
&& if [ "${ARCH}" = "arm64v8" ]; then export GOARCH=arm64; fi \
13+
&& if [ "${TRIPLET}" = "amd64" ]; then export GOARCH=amd64; fi \
14+
&& if [ "${TRIPLET}" = "arm32v7" ]; then export GOARCH=arm; fi \
15+
&& if [ "${TRIPLET}" = "arm64v8" ]; then export GOARCH=arm64; fi \
1616
&& echo "Compiling for $GOARCH" \
1717
&& go install -v . ./cmd/...
1818

docker-compose.yaml renamed to docker-compose.yaml.template

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@ version: "3.4"
22
networks: {}
33
services:
44
bitcoind:
5+
build:
6+
context: ./bitcoin-signet
7+
dockerfile: Dockerfile
8+
args:
9+
- TRIPLET=${TRIPLET}
10+
image: playground-docker-bitcoind
511
links:
612
- tor
713
depends_on:
814
- tor
915
restart: unless-stopped
1016
container_name: playground-bitcoind
1117
environment:
12-
ARCH: ${ARCH}
18+
TRIPLET: ${TRIPLET}
1319
GET_COINS_ON_STARTUP: 'true'
14-
build:
15-
context: ./bitcoin-signet
16-
dockerfile: Dockerfile
17-
args:
18-
- ARCH=${ARCH}
1920
expose:
2021
- "38332"
2122
- "38333"
@@ -24,7 +25,7 @@ services:
2425
- "38333:38333"
2526
volumes:
2627
- type: bind
27-
source: ${PWD}/volumes/bitcoin_datadir
28+
source: ${oc.env:PWD}/volumes/bitcoin_datadir
2829
target: /root/.bitcoin/
2930
lnd:
3031
links:
@@ -34,7 +35,7 @@ services:
3435
- bitcoind
3536
- tor
3637
environment:
37-
ARCH: '${ARCH}'
38+
TRIPLET: '${TRIPLET}'
3839
LND_ALIAS: 'NewNode'
3940
LND_LISTEN: 'playground-lnd:9735'
4041
LND_RPCLISTEN: 'playground-lnd:10009'
@@ -62,7 +63,7 @@ services:
6263
- "10009:10009"
6364
volumes:
6465
- type: bind
65-
source: ${PWD}/volumes/lnd_datadir
66+
source: ${oc.env:PWD}/volumes/lnd_datadir
6667
target: /root/.lnd/
6768
tor:
6869
restart: unless-stopped
@@ -73,18 +74,15 @@ services:
7374
expose:
7475
- 9050
7576
- 9051
76-
ports:
77-
- "9050:9050"
78-
- "9051:9051"
7977
volumes:
8078
- type: bind
81-
source: ${PWD}/volumes/tor_datadir
79+
source: ${oc.env:PWD}/volumes/tor_datadir
8280
target: /home/tor/.tor
8381
- type: bind
84-
source: ${PWD}/volumes/tor_torrcdir
82+
source: ${oc.env:PWD}/volumes/tor_torrcdir
8583
target: /usr/local/etc/tor
8684
- type: bind
87-
source: ${PWD}/volumes/tor_servicesdir
85+
source: ${oc.env:PWD}/volumes/tor_servicesdir
8886
target: /var/lib/tor/hidden_services
8987
thunderhub:
9088
container_name: playground-thub
@@ -105,11 +103,11 @@ services:
105103
LOG_LEVEL: debug
106104
volumes:
107105
- type: bind
108-
source: ${PWD}/volumes/lnd_datadir
106+
source: ${oc.env:PWD}/volumes/lnd_datadir
109107
target: /etc/lnd
110108
read_only: true
111109
- type: bind
112-
source: ${PWD}/volumes/thub_datadir
110+
source: ${oc.env:PWD}/volumes/thub_datadir
113111
target: /data
114112
ports:
115113
- '3001:3000'
@@ -138,15 +136,15 @@ services:
138136
image: shahanafarooqui/rtl:0.11.0
139137
volumes:
140138
- type: bind
141-
source: ${PWD}/volumes/lnd_datadir
139+
source: ${oc.env:PWD}/volumes/lnd_datadir
142140
target: /root/.lnd/
143141
read_only: true
144142
- type: bind
145-
source: ${PWD}/volumes/bitcoin_datadir
143+
source: ${oc.env:PWD}/volumes/bitcoin_datadir
146144
target: /etc/bitcoin/
147145
read_only: true
148146
- type: bind
149-
source: ${PWD}/volumes/rtl_datadir
147+
source: ${oc.env:PWD}/volumes/rtl_datadir
150148
target: /data
151149
notebook:
152150
container_name: playground-notebook
@@ -162,10 +160,10 @@ services:
162160
image: plebnet-playground-docker_dashboard
163161
volumes:
164162
- type: bind
165-
source: ${PWD}/notebooks
163+
source: ${oc.env:PWD}/notebooks
166164
target: /notebooks
167165
- type: bind
168-
source: ${PWD}/volumes/lnd_datadir
166+
source: ${oc.env:PWD}/volumes/lnd_datadir
169167
target: /root/.lnd/
170168
read_only: true
171169
environment:
@@ -194,10 +192,10 @@ services:
194192
image: plebnet-playground-docker_dashboard
195193
volumes:
196194
- type: bind
197-
source: ${PWD}/dashboard
195+
source: ${oc.env:PWD}/dashboard
198196
target: /dashboard
199197
- type: bind
200-
source: ${PWD}/volumes/lnd_datadir
198+
source: ${oc.env:PWD}/volumes/lnd_datadir
201199
target: /root/.lnd/
202200
read_only: true
203201
environment:
@@ -218,19 +216,19 @@ services:
218216
restart: unless-stopped
219217
container_name: playground-docs
220218
environment:
221-
- ARCH=${ARCH}
219+
- TRIPLET=${TRIPLET}
222220
build:
223-
context: ${PWD}/docs
221+
context: ${oc.env:PWD}/docs
224222
dockerfile: Dockerfile
225223
args:
226-
- ARCH=${ARCH}
224+
- TRIPLET=${TRIPLET}
227225
expose:
228226
- "8000"
229227
ports:
230228
- "8000:8000"
231229
volumes:
232230
- type: bind
233-
source: ${PWD}/docs
231+
source: ${oc.env:PWD}/docs
234232
target: /docs
235233

236234

docs/docs/index.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,19 @@ cd plebnet-playground-docker
3232
| arm 32-bit linux | arm-linux-gnueabihf |
3333
| ARM64 linux | aarch64-linux-gnu |
3434

35-
36-
### Install and start containers (Intel x64 example)
35+
### Install and start all services (Intel x64 example)
3736
***
37+
38+
```sh
39+
ARCH=x86_64-linux-gnu ./install.sh
3840
```
39-
./install.sh x86_64-linux-gnu
40-
docker-compose up -d
41+
42+
### Install and start just the `rtl` service (ride-the-lightning)
43+
***
44+
```sh
45+
ARCH=x86_64-linux-gnu services=rtl ./install.sh
4146
```
47+
4248
### Stop containers
4349
***
4450
```

install.sh

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,20 @@
1-
if [ -z "$1" ]
2-
then
3-
echo 'You must provide ARCH as first parameter'
4-
echo './install.sh x86_64-linux-gnu'
5-
exit;
6-
fi
1+
# if [ -z "$1" ]
2+
# then
3+
# echo 'You must provide TRIPLET as first parameter'
4+
# echo './install.sh x86_64-linux-gnu'
5+
# exit;
6+
# fi
7+
8+
# TRIPLET=$1
9+
10+
: ${TRIPLET:=x86_64-linux-gnu}
11+
: ${services:=Null}
712

8-
ARCH=$1
913
#Remove any old version
1014
docker-compose down
15+
16+
python plebnet_generate.py TRIPLET=$TRIPLET services=$services
17+
1118
sudo rm -rf volumes
1219

1320
#Create Datafile
@@ -19,5 +26,6 @@ mkdir volumes/rtl_datadir
1926
mkdir volumes/tor_datadir
2027
mkdir volumes/tor_servicesdir
2128
mkdir volumes/tor_torrcdir
22-
docker-compose build --build-arg ARCH=$ARCH
23-
docker-compose up -d
29+
30+
docker-compose build --build-arg TRIPLET=$TRIPLET
31+
docker-compose up --remove-orphans -d

0 commit comments

Comments
 (0)