8000 Refine production deployment doc by hunicus · Pull Request #1611 · mempool/mempool · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Refine production deployment doc #1611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 27 additions & 23 deletions production/README.md
7FF0
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# mempool enterprise production instance
# Deploying an Enterprise Production Instance

These instructions are for setting up a serious production mempool website for Bitcoin mainnet, testnet, signet, Liquid mainnet and testnet, and Bisq. For home users, you should use one-click installation methods instead, and for advanced manual deployments of mainnet only see the top-level installation instructions.
These instructions are for setting up a serious production Mempool website for Bitcoin (mainnet, testnet, signet), Liquid (mainnet, testnet), and Bisq.

Again, this setup is no joke—home users should use [one of the other installation methods](../#installation-methods).

### Server Hardware

Mempool V2 is powered by blockstream/electrs, which is a beast. I recommend a beefy server:
Mempool v2 is powered by [blockstream/electrs](https://github.com/Blockstream/electrs), which is a beast.

I recommend a beefy server:

* 20C CPU (more is better)
* 64G RAM (more is better)
* 20-core CPU (more is better)
* 64GB RAM (more is better)
* 4TB SSD (NVMe is better)

### HDD vs SSD vs NVMe

If you don't have a fast SSD or NVMe backed disk, that's fine. What you do is, go online and buy some fast new NVMe drives and wait for them to arrive. After you install them, throw away your old HDDs and then proceed with the rest of this guide.
If you don't have a fast SSD or NVMe-backed disk, that's finego online and buy some fast new NVMe drives. When they arrive, install them, throw away your old HDDs, and then proceed with the rest of this guide.

## FreeBSD 13

Expand All @@ -29,7 +33,7 @@ nvm 3.62T 1.25T 2.38T - - 2% 34% 1.00x ONLINE
nvd1p3 1.81T 646G 1.18T - - 2% 34.8% - ONLINE
```

For maximum flexibility of configuration, I recommend partitions separately for each data folder:
For maximum flexibility of configuration, I recommend separate partitions for each data folder:
```
Filesystem Size Used Avail Capacity Mounted on
nvm/bisq 766G 1.1G 765G 0% /bisq
Expand Down Expand Up @@ -76,9 +80,9 @@ You'll probably need these:
pkg install -y zsh sudo git screen curl wget neovim rsync nginx openssl openssh-portable py38-pip py38-certbot-nginx boost-libs autoconf automake gmake gcc libevent libtool pkgconf mariadb105-server mariadb105-client
```

### NodeJS / npm
### Node.js + npm

I recommend to build nodejs / npm from source using nvm:
Build Node.js v16.10 and npm v7 from source using `nvm`:
```
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | zsh
< 10000 /td> source $HOME/.zshrc
Expand All @@ -88,14 +92,14 @@ nvm alias default node

### Rust

I recommend to build rust from latest source:
Build Rust from latest source:
```
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
```

### Tor

Install tor, add Bitcoin to _tor group:
Install Tor add Bitcoin to the `_tor` group:
```
pkg install -y tor
pw user mod bitcoin -G _tor
Expand Down Expand Up @@ -134,7 +138,7 @@ Build [Bitcoin Core](https://github.com/bitcoin/bitcoin) from source. Alternativ
pkg install -y bitcoin-daemon bitcoin-utils
```

Configure your bitcoin.conf like this:
Configure your `bitcoin.conf` like this:
```
datadir=/bitcoin
server=1
Expand Down Expand Up @@ -173,12 +177,12 @@ Build [Elements Core](https://github.com/ElementsProject/elements) from source:
```
./autogen.sh
MAKE=gmake CC=cc CXX=c++ CPPFLAGS=-I/usr/local/include \
./configure --with-gui=no --disable-wallet
./configure --with-gui=no --disable-wallet
gmake -j19
gmake install
```

Configure your elements.conf like this:
Configure your `elements.conf` like this:
```
server=1
daemon=1
Expand Down Expand Up @@ -218,7 +222,7 @@ addnode=liquidtestnet.com:18891
addnode=liquid.network:18444
```

Start elementsd and wait for it to sync the Liquid blockchain.
Start `elementsd` and wait for it to sync the Liquid blockchain.

### Electrs

Expand All @@ -240,7 +244,7 @@ You'll need one instance per network. Build and run them one at a time:

### MariaDB

Import historical mempool fee database snapshot:
Import the historical mempool fee database snapshot:
```
mysql -u root
create database mempool;
Expand All @@ -263,41 +267,41 @@ Build bisq-statsnode normally and run using options like this:
./bisq-statsnode --dumpBlockchainData=true --dumpStatistics=true
```

If bisq is happy, it should dump JSON files for Bisq Markets and BSQ data into /bisq that the mempool backend will use.
If Bisq is happy, it should dump JSON files for Bisq Markets and BSQ data into `/bisq` for the Mempool backend to use.

### Mempool

After all 3 electrs instances are fully indexed, install your 3 mempool nodes:
After all 3 electrs instances are fully indexed, install your 3 Mempool nodes:
```
./mempool-install-all
./mempool-upgrade-all
```

Finally, start your 3 mempool backends:
Finally, start your 3 Mempool backends:
```
./mempool-start-all
```

### Nginx

Get SSL certificate using certbot:
Get an SSL certificate using `certbot`:
```
certbot --nginx -d mempool.ninja
```

Make a symlink from /usr/local/etc/nginx/mempool to /mempool/mempool, and copy the nginx.conf and edit as necessary. You probably only need to edit the top-level nginx.conf file.
Make a symlink from `/usr/local/etc/nginx/mempool` to `/mempool/mempool`, copy the `nginx.conf`, and edit as necessary. You probably only need to edit the top-level `nginx.conf` file.
```
cd /usr/local/etc/nginx
ln -s /mempool/mempool
cp /mempool/mempool/nginx.conf .
vi nginx.conf
```

Restart nginx
Restart `nginx`:
```
service nginx restart
```

### Done

Your site should look like https://mempool.space/
If everything went well, your site should look like the one at https://mempool.space/.
0