mirror of
https://github.com/basicswap/basicswap.git
synced 2025-01-03 09:19:26 +00:00
Use basicswap-prepare to download releases for the docker image.
This commit is contained in:
parent
1185a5f33d
commit
9aa7e441ee
4 changed files with 24 additions and 34 deletions
27
Dockerfile
27
Dockerfile
|
@ -1,32 +1,10 @@
|
||||||
FROM ubuntu:18.10
|
FROM ubuntu:18.10
|
||||||
|
|
||||||
ENV LANG=C.UTF-8 \
|
ENV LANG=C.UTF-8 \
|
||||||
PARTICL_DATADIR="/coindata/particl" \
|
|
||||||
PARTICL_BINDIR="/opt/particl" \
|
|
||||||
LITECOIN_BINDIR="/opt/litecoin" \
|
|
||||||
LITECOIN_VERSION="0.17.1" \
|
|
||||||
DATADIRS="/coindata"
|
DATADIRS="/coindata"
|
||||||
|
|
||||||
RUN apt-get update; \
|
RUN apt-get update; \
|
||||||
apt-get install -y wget python3-pip curl gnupg unzip protobuf-compiler;
|
apt-get install -y wget python3-pip gnupg unzip protobuf-compiler;
|
||||||
|
|
||||||
RUN cd ~; \
|
|
||||||
wget https://github.com/particl/coldstakepool/archive/master.zip; \
|
|
||||||
unzip master.zip; \
|
|
||||||
cd coldstakepool-master; \
|
|
||||||
pip3 install .; \
|
|
||||||
pip3 install pyzmq plyvel protobuf;
|
|
||||||
|
|
||||||
RUN PARTICL_VERSION=0.18.1.0 PARTICL_VERSION_TAG= PARTICL_ARCH=x86_64-linux-gnu_nousb.tar.gz coldstakepool-prepare --update_core && \
|
|
||||||
mkdir -p ${LITECOIN_BINDIR} && cd ${LITECOIN_BINDIR} && \
|
|
||||||
wget https://download.litecoin.org/litecoin-${LITECOIN_VERSION}/linux/litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz && \
|
|
||||||
wget -O build.assert https://github.com/litecoin-project/gitian.sigs.ltc/raw/master/${LITECOIN_VERSION}-linux/thrasher/litecoin-linux-0.17-build.assert && \
|
|
||||||
wget -O build.assert.sig https://github.com/litecoin-project/gitian.sigs.ltc/raw/master/${LITECOIN_VERSION}-linux/thrasher/litecoin-linux-0.17-build.assert.sig && \
|
|
||||||
wget -qO - https://raw.githubusercontent.com/litecoin-project/litecoin/master/contrib/gitian-keys/thrasher-key.pgp | gpg --import - && \
|
|
||||||
gpg --verify build.assert.sig build.assert && \
|
|
||||||
grep " litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz\$" build.assert | sha256sum -c - && \
|
|
||||||
tar -xvf litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz -C ${LITECOIN_BINDIR} --strip-components 2 litecoin-${LITECOIN_VERSION}/bin/litecoind litecoin-${LITECOIN_VERSION}/bin/litecoin-cli && \
|
|
||||||
rm litecoin-${LITECOIN_VERSION}-x86_64-linux-gnu.tar.gz && rm *.assert*
|
|
||||||
|
|
||||||
# TODO: move coindata dir out of src dir
|
# TODO: move coindata dir out of src dir
|
||||||
RUN wget -O bs.zip https://github.com/tecnovert/basicswap/archive/master.zip; \
|
RUN wget -O bs.zip https://github.com/tecnovert/basicswap/archive/master.zip; \
|
||||||
|
@ -35,6 +13,9 @@ RUN wget -O bs.zip https://github.com/tecnovert/basicswap/archive/master.zip; \
|
||||||
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
|
protoc -I=basicswap --python_out=basicswap basicswap/messages.proto; \
|
||||||
pip3 install .;
|
pip3 install .;
|
||||||
|
|
||||||
|
# Download binaries, these will be part of the docker image
|
||||||
|
RUN basicswap-prepare -datadir=/opt --particl_mnemonic=none
|
||||||
|
|
||||||
RUN useradd -ms /bin/bash user; \
|
RUN useradd -ms /bin/bash user; \
|
||||||
mkdir /coindata && chown user /coindata
|
mkdir /coindata && chown user /coindata
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ def prepareCore(coin, version, settings, data_dir):
|
||||||
os.chmod(out_path, stat.S_IRWXU)
|
os.chmod(out_path, stat.S_IRWXU)
|
||||||
|
|
||||||
|
|
||||||
def prepareDataDir(coin, settings, data_dir, chain):
|
def prepareDataDir(coin, settings, data_dir, chain, particl_mnemonic):
|
||||||
core_settings = settings['chainclients'][coin]
|
core_settings = settings['chainclients'][coin]
|
||||||
data_dir = core_settings['datadir']
|
data_dir = core_settings['datadir']
|
||||||
|
|
||||||
|
@ -205,6 +205,9 @@ def prepareDataDir(coin, settings, data_dir, chain):
|
||||||
fp.write('zmqpubsmsg=tcp://127.0.0.1:{}\n'.format(settings['zmqport']))
|
fp.write('zmqpubsmsg=tcp://127.0.0.1:{}\n'.format(settings['zmqport']))
|
||||||
fp.write('spentindex=1')
|
fp.write('spentindex=1')
|
||||||
fp.write('txindex=1')
|
fp.write('txindex=1')
|
||||||
|
|
||||||
|
if particl_mnemonic == 'none':
|
||||||
|
fp.write('createdefaultmasterkey=1')
|
||||||
elif coin == 'litecoin':
|
elif coin == 'litecoin':
|
||||||
fp.write('prune=1000\n')
|
fp.write('prune=1000\n')
|
||||||
elif coin == 'bitcoin':
|
elif coin == 'bitcoin':
|
||||||
|
@ -232,7 +235,8 @@ def printHelp():
|
||||||
logger.info('--mainnet Run in mainnet mode.')
|
logger.info('--mainnet Run in mainnet mode.')
|
||||||
logger.info('--testnet Run in testnet mode.')
|
logger.info('--testnet Run in testnet mode.')
|
||||||
logger.info('--regtest Run in regtest mode.')
|
logger.info('--regtest Run in regtest mode.')
|
||||||
logger.info('--particl_mnemonic= Recovery phrase to use for the Particl wallet, default is randomly generated.')
|
logger.info('--particl_mnemonic= Recovery phrase to use for the Particl wallet, default is randomly generated,\n'
|
||||||
|
+ ' "none" to set autogenerate account mode.')
|
||||||
logger.info('--withcoin= Prepare system to run daemon for coin.')
|
logger.info('--withcoin= Prepare system to run daemon for coin.')
|
||||||
logger.info('--withoutcoin= Do not prepare system to run daemon for coin.')
|
logger.info('--withoutcoin= Do not prepare system to run daemon for coin.')
|
||||||
logger.info('--addcoin= Add coin to existing setup.')
|
logger.info('--addcoin= Add coin to existing setup.')
|
||||||
|
@ -343,7 +347,7 @@ def main():
|
||||||
'manage_daemon': True,
|
'manage_daemon': True,
|
||||||
'rpcport': 19792 + port_offset,
|
'rpcport': 19792 + port_offset,
|
||||||
'datadir': os.path.join(data_dir, 'particl'),
|
'datadir': os.path.join(data_dir, 'particl'),
|
||||||
'bindir': os.path.join(data_dir, 'bins', 'particl'),
|
'bindir': os.path.join(data_dir, 'bin', 'particl'),
|
||||||
'blocks_confirmed': 2,
|
'blocks_confirmed': 2,
|
||||||
'override_feerate': 0.002,
|
'override_feerate': 0.002,
|
||||||
},
|
},
|
||||||
|
@ -352,7 +356,7 @@ def main():
|
||||||
'manage_daemon': True if 'litecoin' in with_coins else False,
|
'manage_daemon': True if 'litecoin' in with_coins else False,
|
||||||
'rpcport': 19795 + port_offset,
|
'rpcport': 19795 + port_offset,
|
||||||
'datadir': os.path.join(data_dir, 'litecoin'),
|
'datadir': os.path.join(data_dir, 'litecoin'),
|
||||||
'bindir': os.path.join(data_dir, 'bins', 'litecoin'),
|
'bindir': os.path.join(data_dir, 'bin', 'litecoin'),
|
||||||
'use_segwit': True,
|
'use_segwit': True,
|
||||||
'blocks_confirmed': 2
|
'blocks_confirmed': 2
|
||||||
},
|
},
|
||||||
|
@ -361,7 +365,7 @@ def main():
|
||||||
'manage_daemon': True if 'bitcoin' in with_coins else False,
|
'manage_daemon': True if 'bitcoin' in with_coins else False,
|
||||||
'rpcport': 19796 + port_offset,
|
'rpcport': 19796 + port_offset,
|
||||||
'datadir': os.path.join(data_dir, 'bitcoin'),
|
'datadir': os.path.join(data_dir, 'bitcoin'),
|
||||||
'bindir': os.path.join(data_dir, 'bins', 'bitcoin'),
|
'bindir': os.path.join(data_dir, 'bin', 'bitcoin'),
|
||||||
'use_segwit': True
|
'use_segwit': True
|
||||||
},
|
},
|
||||||
'namecoin': {
|
'namecoin': {
|
||||||
|
@ -369,7 +373,7 @@ def main():
|
||||||
'manage_daemon': True if 'namecoin' in with_coins else False,
|
'manage_daemon': True if 'namecoin' in with_coins else False,
|
||||||
'rpcport': 19798 + port_offset,
|
'rpcport': 19798 + port_offset,
|
||||||
'datadir': os.path.join(data_dir, 'namecoin'),
|
'datadir': os.path.join(data_dir, 'namecoin'),
|
||||||
'bindir': os.path.join(data_dir, 'bins', 'namecoin'),
|
'bindir': os.path.join(data_dir, 'bin', 'namecoin'),
|
||||||
'use_segwit': False,
|
'use_segwit': False,
|
||||||
'use_csv': False,
|
'use_csv': False,
|
||||||
'blocks_confirmed': 1
|
'blocks_confirmed': 1
|
||||||
|
@ -389,7 +393,7 @@ def main():
|
||||||
settings['chainclients'][add_coin] = chainclients[add_coin]
|
settings['chainclients'][add_coin] = chainclients[add_coin]
|
||||||
|
|
||||||
prepareCore(add_coin, known_coins[add_coin], settings, data_dir)
|
prepareCore(add_coin, known_coins[add_coin], settings, data_dir)
|
||||||
prepareDataDir(add_coin, settings, data_dir, chain)
|
prepareDataDir(add_coin, settings, data_dir, chain, particl_wallet_mnemonic)
|
||||||
|
|
||||||
with open(config_path, 'w') as fp:
|
with open(config_path, 'w') as fp:
|
||||||
json.dump(settings, fp, indent=4)
|
json.dump(settings, fp, indent=4)
|
||||||
|
@ -420,11 +424,16 @@ def main():
|
||||||
continue
|
continue
|
||||||
coin = c
|
coin = c
|
||||||
prepareCore(coin, v, settings, data_dir)
|
prepareCore(coin, v, settings, data_dir)
|
||||||
prepareDataDir(coin, settings, data_dir, chain)
|
prepareDataDir(coin, settings, data_dir, chain, particl_wallet_mnemonic)
|
||||||
|
|
||||||
with open(config_path, 'w') as fp:
|
with open(config_path, 'w') as fp:
|
||||||
json.dump(settings, fp, indent=4)
|
json.dump(settings, fp, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
if particl_wallet_mnemonic == 'none':
|
||||||
|
logger.info('Done.')
|
||||||
|
return 0
|
||||||
|
|
||||||
logger.info('Loading Particl mnemonic')
|
logger.info('Loading Particl mnemonic')
|
||||||
|
|
||||||
particl_settings = settings['chainclients']['particl']
|
particl_settings = settings['chainclients']['particl']
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
"manage_daemon": true,
|
"manage_daemon": true,
|
||||||
"rpcport": 19792,
|
"rpcport": 19792,
|
||||||
"datadir": "/coindata/particl",
|
"datadir": "/coindata/particl",
|
||||||
"bindir": "/opt/particl",
|
"bindir": "/opt/bin/particl",
|
||||||
"blocks_confirmed": 2
|
"blocks_confirmed": 2
|
||||||
},
|
},
|
||||||
"litecoin": {
|
"litecoin": {
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
"manage_daemon": true,
|
"manage_daemon": true,
|
||||||
"rpcport": 19795,
|
"rpcport": 19795,
|
||||||
"datadir": "/coindata/litecoin",
|
"datadir": "/coindata/litecoin",
|
||||||
"bindir": "/opt/litecoin",
|
"bindir": "/opt/bin/litecoin",
|
||||||
"use_segwit": true,
|
"use_segwit": true,
|
||||||
"blocks_confirmed": 2
|
"blocks_confirmed": 2
|
||||||
},
|
},
|
||||||
|
@ -28,7 +28,7 @@
|
||||||
"manage_daemon": false,
|
"manage_daemon": false,
|
||||||
"rpcport": 19796,
|
"rpcport": 19796,
|
||||||
"datadir": "/coindata/bitcoin",
|
"datadir": "/coindata/bitcoin",
|
||||||
"bindir": "/opt/bitcoin",
|
"bindir": "/coindata/bin/bitcoin",
|
||||||
"use_segwit": true
|
"use_segwit": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue