Update Docker README file
This commit is contained in:
		
							parent
							
								
									bd3caa28b8
								
							
						
					
					
						commit
						83525b8c1b
					
				
							
								
								
									
										113
									
								
								docker/README.md
									
									
									
									
									
								
							
							
						
						
									
										113
									
								
								docker/README.md
									
									
									
									
									
								
							@ -1,96 +1,59 @@
 | 
			
		||||
# Docker
 | 
			
		||||
 | 
			
		||||
## Initialization
 | 
			
		||||
This directory contains the Dockerfiles used to build and release the official images and a `docker-compose.yml` file that is intended for end users to run a Mempool instance with minimal effort.
 | 
			
		||||
 | 
			
		||||
In an empty dir create 2 sub-dirs
 | 
			
		||||
## Basic setup
 | 
			
		||||
 | 
			
		||||
To run an instance with the default settings, use the following command:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
mkdir -p data mysql/data
 | 
			
		||||
$ docker-compose up
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Your dir should now look like that:
 | 
			
		||||
The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled.
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
$ls -R
 | 
			
		||||
.:
 | 
			
		||||
data mysql
 | 
			
		||||
You can check if the instance is running by visiting http://localhost - the graphs will be populated as new transactions are detected.
 | 
			
		||||
 | 
			
		||||
./data:
 | 
			
		||||
## Advanced setup
 | 
			
		||||
 | 
			
		||||
./mysql:
 | 
			
		||||
data  db-scripts
 | 
			
		||||
In order to run with electrum/electrs as the backend you will need to make the following changes to the `docker-compose.yml` file:
 | 
			
		||||
 | 
			
		||||
- Under the `api` service, change the value of `MEMPOOL_BACKEND` key from `none` to `electrum`:
 | 
			
		||||
 | 
			
		||||
./mysql/data:
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
In the main dir add the following `docker-compose.yml`
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
version: "3.7"
 | 
			
		||||
 | 
			
		||||
services:
 | 
			
		||||
  web:
 | 
			
		||||
    image: mempool/frontend:latest
 | 
			
		||||
    user: "1000:1000"
 | 
			
		||||
    restart: on-failure
 | 
			
		||||
    stop_grace_period: 1m
 | 
			
		||||
    command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'"
 | 
			
		||||
    ports:
 | 
			
		||||
      - 80:8080
 | 
			
		||||
    environment:
 | 
			
		||||
      FRONTEND_HTTP_PORT: "8080"
 | 
			
		||||
      BACKEND_MAINNET_HTTP_HOST: "api"
 | 
			
		||||
  api:
 | 
			
		||||
    image: mempool/backend:latest
 | 
			
		||||
    user: "1000:1000"
 | 
			
		||||
    restart: on-failure
 | 
			
		||||
    stop_grace_period: 1m
 | 
			
		||||
    command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh"
 | 
			
		||||
    volumes:
 | 
			
		||||
      - ./data:/backend/cache
 | 
			
		||||
    environment:
 | 
			
		||||
      RPC_HOST: "127.0.0.1"
 | 
			
		||||
      RPC_PORT: "8332"
 | 
			
		||||
      RPC_USER: "mempool"
 | 
			
		||||
      RPC_PASS: "mempool"
 | 
			
		||||
      ELECTRUM_HOST: "127.0.0.1"
 | 
			
		||||
      MEMPOOL_BACKEND: "none"
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
- Under the `api` service, set the `ELECTRUM_HOST` and `ELECTRUM_PORT` keys to your Docker host ip address and set `ELECTRUM_TLS_ENABLED` to `false`:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
  api:
 | 
			
		||||
    environment:
 | 
			
		||||
      ELECTRUM_HOST: "172.27.0.1"
 | 
			
		||||
      ELECTRUM_PORT: "50002"
 | 
			
		||||
      ELECTRUM_TLS: "false"
 | 
			
		||||
      MYSQL_HOST: "db"
 | 
			
		||||
      MYSQL_PORT: "3306"
 | 
			
		||||
      MYSQL_DATABASE: "mempool"
 | 
			
		||||
      MYSQL_USER: "mempool"
 | 
			
		||||
      MYSQL_PASS: "mempool"
 | 
			
		||||
      BACKEND_MAINNET_HTTP_PORT: "8999"
 | 
			
		||||
      CACHE_DIR: "/backend/cache"
 | 
			
		||||
      MEMPOOL_CLEAR_PROTECTION_MINUTES: "20"
 | 
			
		||||
  db:
 | 
			
		||||
    image: mariadb:10.5.8
 | 
			
		||||
    user: "1000:1000"
 | 
			
		||||
    restart: on-failure
 | 
			
		||||
    stop_grace_period: 1m
 | 
			
		||||
    volumes:
 | 
			
		||||
      - ./mysql/data:/var/lib/mysql
 | 
			
		||||
      - ./mysql/db-scripts:/docker-entrypoint-initdb.d
 | 
			
		||||
    environment:
 | 
			
		||||
      MYSQL_DATABASE: "mempool"
 | 
			
		||||
      MYSQL_USER: "mempool"
 | 
			
		||||
      MYSQL_PASSWORD: "mempool"
 | 
			
		||||
      MYSQL_ROOT_PASSWORD: "admin"
 | 
			
		||||
``` 
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
You can update any of the settings in the `mempool-config.json` file using the environment variables to override. Refer to the `start.sh` script for a list of variables and their default values.
 | 
			
		||||
 | 
			
		||||
You can update all the environment variables inside the API container, especially the RPC and ELECTRUM ones
 | 
			
		||||
## Troubleshooting
 | 
			
		||||
 | 
			
		||||
## Run it
 | 
			
		||||
 | 
			
		||||
To run our docker-compose use the following cmd:
 | 
			
		||||
 | 
			
		||||
```bash
 | 
			
		||||
docker-compose up
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If everything went okay you should see the beautiful mempool :grin:
 | 
			
		||||
If you already have something running on port 80, change it to something else under the `web` service section. 
 | 
			
		||||
 | 
			
		||||
If you get stuck on "loading blocks", this means the websocket can't connect.
 | 
			
		||||
Check your nginx proxy setup, firewalls, etc. and open an issue if you need help.
 | 
			
		||||
 | 
			
		||||
If you can't connect to the `bitcoind` RPC server, check your firewall settings and your `bitcoin.conf` file, it should contain at least these settings:
 | 
			
		||||
 | 
			
		||||
```
 | 
			
		||||
rpcallowip=0.0.0.0/0
 | 
			
		||||
rpcuser=mempool
 | 
			
		||||
rpcpassword=mempool
 | 
			
		||||
bind=0.0.0.0:8333
 | 
			
		||||
rpcbind=0.0.0.0:8332
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
If you can't connect to electrum/electrs, check your firewall settings and the IP you entered.
 | 
			
		||||
 | 
			
		||||
If you see a permission denied error coming from the database container, check your filesystem. The cache files generated by the backend will be stored in the `./data` directory and the database will be stored in the `./mysql/data` directory relative to the location of the `docker-compose.yml` file. If you move it somewhere, the paths will have to be updated and/or recreated.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user