mirror of
https://github.com/runcitadel/core.git
synced 2024-12-28 15:42:59 +00:00
More work on service managment
This commit is contained in:
parent
69bae236c4
commit
06aa65fa92
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -49,6 +49,5 @@ db/citadel-seed/*
|
||||||
|
|
||||||
!**/*.license
|
!**/*.license
|
||||||
services/installed.json
|
services/installed.json
|
||||||
services/installed.yaml
|
services/installed.yml
|
||||||
|
|
||||||
use-core-upstream
|
|
||||||
|
|
|
@ -77,8 +77,8 @@ services:
|
||||||
networks:
|
networks:
|
||||||
default:
|
default:
|
||||||
ipv4_address: $BITCOIN_IP
|
ipv4_address: $BITCOIN_IP
|
||||||
lnd:
|
lightning:
|
||||||
container_name: lnd
|
container_name: lightning
|
||||||
image: lightninglabs/lnd:v0.14.2-beta@sha256:8318a24a3ad7319e424253eb56efcbf38e820ebc6d6b6edeec6a8a4e3e9314a0
|
image: lightninglabs/lnd:v0.14.2-beta@sha256:8318a24a3ad7319e424253eb56efcbf38e820ebc6d6b6edeec6a8a4e3e9314a0
|
||||||
user: 1000:1000
|
user: 1000:1000
|
||||||
depends_on:
|
depends_on:
|
||||||
|
|
12
scripts/configure
vendored
12
scripts/configure
vendored
|
@ -124,18 +124,6 @@ def parse_dotenv(file_path):
|
||||||
exit(1)
|
exit(1)
|
||||||
return envVars
|
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 ############
|
############ Generate configuration variables ############
|
||||||
##########################################################
|
##########################################################
|
||||||
|
|
|
@ -9,8 +9,7 @@ events/signals
|
||||||
logs/*
|
logs/*
|
||||||
app-data/*
|
app-data/*
|
||||||
apps/networking.json
|
apps/networking.json
|
||||||
use-core-upstream
|
|
||||||
nginx/*
|
nginx/*
|
||||||
services/installed.json
|
services/installed.yml
|
||||||
apps/sourceMap.json
|
apps/sourceMap.json
|
||||||
apps/.updateignore
|
apps/.updateignore
|
||||||
|
|
18
services/bitcoin/core.yml
Normal file
18
services/bitcoin/core.yml
Normal file
|
@ -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
|
18
services/bitcoin/knots.yml
Normal file
18
services/bitcoin/knots.yml
Normal file
|
@ -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
|
21
services/lightning/lnd.yml
Normal file
21
services/lightning/lnd.yml
Normal file
|
@ -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
|
|
@ -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
|
# 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
|
# If the file doesn't exist, put [] in it, then run the code below
|
||||||
try:
|
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)
|
installed = yaml.safe_load(stream)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
installed = {}
|
installed = {
|
||||||
|
"electrum": "electrs",
|
||||||
|
"lightning": "lnd",
|
||||||
|
"bitcoin": "knots"
|
||||||
|
}
|
||||||
installed[name] = implementation
|
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)
|
yaml.dump(installed, stream, sort_keys=False)
|
||||||
|
|
||||||
|
|
||||||
|
@ -77,25 +81,31 @@ def uninstallService(name):
|
||||||
yaml.dump(compose, stream, sort_keys=False)
|
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
|
# Save the service name in nodeRoot/services/installed.json, which is a JSON file with a list of installed services
|
||||||
try:
|
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)
|
installed = yaml.safe_load(stream)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
installed = {}
|
installed = {
|
||||||
|
"electrum": "electrs",
|
||||||
|
"lightning": "lnd",
|
||||||
|
"bitcoin": "knots"
|
||||||
|
}
|
||||||
try:
|
try:
|
||||||
del installed[name]
|
del installed[name]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
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)
|
yaml.dump(installed, stream, sort_keys=False)
|
||||||
|
|
||||||
# install all services from installed.json
|
# install all services from installed.json
|
||||||
def installServices():
|
def installServices():
|
||||||
try:
|
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)
|
installed = yaml.safe_load(stream)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
installed = {
|
installed = {
|
||||||
"electrum": "electrs"
|
"electrum": "electrs",
|
||||||
|
"lightning": "lnd",
|
||||||
|
"bitcoin": "knots"
|
||||||
}
|
}
|
||||||
|
|
||||||
for key, value in installed.items():
|
for key, value in installed.items():
|
||||||
|
|
|
@ -35,8 +35,8 @@ blockfilterindex=1
|
||||||
peerbloomfilters=1
|
peerbloomfilters=1
|
||||||
peerblockfilters=1
|
peerblockfilters=1
|
||||||
|
|
||||||
# Bitcoin Knots only
|
# Bitcoin Knots only, Bitcoin Core simply ignores this
|
||||||
<knots-reindex-auto>
|
reindex=auto
|
||||||
|
|
||||||
<external-ip>
|
<external-ip>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user