kenshin samourai
5 years ago
committed by
GitHub
48 changed files with 3611 additions and 470 deletions
@ -0,0 +1,114 @@ |
|||
# Release Notes |
|||
|
|||
|
|||
## Samourai Dojo v1.1.0 ## |
|||
|
|||
|
|||
### Notable changes ### |
|||
|
|||
|
|||
#### Upgrade mechanism #### |
|||
|
|||
An upgrade mechanism for MyDojo has been added. |
|||
|
|||
See this [doc](./doc/DOCKER_setup.md#upgrade) for more details. |
|||
|
|||
|
|||
#### Optional support of an external bitcoin full node #### |
|||
|
|||
Optional support of an existing Bitcoin full node running outside of Docker has been added. |
|||
|
|||
This setup can be configured thanks to new options defined in ./docker/my-dojo/conf/docker-bitcoind.conf. When this option is activated, the install command skips the installation of bitcoind in Docker. |
|||
|
|||
Note: The Bitcoin full node installed by MyDojo is configured for taking care of your privacy at a network level. You may lose the benefits provided by the default setup if your external full node isn't properly configured. Use at your own risk. |
|||
|
|||
See this [doc](./doc/DOCKER_advanced_setups.md#external_bitcoind) for more details. |
|||
|
|||
|
|||
#### Optional support of external apps #### |
|||
|
|||
New options defined in ./docker/my-dojo/conf/docker-bitcoind.conf allow to expose the RPC API and ZMQ notifications provided by the full node of MyDojo to applications runnnig outside of Docker. |
|||
|
|||
Note: Exposing the full node of MyDojo to external applications may damage your privacy. Use at your own risk. |
|||
|
|||
See this [doc](./doc/DOCKER_advanced_setups.md#exposed_rpc_zmq) for more details. |
|||
|
|||
|
|||
#### Optional support of a static onion address for the full node #### |
|||
|
|||
A new option defined in ./docker/my-dojo/conf/docker-bitcoind.conf allows to keep a static onion address for your full node. |
|||
|
|||
By default, MyDojo generates a new onion address at each startup. We recommend to keep this default setup for better privacy. |
|||
|
|||
See this [doc](./doc/DOCKER_advanced_setups.md#static_onion) for more details. |
|||
|
|||
|
|||
#### Clean-up of Docker images #### |
|||
|
|||
A new "clean" command has been added to Dojo shell script for deleting old Docker images of MyDojo. |
|||
|
|||
This command allows to free disk space on the Docker host. |
|||
|
|||
|
|||
#### Documentation #### |
|||
|
|||
Added a new [doc](./doc/DOCKER_advanced_setups.md) for advanced setups. |
|||
|
|||
Added a new [doc](./doc/DOCKER_mac_setup.MD) for MacOS users. |
|||
|
|||
|
|||
### Change log ### |
|||
|
|||
#### MyDojo #### |
|||
|
|||
- [#1](https://github.com/Samourai-Wallet/samourai-dojo/pull/1) my-dojo upgrade mechanism |
|||
- [#7](https://github.com/Samourai-Wallet/samourai-dojo/pull/7) support of inbound connections through Tor |
|||
- [#8](https://github.com/Samourai-Wallet/samourai-dojo/pull/8) add config option exposing the rpc api and zmq notifications to external apps |
|||
- [#10](https://github.com/Samourai-Wallet/samourai-dojo/pull/10) add an option allowing to run dojo on top of an external bitcoind |
|||
- [#11](https://github.com/Samourai-Wallet/samourai-dojo/pull/11) clean-up |
|||
- [#12](https://github.com/Samourai-Wallet/samourai-dojo/pull/12) extend support of external apps |
|||
- [#15](https://github.com/Samourai-Wallet/samourai-dojo/pull/15) fix issue introduced by #10 |
|||
- [#19](https://github.com/Samourai-Wallet/samourai-dojo/pull/19) fix bitcoind port in torrc |
|||
- [#20](https://github.com/Samourai-Wallet/samourai-dojo/pull/20) increase nginx timeout |
|||
- [#25](https://github.com/Samourai-Wallet/samourai-dojo/pull/25) force the tracker to derive next indices if a hole is detected |
|||
- [#27](https://github.com/Samourai-Wallet/samourai-dojo/pull/27) rework external loop of Orchestrator |
|||
- [#28](https://github.com/Samourai-Wallet/samourai-dojo/pull/28) rework RemoteImporter |
|||
- [#32](https://github.com/Samourai-Wallet/samourai-dojo/pull/32) change the conditions switching the startup mode of the tracker |
|||
- [#33](https://github.com/Samourai-Wallet/samourai-dojo/pull/33) check authentication with admin key |
|||
- [#37](https://github.com/Samourai-Wallet/samourai-dojo/pull/37) automatic redirect of onion address to maintenance tool |
|||
- [#38](https://github.com/Samourai-Wallet/samourai-dojo/pull/38) dojo shutdown - replace sleep with static delay by docker wait |
|||
|
|||
|
|||
#### Security #### |
|||
|
|||
- [#5](https://github.com/Samourai-Wallet/samourai-dojo/pull/5) mydojo - install nodejs |
|||
- [#6](https://github.com/Samourai-Wallet/samourai-dojo/pull/6) remove deprecated "new Buffer" in favor of "Buffer.from" |
|||
- [#41](https://github.com/Samourai-Wallet/samourai-dojo/pull/41) update nodejs packages |
|||
|
|||
|
|||
#### Documentation #### |
|||
|
|||
- [#13](https://github.com/Samourai-Wallet/samourai-dojo/pull/13) included Mac instructions |
|||
- [92097d8](https://github.com/Samourai-Wallet/samourai-dojo/commit/92097d8ec7f9488ce0318c452356994315f4be72) doc |
|||
- [de4c9b5](https://github.com/Samourai-Wallet/samourai-dojo/commit/de4c9b5e5078b673c7b199503d48e7ceca328285) doc - minor updates |
|||
- [fead0bb](https://github.com/Samourai-Wallet/samourai-dojo/commit/fead0bb4b2b6174e637f5cb8c57edd9b55c3a1c7) doc - add link to MacOS install doc |
|||
- [#42](https://github.com/Samourai-Wallet/samourai-dojo/pull/42) fix few typos, add backticks for config values |
|||
- [#43](https://github.com/Samourai-Wallet/samourai-dojo/pull/43) add missing `d` in `docker-bitcoind.conf` |
|||
|
|||
|
|||
#### Misc #### |
|||
|
|||
- [a382e42](https://github.com/Samourai-Wallet/samourai-dojo/commit/a382e42469b884d2eda9fa6f5a3c8ce93a7cd39a) add sql scripts and config files to gitignore |
|||
|
|||
|
|||
### Credits ### |
|||
|
|||
- 05nelsonm |
|||
- clarkmoody |
|||
- dergigi |
|||
- hkjn |
|||
- kenshin-samourai |
|||
- LaurentMT |
|||
- michel-foucault |
|||
- pxsocs |
|||
- Technifocal |
@ -0,0 +1,7 @@ |
|||
# SQL scripts for incremental updates |
|||
|
|||
# Copyright © 2019 – Katana Cryptographic Ltd. All Rights Reserved. |
|||
|
|||
-- |
|||
-- UPDATES vX.Y.Z |
|||
-- |
@ -0,0 +1,161 @@ |
|||
# MyDojo - Advanced Setups |
|||
|
|||
|
|||
The 3 configuration files of Dojo provide a few advanced options allowing to tune your setup. |
|||
|
|||
A word of caution, though, the default values of these options try to maximize your privacy at a network level. All the advanced setups described in this document may damage your privacy. Use at your own risk! |
|||
|
|||
|
|||
<a name="external_bitcoind"/> |
|||
|
|||
## External Bitcoin full node ## |
|||
|
|||
By default, Dojo installs and runs a Bitcoin full node in Docker. |
|||
|
|||
The following procedure allows to bypass the installation of this full node by telling Dojo to rely on an external bitcoind running on your host machine. |
|||
|
|||
|
|||
### Requirements ### |
|||
|
|||
The external full node mustn't be pruned. |
|||
|
|||
The external full node must be configured for the support of Dojo. Edit the bitcoin.conf file of your external full node and check that the following lines are properly initialized. |
|||
|
|||
``` |
|||
# Force bitcoind to accept JSON-RPC commands |
|||
server=1 |
|||
|
|||
# Force bitcoind to index all the transactions |
|||
txindex=1 |
|||
|
|||
# Check that bitcoind accepts connections from 127.0.0.1 (linux) |
|||
# or from the IP address of the Docker Virtual Machine (MacOS, Windows) |
|||
rpcallowip=... |
|||
|
|||
# Check that a port is defined for the RPC API (or 8332 will be used as default value) |
|||
rpcport=... |
|||
|
|||
# Check that the RPC API listens on an IP address accessible from the nodejs container |
|||
rpcbind=... |
|||
|
|||
# Check that the RPC user is set |
|||
rpcuser=... |
|||
|
|||
# Check that the RPC password is set |
|||
rpcpassword= |
|||
|
|||
# Enable publish hash block on an IP address accessible from the nodejs container |
|||
zmqpubhashblock=... |
|||
|
|||
# Enable publish raw transaction on an IP address accessible from the nodejs container |
|||
zmqpubrawtx=... |
|||
``` |
|||
|
|||
|
|||
### Procedure ### |
|||
|
|||
#### Configuration of Dojo #### |
|||
|
|||
``` |
|||
# Edit the bitcoin config template file |
|||
nano ./conf/docker-bitcoind.conf.tpl |
|||
|
|||
# |
|||
# Set the value of BITCOIND_INSTALL to "off" |
|||
# Set the value of BITCOIND_IP with the IP address of you bitcoin full node |
|||
# Set the value of BITCOIND_RPC_PORT with the port used by your bitcoin full node for the RPC API |
|||
# Set the value of BITCOIND_ZMQ_RAWTXS with the port used by your bitcoin full node for ZMQ notifications of raw transactions |
|||
# (i.e. port defined for -zmqpubrawtx in the bitcoin.conf of your full node) |
|||
# Set the value of BITCOIND_ZMQ_BLK_HASH with the port used by your bitcoin full node for ZMQ notifications of block hashes |
|||
# (i.e. port defined for -zmqpubhashblock in the bitcoin.conf of your full node) |
|||
# |
|||
# Save and exit nano |
|||
# |
|||
``` |
|||
|
|||
### Fast import of block headers in Dojo (optional) ### |
|||
|
|||
When Dojo is installed for the first time, the Tracker imports the block headers in the database. |
|||
|
|||
Follow these steps if you want to speed up this operation by preloading an archive of the block headers. |
|||
|
|||
``` |
|||
# Download the archive [https://samouraiwallet.com/static/share/2_blocks.sql.gz](https://samouraiwallet.com/static/share/2_blocks.sql.gz) to the "<dojo_dir>/db-scripts/" directory. Don't modify the name of the archive. |
|||
``` |
|||
|
|||
|
|||
#### Start the installation of Dojo #### |
|||
|
|||
``` |
|||
./dojo.sh install |
|||
``` |
|||
|
|||
|
|||
<a name="exposed_rpc_zmq"/> |
|||
|
|||
## bitcoind RPC API ans ZMQ notifications exposed to external apps ## |
|||
|
|||
By default, access to the RPC API of your bitcoind is restricted to Docker containers hosted on the "dojonet" network. |
|||
|
|||
The following steps allow to expose the RPC API and ZMQ notifications to applications running on your local machine but outside of Docker. |
|||
|
|||
``` |
|||
# |
|||
# If your Docker runs on macos or windows, |
|||
# retrieve the local IP address of the VM |
|||
# hosting your Docker containers |
|||
# |
|||
|
|||
# Stop your Dojo |
|||
./dojo.sh stop |
|||
|
|||
# Edit the bitcoin config file |
|||
nano ./conf/docker-bitcoind.conf |
|||
|
|||
# |
|||
# Set the value of BITCOIND_RPC_EXTERNAL to "on" |
|||
# |
|||
# If your Docker runs on macos or windows, |
|||
# set the value of BITCOIND_RPC_EXTERNAL_IP to the IP address of the VM |
|||
# |
|||
# Save and exit nano |
|||
# |
|||
|
|||
# Start your Dojo |
|||
./dojo.sh start |
|||
``` |
|||
|
|||
With this setting, external applications running on your local machine should be able to access the following ports: |
|||
* 9500: bitcoind zmqpubhashtx notifications |
|||
* 9501: bitcoind zmqpubrawtx notifications |
|||
* 9502: bitcoind zmqpubhashblock notifications |
|||
* 9503: bitcoind zmqpubrawblock notifications |
|||
* 28256: bitcoind RPC API |
|||
|
|||
Note: this option has no effect if your setup relies on a external full node (i.e. if BITCOIND_INSTALL is set to "off"). |
|||
|
|||
|
|||
<a name="static_onion"/> |
|||
|
|||
## Static onion address for bitcoind hidden service ## |
|||
|
|||
By default, Dojo creates a new onion address for your bitcoind at each startup. |
|||
|
|||
The following steps allow to keep a static onion address (not recommended). |
|||
|
|||
``` |
|||
# Stop your Dojo |
|||
./dojo.sh stop |
|||
|
|||
# Edit the bitcoin config file |
|||
nano ./conf/docker-bitcoind.conf |
|||
|
|||
# |
|||
# Set the value of BITCOIND_EPHEMERAL_HS to "off" |
|||
# |
|||
|
|||
# Start your Dojo |
|||
./dojo.sh start |
|||
``` |
|||
|
|||
Note: this option has no effect if your setup relies on a external full node (i.e. if BITCOIND_INSTALL is set to "off"). |
@ -0,0 +1,54 @@ |
|||
# MacOS Installation |
|||
|
|||
This installation was tested on an iMac (mid 2011) with a 2.7GHz i5 processor with 8GB RAM and 1TB external Hard Drive. |
|||
|
|||
## Getting Started |
|||
|
|||
#### Create a new user: |
|||
|
|||
1. Launch System Preferences by clicking the **System Preferences** icon in the **Dock**, or selecting **System Preferences** from the Apple menu. |
|||
2. Click on __Users & Groups__ |
|||
3. If settings are locked, click on the __Lock__ at the bottom of window and enter your password. |
|||
4. Click on __+__ to add a new User |
|||
5. Under __New Account__ select __Administrator__ |
|||
6. Fill the remaining fields with your choice of User Name and Password |
|||
|
|||
#### Move the __New User Folder__ into the __External HD__ |
|||
Note: _This is an important step, otherwise, it's probable that when you run the container, it will be installed in your main OS Hard Drive and will run out of space as it validates the Bitcoin blockchain._ |
|||
|
|||
1. Open **Finder** and navigate to your startup drive's **/Users** folder. For most people, this is **/Macintosh HD/Users**. In the **Users** **folder**, you'll find your user's folder. |
|||
2. On your external Hard Drive, create a folder named **Users**. |
|||
3. Select your user folder and drag it to the external HD **/Users** folder you created. _Because you're using a different drive for the destination, the operating system will copy the data rather than move it. This ok for now but delete it later._ |
|||
4. Launch System Preferences again. |
|||
5. In the **Users & Groups** click the lock icon in the bottom left corner, then provide an administrator name and password. |
|||
6. From the list of user accounts, right-click on the account whose home folder you moved, and select **Advanced Options** from the pop-up menu. |
|||
_Do not make any changes to Advanced Options except for those noted here. Doing so can cause quite a few unforeseen problems that could lead to data loss or the need to reinstall the operating system._ |
|||
7. In the **Advanced Options** sheet, click **Choose**, located to the right of the **Home directory** field. |
|||
8. Navigate to the location you moved your home folder to, select the new home folder, and click **OK**. |
|||
9. Click **OK** to dismiss the **Advanced Options** sheet, and then close **System Preferences**. |
|||
10. __Restart your Mac__ |
|||
|
|||
#### Download and install Docker, Kitematic and TOR |
|||
1. Make sure your system fills the [requirements]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) (particularly MacOS Sierra 10.12 or higher. If not, upgrade before proceeding). |
|||
2. [Download Docker]([https://docs.docker.com/docker-for-mac/install/](https://docs.docker.com/docker-for-mac/install/)) and follow the installation steps. |
|||
3. _Optional_: Download [Kitematic]([https://kitematic.com/) and follow installation instructions. |
|||
(_This may be system specific but I've found that monitoring the logs with Kitematic was more stable than using the Terminal_). |
|||
4. Install [Tor Browser](https://www.torproject.org/projects/torbrowser.html.en) on the host machine. |
|||
|
|||
## Adjust Docker Settings |
|||
1. Click on the Docker icon (![whale menu](https://docs.docker.com/docker-for-mac/images/whale-x.png)) at the status bar and select __Preferences__. |
|||
2. Under Disk, click on __Reveal in Finder__ and double check that the disk image is saved under the external HD. |
|||
3. __Adjust Disk__ Image size to 400GB+ and click Apply. |
|||
4. Click __Advanced__ and increase the CPU count, Memory and Swap sizes. Adjusting these will speed up the blockchain validation process |
|||
(_At 4 CPUs, 8GB of RAM and a 4GiB Swap - the initial block download took 4.5 days at the time of writing_). |
|||
|
|||
## Install the DOJO |
|||
Follow the instructions [here](https://github.com/Samourai-Wallet/samourai-dojo/blob/develop/doc/DOCKER_setup.md) starting at the step: |
|||
__"Download the most recent release of Dojo from Github"__ |
|||
_Note: For tracking progress, open Kitematic and follow the bitcoind logs. You'll be able to see the Blockchain verification process under the _progress_ log variable (1.00 = fully validated). This process takes a long time. Just let it do its thing. In my system it took 3 days._ |
|||
|
|||
__Some possible optimization tips:__ |
|||
. If you notice that progress has stopped. Click the whale icon and select Restart. Check Kitematic logs of bitcoind to confirm that progress has resumed. |
|||
. This may optimize speed: open __Activity Monitor__, check the PID (Process ID) of your docker process. Open Terminal and type: |
|||
|
|||
`sudo renice-20 -p [enter your PID]` |
@ -1,22 +0,0 @@ |
|||
# Bitcoin Configuration |
|||
server=1 |
|||
listen=1 |
|||
bind=127.0.0.1 |
|||
|
|||
# Tor proxy through dojonet |
|||
proxy=172.28.1.4:9050 |
|||
|
|||
# Non-default RPC Port |
|||
rpcport=28256 |
|||
rpcallowip=::/0 |
|||
rpcbind=bitcoind |
|||
|
|||
# Store transaction information for fully-spent txns |
|||
txindex=1 |
|||
|
|||
# No wallet |
|||
disablewallet=1 |
|||
|
|||
# ZeroMQ Notification Settings |
|||
zmqpubhashblock=tcp://0.0.0.0:9502 |
|||
zmqpubrawtx=tcp://0.0.0.0:9501 |
@ -1,32 +0,0 @@ |
|||
######################################### |
|||
# CONFIGURATION OF BITCOIND CONTAINER |
|||
######################################### |
|||
|
|||
# User account used for rpc access to bitcoind |
|||
# Type: alphanumeric |
|||
BITCOIND_RPC_USER=dojorpc |
|||
|
|||
# Password of user account used for rpc access to bitcoind |
|||
# Type: alphanumeric |
|||
BITCOIND_RPC_PASSWORD=dojorpcpassword |
|||
|
|||
# Max number of connections to network peers |
|||
# Type: integer |
|||
BITCOIND_MAX_CONNECTIONS=16 |
|||
|
|||
# Mempool maximum size in MB |
|||
# Type: integer |
|||
BITCOIND_MAX_MEMPOOL=1024 |
|||
|
|||
# Db cache size in MB |
|||
# Type: integer |
|||
BITCOIND_DB_CACHE=1024 |
|||
|
|||
# Mempool expiry in hours |
|||
# Defines how long transactions stay in your local mempool before expiring |
|||
# Type: integer |
|||
BITCOIND_MEMPOOL_EXPIRY=72 |
|||
|
|||
# Min relay tx fee in BTC |
|||
# Type: numeric |
|||
BITCOIND_MIN_RELAY_TX_FEE=0.00001 |
@ -0,0 +1,103 @@ |
|||
######################################### |
|||
# CONFIGURATION OF BITCOIND CONTAINER |
|||
######################################### |
|||
|
|||
# User account used for rpc access to bitcoind |
|||
# Type: alphanumeric |
|||
BITCOIND_RPC_USER=dojorpc |
|||
|
|||
# Password of user account used for rpc access to bitcoind |
|||
# Type: alphanumeric |
|||
BITCOIND_RPC_PASSWORD=dojorpcpassword |
|||
|
|||
# Max number of connections to network peers |
|||
# Type: integer |
|||
BITCOIND_MAX_CONNECTIONS=16 |
|||
|
|||
# Mempool maximum size in MB |
|||
# Type: integer |
|||
BITCOIND_MAX_MEMPOOL=1024 |
|||
|
|||
# Db cache size in MB |
|||
# Type: integer |
|||
BITCOIND_DB_CACHE=1024 |
|||
|
|||
# Number of threads to service RPC calls |
|||
# Type: integer |
|||
BITCOIND_RPC_THREADS=6 |
|||
|
|||
# Mempool expiry in hours |
|||
# Defines how long transactions stay in your local mempool before expiring |
|||
# Type: integer |
|||
BITCOIND_MEMPOOL_EXPIRY=72 |
|||
|
|||
# Min relay tx fee in BTC |
|||
# Type: numeric |
|||
BITCOIND_MIN_RELAY_TX_FEE=0.00001 |
|||
|
|||
|
|||
# |
|||
# EXPERT SETTINGS |
|||
# |
|||
|
|||
|
|||
# |
|||
# EPHEMERAL ONION ADDRESS FOR BITCOIND |
|||
# THIS PARAMETER HAS NO EFFECT IF BITCOIND_INSTALL IS SET TO OFF |
|||
# |
|||
|
|||
# Generate a new onion address for bitcoind when Dojo is launched |
|||
# Activation of this option is recommended for improved privacy. |
|||
# Values: on | off |
|||
BITCOIND_EPHEMERAL_HS=on |
|||
|
|||
|
|||
# |
|||
# EXPOSE BITCOIND RPC API AND ZMQ NOTIFICATIONS TO EXTERNAL APPS |
|||
# THESE PARAMETERS HAVE NO EFFECT IF BITCOIND_INSTALL IS SET TO OFF |
|||
# |
|||
|
|||
# Expose the RPC API to external apps |
|||
# Warning: Do not expose your RPC API to internet! |
|||
# See BITCOIND_RPC_EXTERNAL_IP |
|||
# Value: on | off |
|||
BITCOIND_RPC_EXTERNAL=off |
|||
|
|||
# IP address used to expose the RPC API to external apps |
|||
# This parameter is inactive if BITCOIND_RPC_EXTERNAL isn't set to 'on' |
|||
# Warning: Do not expose your RPC API to internet! |
|||
# Recommended value: |
|||
# linux: 127.0.0.1 |
|||
# macos or windows: IP address of the VM running the docker host |
|||
# Type: string |
|||
BITCOIND_RPC_EXTERNAL_IP=127.0.0.1 |
|||
|
|||
|
|||
# |
|||
# INSTALL AND RUN BITCOIND INSIDE DOCKER |
|||
# |
|||
|
|||
# Install and run bitcoind inside Docker |
|||
# Set this option to 'off' for using a bitcoind hosted outside of Docker (not recommended) |
|||
# Value: on | off |
|||
BITCOIND_INSTALL=on |
|||
|
|||
# IP address of bitcoind used by Dojo |
|||
# Set value to 172.28.1.5 if BITCOIND_INSTALL is set to 'on' |
|||
# Type: string |
|||
BITCOIND_IP=172.28.1.5 |
|||
|
|||
# Port of the RPC API |
|||
# Set value to 28256 if BITCOIND_INSTALL is set to 'on' |
|||
# Type: integer |
|||
BITCOIND_RPC_PORT=28256 |
|||
|
|||
# Port exposing ZMQ notifications for raw transactions |
|||
# Set value to 9501 if BITCOIND_INSTALL is set to 'on' |
|||
# Type: integer |
|||
BITCOIND_ZMQ_RAWTXS=9501 |
|||
|
|||
# Port exposing ZMQ notifications for block hashes |
|||
# Set value to 9502 if BITCOIND_INSTALL is set to 'on' |
|||
# Type: integer |
|||
BITCOIND_ZMQ_BLK_HASH=9502 |
@ -0,0 +1,34 @@ |
|||
#!/bin/bash |
|||
|
|||
# Confirm installation |
|||
get_confirmation() { |
|||
while true; do |
|||
echo "This operation is going to install Dojo v$DOJO_VERSION_TAG on your computer." |
|||
read -p "Do you wish to continue? [y/n]" yn |
|||
case $yn in |
|||
[Yy]* ) return 0;; |
|||
[Nn]* ) echo "Installation was cancelled."; return 1;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
done |
|||
} |
|||
|
|||
# Initialize configuration files from templates |
|||
init_config_files() { |
|||
cp ../../db-scripts/1_db.sql.tpl ../../db-scripts/1_db.sql |
|||
echo "Initialized 1_db.sql" |
|||
|
|||
if [ -f ../../db-scripts/2_update.sql ]; then |
|||
rm ../../db-scripts/2_update.sql |
|||
echo "Deleted 2_update.sql" |
|||
fi |
|||
|
|||
cp ./conf/docker-bitcoind.conf.tpl ./conf/docker-bitcoind.conf |
|||
echo "Initialized docker-bitcoind.conf" |
|||
|
|||
cp ./conf/docker-mysql.conf.tpl ./conf/docker-mysql.conf |
|||
echo "Initialized docker-mysql.conf" |
|||
|
|||
cp ./conf/docker-node.conf.tpl ./conf/docker-node.conf |
|||
echo "Initialized docker-node.conf" |
|||
} |
@ -0,0 +1,67 @@ |
|||
#!/bin/bash |
|||
|
|||
# Confirm upgrade operation |
|||
get_confirmation() { |
|||
while true; do |
|||
echo "This operation is going to upgrade your Dojo to v$DOJO_VERSION_TAG." |
|||
read -p "Do you wish to continue? [y/n]" yn |
|||
case $yn in |
|||
[Yy]* ) return 0;; |
|||
[Nn]* ) echo "Upgrade was cancelled."; return 1;; |
|||
* ) echo "Please answer yes or no.";; |
|||
esac |
|||
done |
|||
} |
|||
|
|||
# Update configuration files from templates |
|||
update_config_files() { |
|||
if [ -f ../../db-scripts/1_db.sql ]; then |
|||
rm ../../db-scripts/1_db.sql |
|||
echo "Deleted 1_db.sql" |
|||
fi |
|||
|
|||
cp ../../db-scripts/2_update.sql.tpl ../../db-scripts/2_update.sql |
|||
echo "Initialized 2_update.sql" |
|||
|
|||
update_config_file ./conf/docker-bitcoind.conf ./conf/docker-bitcoind.conf.tpl |
|||
echo "Initialized docker-bitcoind.conf" |
|||
|
|||
update_config_file ./conf/docker-mysql.conf ./conf/docker-mysql.conf.tpl |
|||
echo "Initialized docker-mysql.conf" |
|||
|
|||
update_config_file ./conf/docker-node.conf ./conf/docker-node.conf.tpl |
|||
echo "Initialized docker-node.conf" |
|||
} |
|||
|
|||
# Update a configuration file from template |
|||
update_config_file() { |
|||
sed "s/^#.*//g;s/=.*//g;/^$/d" $1 > ./original.keys.raw |
|||
grep -f ./original.keys.raw $1 > ./original.lines.raw |
|||
|
|||
cp -p $1 "$1.save" |
|||
cp -p $2 $1 |
|||
|
|||
while IFS='=' read -r key val ; do |
|||
sed -i "s/$key=.*/$key=$val/g" "$1" |
|||
done < ./original.lines.raw |
|||
|
|||
rm ./original.keys.raw |
|||
rm ./original.lines.raw |
|||
} |
|||
|
|||
# Update dojo database |
|||
update_dojo_db() { |
|||
docker exec -d db /update-db.sh |
|||
} |
|||
|
|||
# Clean-up |
|||
cleanup() { |
|||
################# |
|||
# Clean-up v1.1.0 |
|||
################# |
|||
|
|||
# Remove deprecated bitcoin.conf file |
|||
if [ -f ./bitcoin/bitcoin.conf ]; then |
|||
rm ./bitcoin/bitcoin.conf |
|||
fi |
|||
} |
@ -1,7 +1,13 @@ |
|||
FROM mysql:5.7.25 |
|||
FROM mysql:5.7.25 |
|||
|
|||
# Copy mysql config |
|||
COPY ./docker/my-dojo/mysql/mysql-dojo.cnf /etc/mysql/conf.d/mysql-dojo.cnf |
|||
COPY ./docker/my-dojo/mysql/mysql-dojo.cnf /etc/mysql/conf.d/mysql-dojo.cnf |
|||
|
|||
# Copy update-db script |
|||
COPY ./docker/my-dojo/mysql/update-db.sh /update-db.sh |
|||
|
|||
RUN chmod u+x /update-db.sh && \ |
|||
chmod g+x /update-db.sh |
|||
|
|||
# Copy content of mysql scripts into /docker-entrypoint-initdb.d |
|||
COPY ./db-scripts/ /docker-entrypoint-initdb.d |
|||
COPY ./db-scripts/ /docker-entrypoint-initdb.d |
@ -0,0 +1,14 @@ |
|||
#!/bin/bash |
|||
|
|||
for i in {30..0}; do |
|||
if echo "SELECT 1" | mysql -h"db" -u"root" -p"$MYSQL_ROOT_PASSWORD" &> /dev/null; then |
|||
break |
|||
fi |
|||
echo "MySQL init process in progress..." |
|||
sleep 1 |
|||
done |
|||
|
|||
if [ -f /docker-entrypoint-initdb.d/2_update.sql ]; then |
|||
mysql -h"db" -u"root" -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE" < /docker-entrypoint-initdb.d/2_update.sql |
|||
echo "Updated database with 2_update.sql" |
|||
fi |
@ -0,0 +1,34 @@ |
|||
version: "3.2" |
|||
|
|||
services: |
|||
bitcoind: |
|||
image: "samouraiwallet/dojo-bitcoind:${DOJO_BITCOIND_VERSION_TAG}" |
|||
container_name: bitcoind |
|||
build: |
|||
context: ./bitcoin |
|||
env_file: |
|||
- ./.env |
|||
- ./conf/docker-bitcoind.conf |
|||
restart: on-failure |
|||
command: "/wait-for-it.sh tor:9050 --timeout=360 --strict -- /restart.sh" |
|||
expose: |
|||
- "8333" |
|||
- "28256" |
|||
- "9501" |
|||
- "9502" |
|||
volumes: |
|||
- data-bitcoind:/home/bitcoin/.bitcoin |
|||
- data-tor:/var/lib/tor |
|||
depends_on: |
|||
- db |
|||
- tor |
|||
networks: |
|||
dojonet: |
|||
ipv4_address: 172.28.1.5 |
|||
|
|||
node: |
|||
depends_on: |
|||
- bitcoind |
|||
|
|||
volumes: |
|||
data-bitcoind: |
@ -0,0 +1,10 @@ |
|||
version: "3.2" |
|||
|
|||
services: |
|||
bitcoind: |
|||
ports: |
|||
- "${BITCOIND_RPC_EXTERNAL_IP}:28256:28256" |
|||
- "${BITCOIND_RPC_EXTERNAL_IP}:9500:9500" |
|||
- "${BITCOIND_RPC_EXTERNAL_IP}:9501:9501" |
|||
- "${BITCOIND_RPC_EXTERNAL_IP}:9502:9502" |
|||
- "${BITCOIND_RPC_EXTERNAL_IP}:9503:9503" |
@ -0,0 +1,9 @@ |
|||
#!/bin/bash |
|||
set -e |
|||
|
|||
# Set permissions for bitcoind |
|||
echo "## Set permissions on /var/lib/tor dir ###" |
|||
chmod 750 /var/lib/tor |
|||
|
|||
echo "## Start tor #############################" |
|||
tor |
File diff suppressed because it is too large
Loading…
Reference in new issue