Dockerfile

This commit is contained in:
2022-03-10 07:33:15 -06:00
parent 74c79d676e
commit 33a3846cd8
2 changed files with 22 additions and 1 deletions

View File

@@ -1,6 +1,6 @@
# Intro # Intro
Deal Module - the BitDeals daemon that provides a special interfaces for creating and modifying user accounts and deals. Deal Module (dm) - the BitDeals daemon that provides a special interfaces for creating and modifying user accounts and deals.
# Running DM docker container # Running DM docker container
@@ -28,6 +28,7 @@ services:
- PUID=1000 - PUID=1000
- PGID=1000 - PGID=1000
- TZ=UTC - TZ=UTC
- TESTNET=1 #optional
- BITCOIN=<address> #optional - BITCOIN=<address> #optional
- FEE=<0.1%> #optional - FEE=<0.1%> #optional
- PGP_PUB=<key> #optional - PGP_PUB=<key> #optional
@@ -49,6 +50,7 @@ services:
```sh ```sh
docker run -d \ docker run -d \
--name=bitdeals-dm \ --name=bitdeals-dm \
-e TESTNET=1 `#optional` \
-e BITCOIN=<address> `#optional` \ -e BITCOIN=<address> `#optional` \
-e FEE=<0.1%> `#optional` \ -e FEE=<0.1%> `#optional` \
-e PGP_PUB=$(gpg2 --armor --export Account_URL) `#optional` \ -e PGP_PUB=$(gpg2 --armor --export Account_URL) `#optional` \
@@ -72,6 +74,7 @@ Container images are configured using parameters passed at runtime.
|-p 80|WebUI port TCP| |-p 80|WebUI port TCP|
|-p 4977|Module API port TCP [(API documentation)](https://bitbucket.org/bitdeals/apostol-dm)| |-p 4977|Module API port TCP [(API documentation)](https://bitbucket.org/bitdeals/apostol-dm)|
|-e ACCOUNT_URL=|User site address to provide a deal service. On first run the initialization script will create and save a new PGP keys with this Account_URL in key details.| |-e ACCOUNT_URL=|User site address to provide a deal service. On first run the initialization script will create and save a new PGP keys with this Account_URL in key details.|
|-e TESTNET=|Enable bitcoin testnet mode.|
|-e BITCOIN=|User account bitcoin address.| |-e BITCOIN=|User account bitcoin address.|
|-e FEE=|User fee for created deals.| |-e FEE=|User fee for created deals.|
|-e PGP_PUB=|Variable with ASCII armored PGP public key.| |-e PGP_PUB=|Variable with ASCII armored PGP public key.|

View File

@@ -11,6 +11,7 @@ DM_CONF_FILE="/etc/dm/dm.conf"
OAUTH_CONF_FILE="/etc/dm/oauth2/default.json" OAUTH_CONF_FILE="/etc/dm/oauth2/default.json"
PGP_PUB_FILE="/etc/dm/pgp.pub" PGP_PUB_FILE="/etc/dm/pgp.pub"
PGP_SEC_FILE="/etc/dm/pgp.sec" PGP_SEC_FILE="/etc/dm/pgp.sec"
BX_CONF_FILE="/usr/local/etc/libbitcoin/bx.cfg"
## Write a variables to config file ## Write a variables to config file
sed -i "/\[main\]/,/\[/ s/user=.*/user=module/" "$DM_CONF_FILE" sed -i "/\[main\]/,/\[/ s/user=.*/user=module/" "$DM_CONF_FILE"
@@ -83,6 +84,23 @@ then
B=$(tput bold) B=$(tput bold)
N=$(tput sgr0) N=$(tput sgr0)
## Setup testnet settings in libbitcoin-explorer config
test $TESTNET -eq 1 && \
sed -i -e "/\[wallet\]/,/\[/ s/wif_version? =.*/wif_version = 239/" \
-e "/\[wallet\]/,/\[/ s/hd_public_version =.*/hd_public_version = 70617039/" \
-e "/\[wallet\]/,/\[/ s/hd_secret_version =.*/hd_secret_version = 70615956/" \
-e "/\[wallet\]/,/\[/ s/pay_to_public_key_hash_version =.*/pay_to_public_key_hash_version = 111/" \
-e "/\[wallet\]/,/\[/ s/pay_to_script_hash_version =.*/pay_to_script_hash_version = 196/" \
-e "/\[network\]/,/\[/ s/identifier =.*/identifier = 118034699/" \
-e "/seed = mainnet[0-9].libbitcoin.net:8333/ s/^/#/" \
-e "/url = tcp:\/\/mainnet.libbitcoin.net:9091/ s/^/#/" \
-e "/block_url = tcp:\/\/mainnet.libbitcoin.net:9093/ s/^/#/" \
-e "/transaction_url = tcp:\/\/mainnet.libbitcoin.net:9094/ s/^/#/" \
-e "/#seed = testnet[0-9].libbitcoin.net:18333/ s/^#//" \
-e "/#url = tcp:\/\/testnet.libbitcoin.net:19091/ s/^#//" \
-e "/#block_url = tcp:\/\/testnet.libbitcoin.net:19093/ s/^#//" \
-e "/#transaction_url = tcp:\/\/testnet.libbitcoin.net:19094/ s/^#//" "$BX_CONF_FILE"
## Generate bitcoin keys ## Generate bitcoin keys
PRIVKEY="$(cat /dev/random | tr -cd "[:digit:]" | head -c 64)" PRIVKEY="$(cat /dev/random | tr -cd "[:digit:]" | head -c 64)"
PUBKEY="$(bx ec-to-public $PRIVKEY)" PUBKEY="$(bx ec-to-public $PRIVKEY)"