diff --git a/.gitignore b/.gitignore index e730179..5b4e864 100644 --- a/.gitignore +++ b/.gitignore @@ -49,6 +49,5 @@ db/citadel-seed/* !**/*.license services/installed.json -services/installed.yaml +services/installed.yml -use-core-upstream diff --git a/docker-compose.yml b/docker-compose.yml index b9f1bcc..6d8a1e1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -77,8 +77,8 @@ services: networks: default: ipv4_address: $BITCOIN_IP - lnd: - container_name: lnd + lightning: + container_name: lightning image: lightninglabs/lnd:v0.14.2-beta@sha256:8318a24a3ad7319e424253eb56efcbf38e820ebc6d6b6edeec6a8a4e3e9314a0 user: 1000:1000 depends_on: diff --git a/scripts/configure b/scripts/configure index 5d49c95..d4f6b46 100755 --- a/scripts/configure +++ b/scripts/configure @@ -124,18 +124,6 @@ def parse_dotenv(file_path): exit(1) return envVars -KNOTS_REINDEX_AUTO="reindex=auto" -BITCOIN_CORE_IMAGE="lncm/bitcoind:v22.0@sha256:37a1adb29b3abc9f972f0d981f45e41e5fca2e22816a023faa9fdc0084aa4507" -if os.path.isfile('../use-core-upstream') or os.path.isfile('./use-core-upstream'): - KNOTS_REINDEX_AUTO="" - # Also, open the docker-compose file and replace the image of the bitcoin service - # with the upstream version of bitcoin core - with open(os.path.join(CITADEL_ROOT, "docker-compose.yml"), 'r') as file: - docker_compose_yml = yaml.safe_load(file) - docker_compose_yml['services']['bitcoin']['image'] = BITCOIN_CORE_IMAGE - with open(os.path.join(CITADEL_ROOT, "docker-compose.yml"), 'w') as file: - yaml.dump(docker_compose_yml, file, sort_keys=False) - ########################################################## ############ Generate configuration variables ############ ########################################################## diff --git a/scripts/update/.updateignore b/scripts/update/.updateignore index 145995f..907a96e 100644 --- a/scripts/update/.updateignore +++ b/scripts/update/.updateignore @@ -9,8 +9,7 @@ events/signals logs/* app-data/* apps/networking.json -use-core-upstream nginx/* -services/installed.json +services/installed.yml apps/sourceMap.json apps/.updateignore diff --git a/services/bitcoin/core.yml b/services/bitcoin/core.yml new file mode 100644 index 0000000..bec641b --- /dev/null +++ b/services/bitcoin/core.yml @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors +# +# SPDX-License-Identifier: GPL-3.0-or-later + +bitcoin: + container_name: bitcoin + image: lncm/bitcoind:v22.0@sha256:37a1adb29b3abc9f972f0d981f45e41e5fca2e22816a023faa9fdc0084aa4507 + depends_on: + - tor + volumes: + - ${PWD}/bitcoin:/data/.bitcoin + restart: on-failure + stop_grace_period: 1m + ports: + - $BITCOIN_P2P_PORT:$BITCOIN_P2P_PORT + networks: + default: + ipv4_address: $BITCOIN_IP diff --git a/services/bitcoin/knots.yml b/services/bitcoin/knots.yml new file mode 100644 index 0000000..8d32077 --- /dev/null +++ b/services/bitcoin/knots.yml @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: 2021-2022 Citadel and contributors +# +# SPDX-License-Identifier: GPL-3.0-or-later + +bitcoin: + container_name: bitcoin + image: nolim1t/bitcoinknots:v22.0.knots20211108@sha256:a475da2b2ecda55fcc65ea23e1a36c58b2c10549f1c3d3bb3c31c7dda1127354 + depends_on: + - tor + volumes: + - ${PWD}/bitcoin:/data/.bitcoin + restart: on-failure + stop_grace_period: 1m + ports: + - $BITCOIN_P2P_PORT:$BITCOIN_P2P_PORT + networks: + default: + ipv4_address: $BITCOIN_IP \ No newline at end of file diff --git a/services/lightning/lnd.yml b/services/lightning/lnd.yml new file mode 100644 index 0000000..36c8ae3 --- /dev/null +++ b/services/lightning/lnd.yml @@ -0,0 +1,21 @@ +lightning: + container_name: lightning + image: lightninglabs/lnd:v0.14.2-beta@sha256:8318a24a3ad7319e424253eb56efcbf38e820ebc6d6b6edeec6a8a4e3e9314a0 + user: 1000:1000 + depends_on: + - tor + - bitcoin + volumes: + - ${PWD}/lnd:/data/.lnd + - ${PWD}/walletpassword:/walletpassword + environment: + HOME: /data + restart: on-failure + stop_grace_period: 5m30s + ports: + - 9735:9735 + - $LND_REST_PORT:$LND_REST_PORT + - $LND_GRPC_PORT:$LND_GRPC_PORT + networks: + default: + ipv4_address: $LND_IP \ No newline at end of file diff --git a/services/manage.py b/services/manage.py index 1319a0b..11aa89a 100755 --- a/services/manage.py +++ b/services/manage.py @@ -48,12 +48,16 @@ def setService(name, implementation): # Save the service name in nodeRoot/services/installed.json, which is a JSON file with a list of installed services # If the file doesn't exist, put [] in it, then run the code below try: - with open(os.path.join(nodeRoot, "services", "installed.yaml"), 'r') as stream: + with open(os.path.join(nodeRoot, "services", "installed.yml"), 'r') as stream: installed = yaml.safe_load(stream) except FileNotFoundError: - installed = {} + installed = { + "electrum": "electrs", + "lightning": "lnd", + "bitcoin": "knots" + } installed[name] = implementation - with open(os.path.join(nodeRoot, "services", "installed.yaml"), 'w') as stream: + with open(os.path.join(nodeRoot, "services", "installed.yml"), 'w') as stream: yaml.dump(installed, stream, sort_keys=False) @@ -77,25 +81,31 @@ def uninstallService(name): yaml.dump(compose, stream, sort_keys=False) # Save the service name in nodeRoot/services/installed.json, which is a JSON file with a list of installed services try: - with open(os.path.join(nodeRoot, "services", "installed.yaml"), 'r') as stream: + with open(os.path.join(nodeRoot, "services", "installed.yml"), 'r') as stream: installed = yaml.safe_load(stream) except FileNotFoundError: - installed = {} + installed = { + "electrum": "electrs", + "lightning": "lnd", + "bitcoin": "knots" + } try: del installed[name] except KeyError: pass - with open(os.path.join(nodeRoot, "services", "installed.yaml"), 'w') as stream: + with open(os.path.join(nodeRoot, "services", "installed.yml"), 'w') as stream: yaml.dump(installed, stream, sort_keys=False) # install all services from installed.json def installServices(): try: - with open(os.path.join(nodeRoot, "services", "installed.yaml"), 'r') as stream: + with open(os.path.join(nodeRoot, "services", "installed.yml"), 'r') as stream: installed = yaml.safe_load(stream) except FileNotFoundError: installed = { - "electrum": "electrs" + "electrum": "electrs", + "lightning": "lnd", + "bitcoin": "knots" } for key, value in installed.items(): diff --git a/templates/bitcoin-sample.conf b/templates/bitcoin-sample.conf index 956e1e1..2b99d55 100644 --- a/templates/bitcoin-sample.conf +++ b/templates/bitcoin-sample.conf @@ -35,8 +35,8 @@ blockfilterindex=1 peerbloomfilters=1 peerblockfilters=1 -# Bitcoin Knots only - +# Bitcoin Knots only, Bitcoin Core simply ignores this +reindex=auto