Merge pull request #1120 from knorrium/docker_updates
Updates to the docker-compose setup
This commit is contained in:
		
						commit
						11483852da
					
				
							
								
								
									
										234
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										234
									
								
								README.md
									
									
									
									
									
								
							| @ -14,6 +14,238 @@ Mempool can be self-hosted on a wide variety of your own hardware, ranging from | |||||||
| 4) [Production installation on a powerful FreeBSD server](https://github.com/mempool/mempool/tree/master/production) | 4) [Production installation on a powerful FreeBSD server](https://github.com/mempool/mempool/tree/master/production) | ||||||
| 5) [High Availability cluster using powerful FreeBSD servers](https://github.com/mempool/mempool/tree/master/production#high-availability) | 5) [High Availability cluster using powerful FreeBSD servers](https://github.com/mempool/mempool/tree/master/production#high-availability) | ||||||
| 
 | 
 | ||||||
|  | # Docker Installation | ||||||
|  | 
 | ||||||
|  | The `docker` 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. | ||||||
|  | 
 | ||||||
|  | ## bitcoind only configuration | ||||||
|  | 
 | ||||||
|  | To run an instance with the default settings, use the following command: | ||||||
|  | 
 | ||||||
|  | ```bash | ||||||
|  | $ docker-compose up | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | The default configuration will allow you to run Mempool using `bitcoind` as the backend, so address lookups will be disabled. It assumes you have added RPC credentials for the `mempool` user with a `mempool` password in your `bitcoin.conf` file: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  | rpcuser=mempool | ||||||
|  | rpcpassword=mempool | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | If you want to use your current credentials, update them in the `docker-compose.yml` file: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  |   api: | ||||||
|  |     environment: | ||||||
|  |       MEMPOOL_BACKEND: "none" | ||||||
|  |       RPC_HOST: "172.27.0.1" | ||||||
|  |       RPC_PORT: "8332" | ||||||
|  |       RPC_USER: "mempool" | ||||||
|  |       RPC_PASS: "mempool" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | Note: the IP in the example above refers to Docker's default gateway IP address so the container can hit the `bitcoind` instance running on the host machine. If your setup is different, update it accordingly. | ||||||
|  | 
 | ||||||
|  | You can check if the instance is running by visiting http://localhost - the graphs will be populated as new transactions are detected. | ||||||
|  | 
 | ||||||
|  | ## bitcoind+romanz/electrs configuration | ||||||
|  | 
 | ||||||
|  | In order to run with `romanz/electrs` as the backend, in addition to the settings required for running with `bitcoind` above, you will need to make the following changes to the `docker-compose.yml` file: | ||||||
|  | 
 | ||||||
|  | - Under the `api` service, change the value of the `MEMPOOL_BACKEND` key from `none` to `electrum`: | ||||||
|  | 
 | ||||||
|  | ``` | ||||||
|  |   api: | ||||||
|  |     environment: | ||||||
|  |       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" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | You can update any of the backend settings in the `mempool-config.json` file using the following environment variables to override them. | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "MEMPOOL": { | ||||||
|  |     "NETWORK": "mainnet", | ||||||
|  |     "BACKEND": "electrum", | ||||||
|  |     "HTTP_PORT": 8999, | ||||||
|  |     "SPAWN_CLUSTER_PROCS": 0, | ||||||
|  |     "API_URL_PREFIX": "/api/v1/", | ||||||
|  |     "POLL_RATE_MS": 2000, | ||||||
|  |     "CACHE_DIR": "./cache", | ||||||
|  |     "CLEAR_PROTECTION_MINUTES": 20, | ||||||
|  |     "RECOMMENDED_FEE_PERCENTILE": 50, | ||||||
|  |     "BLOCK_WEIGHT_UNITS": 4000000, | ||||||
|  |     "INITIAL_BLOCKS_AMOUNT": 8, | ||||||
|  |     "MEMPOOL_BLOCKS_AMOUNT": 8, | ||||||
|  |     "PRICE_FEED_UPDATE_INTERVAL": 3600, | ||||||
|  |     "USE_SECOND_NODE_FOR_MINFEE": false, | ||||||
|  |     "EXTERNAL_ASSETS": [] | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | docker-compose overrides:: | ||||||
|  | ``` | ||||||
|  |       MEMPOOL_NETWORK: "" | ||||||
|  |       MEMPOOL_BACKEND: "" | ||||||
|  |       MEMPOOL_HTTP_PORT: "" | ||||||
|  |       MEMPOOL_SPAWN_CLUSTER_PROCS: "" | ||||||
|  |       MEMPOOL_API_URL_PREFIX: "" | ||||||
|  |       MEMPOOL_POLL_RATE_MS: "" | ||||||
|  |       MEMPOOL_CACHE_DIR: "" | ||||||
|  |       MEMPOOL_CLEAR_PROTECTION_MINUTES: "" | ||||||
|  |       MEMPOOL_RECOMMENDED_FEE_PERCENTILE: "" | ||||||
|  |       MEMPOOL_BLOCK_WEIGHT_UNITS: "" | ||||||
|  |       MEMPOOL_INITIAL_BLOCKS_AMOUNT: "" | ||||||
|  |       MEMPOOL_MEMPOOL_BLOCKS_AMOUNT: "" | ||||||
|  |       MEMPOOL_PRICE_FEED_UPDATE_INTERVAL: "" | ||||||
|  |       MEMPOOL_USE_SECOND_NODE_FOR_MINFEE: "" | ||||||
|  |       MEMPOOL_EXTERNAL_ASSETS: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  | "CORE_RPC": { | ||||||
|  |     "HOST": "127.0.0.1", | ||||||
|  |     "PORT": 8332, | ||||||
|  |     "USERNAME": "mempool", | ||||||
|  |     "PASSWORD": "mempool" | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       CORE_RPC_HOST: "" | ||||||
|  |       CORE_RPC_PORT: "" | ||||||
|  |       CORE_RPC_USERNAME: "" | ||||||
|  |       CORE_RPC_PASSWORD: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "ELECTRUM": { | ||||||
|  |     "HOST": "127.0.0.1", | ||||||
|  |     "PORT": 50002, | ||||||
|  |     "TLS_ENABLED": true | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       ELECTRUM_HOST: "" | ||||||
|  |       ELECTRUM_PORT: "" | ||||||
|  |       ELECTRUM_TLS: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "ESPLORA": { | ||||||
|  |     "REST_API_URL": "http://127.0.0.1:3000" | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       ESPLORA_REST_API_URL: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "SECOND_CORE_RPC": { | ||||||
|  |     "HOST": "127.0.0.1", | ||||||
|  |     "PORT": 8332, | ||||||
|  |     "USERNAME": "mempool", | ||||||
|  |     "PASSWORD": "mempool" | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       SECOND_CORE_RPC_HOST: "" | ||||||
|  |       SECOND_CORE_RPC_PORT: "" | ||||||
|  |       SECOND_CORE_RPC_USERNAME: "" | ||||||
|  |       SECOND_CORE_RPC_PASSWORD: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "DATABASE": { | ||||||
|  |     "ENABLED": true, | ||||||
|  |     "HOST": "127.0.0.1", | ||||||
|  |     "PORT": 3306, | ||||||
|  |     "DATABASE": "mempool", | ||||||
|  |     "USERNAME": "mempool", | ||||||
|  |     "PASSWORD": "mempool" | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       DATABASE_ENABLED: "" | ||||||
|  |       DATABASE_HOST: "" | ||||||
|  |       DATABASE_PORT: "" | ||||||
|  |       DATABASE_DATABASE: "" | ||||||
|  |       DATABASE_USERAME: "" | ||||||
|  |       DATABASE_PASSWORD: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "SYSLOG": { | ||||||
|  |     "ENABLED": true, | ||||||
|  |     "HOST": "127.0.0.1", | ||||||
|  |     "PORT": 514, | ||||||
|  |     "MIN_PRIORITY": "info", | ||||||
|  |     "FACILITY": "local7" | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       SYSLOG_ENABLED: "" | ||||||
|  |       SYSLOG_HOST: "" | ||||||
|  |       SYSLOG_PORT: "" | ||||||
|  |       SYSLOG_MIN_PRIORITY: "" | ||||||
|  |       SYSLOG_FACILITY: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "STATISTICS": { | ||||||
|  |     "ENABLED": true, | ||||||
|  |     "TX_PER_SECOND_SAMPLE_PERIOD": 150 | ||||||
|  |   }, | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       STATISTICS_ENABLED: "" | ||||||
|  |       STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | JSON: | ||||||
|  | ``` | ||||||
|  |   "BISQ": { | ||||||
|  |     "ENABLED": false, | ||||||
|  |     "DATA_PATH": "/bisq/statsnode-data/btc_mainnet/db" | ||||||
|  |   } | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | docker-compose overrides: | ||||||
|  | ``` | ||||||
|  |       BISQ_ENABLED: "" | ||||||
|  |       BISQ_DATA_PATH: "" | ||||||
|  | ``` | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
| # Manual Installation | # Manual Installation | ||||||
| 
 | 
 | ||||||
| The following instructions are for a manual installation on Linux or FreeBSD. The file and directory paths may need to be changed to match your OS. | The following instructions are for a manual installation on Linux or FreeBSD. The file and directory paths may need to be changed to match your OS. | ||||||
| @ -158,7 +390,7 @@ Install mempool dependencies from npm and build the frontend static HTML/CSS/JS: | |||||||
| Install the output into nginx webroot folder: | Install the output into nginx webroot folder: | ||||||
| 
 | 
 | ||||||
| ```bash | ```bash | ||||||
|   sudo rsync -av --delete dist/mempool/ /var/www/ |   sudo rsync -av --delete dist/ /var/www/ | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| ## nginx + certbot | ## nginx + certbot | ||||||
|  | |||||||
| @ -1,96 +0,0 @@ | |||||||
| # Docker |  | ||||||
| 
 |  | ||||||
| ## Initialization |  | ||||||
| 
 |  | ||||||
| In an empty dir create 2 sub-dirs |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| mkdir -p data mysql/data |  | ||||||
| ``` |  | ||||||
| 
 |  | ||||||
| Your dir should now look like that: |  | ||||||
| 
 |  | ||||||
| ```bash |  | ||||||
| $ls -R |  | ||||||
| .: |  | ||||||
| data mysql |  | ||||||
| 
 |  | ||||||
| ./data: |  | ||||||
| 
 |  | ||||||
| ./mysql: |  | ||||||
| data  db-scripts |  | ||||||
| 
 |  | ||||||
| ./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" |  | ||||||
|       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 all the environment variables inside the API container, especially the RPC and ELECTRUM ones |  | ||||||
| 
 |  | ||||||
| ## 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 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. |  | ||||||
| @ -1,38 +1,62 @@ | |||||||
| { | { | ||||||
|   "MEMPOOL": { |   "MEMPOOL": { | ||||||
|     "NETWORK": "mainnet", |     "NETWORK": "__MEMPOOL_NETWORK__", | ||||||
|     "BACKEND": "electrum", |     "BACKEND": "__MEMPOOL_BACKEND__", | ||||||
|     "HTTP_PORT": __MEMPOOL_BACKEND_MAINNET_HTTP_PORT__, |     "HTTP_PORT": __MEMPOOL_HTTP_PORT__, | ||||||
|     "SPAWN_CLUSTER_PROCS": 0, |     "SPAWN_CLUSTER_PROCS": __MEMPOOL_SPAWN_CLUSTER_PROCS__, | ||||||
|     "API_URL_PREFIX": "/api/v1/", |     "API_URL_PREFIX": "__MEMPOOL_API_URL_PREFIX__", | ||||||
|     "POLL_RATE_MS": 2000, |     "POLL_RATE_MS": __MEMPOOL_POLL_RATE_MS__, | ||||||
|     "CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__", |     "CACHE_DIR": "__MEMPOOL_CACHE_DIR__", | ||||||
|     "CLEAR_PROTECTION_MINUTES": __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__ |     "CLEAR_PROTECTION_MINUTES": __MEMPOOL_CLEAR_PROTECTION_MINUTES__, | ||||||
|  |     "RECOMMENDED_FEE_PERCENTILE": __MEMPOOL_RECOMMENDED_FEE_PERCENTILE__, | ||||||
|  |     "BLOCK_WEIGHT_UNITS": __MEMPOOL_BLOCK_WEIGHT_UNITS__, | ||||||
|  |     "INITIAL_BLOCKS_AMOUNT": __MEMPOOL_INITIAL_BLOCKS_AMOUNT__, | ||||||
|  |     "MEMPOOL_BLOCKS_AMOUNT": __MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__, | ||||||
|  |     "PRICE_FEED_UPDATE_INTERVAL": __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__, | ||||||
|  |     "USE_SECOND_NODE_FOR_MINFEE": __MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__, | ||||||
|  |     "EXTERNAL_ASSETS": __MEMPOOL_EXTERNAL_ASSETS__ | ||||||
|   }, |   }, | ||||||
|   "CORE_RPC": { |   "CORE_RPC": { | ||||||
|     "HOST": "__BITCOIN_MAINNET_RPC_HOST__", |     "HOST": "__CORE_RPC_HOST__", | ||||||
|     "PORT": __BITCOIN_MAINNET_RPC_PORT__, |     "PORT": __CORE_RPC_PORT__, | ||||||
|     "USERNAME": "__BITCOIN_MAINNET_RPC_USER__", |     "USERNAME": "__CORE_RPC_USERNAME__", | ||||||
|     "PASSWORD": "__BITCOIN_MAINNET_RPC_PASS__" |     "PASSWORD": "__CORE_RPC_PASSWORD__" | ||||||
|   }, |   }, | ||||||
|   "ELECTRUM": { |   "ELECTRUM": { | ||||||
|     "HOST": "__ELECTRUM_MAINNET_HTTP_HOST__", |     "HOST": "__ELECTRUM_HOST__", | ||||||
|     "PORT": __ELECTRUM_MAINNET_HTTP_PORT__, |     "PORT": __ELECTRUM_PORT__, | ||||||
|     "TLS_ENABLED": __ELECTRUM_MAINNET_TLS_ENABLED__ |     "TLS_ENABLED": __ELECTRUM_TLS_ENABLED__ | ||||||
|   }, |   }, | ||||||
|   "ESPLORA": { |   "ESPLORA": { | ||||||
|     "REST_API_URL": "http://127.0.0.1:3000" |     "REST_API_URL": "__ESPLORA_REST_API_URL__" | ||||||
|  |   }, | ||||||
|  |   "SECOND_CORE_RPC": { | ||||||
|  |     "HOST": "__SECOND_CORE_RPC_HOST__", | ||||||
|  |     "PORT": __SECOND_CORE_RPC_PORT__, | ||||||
|  |     "USERNAME": "__SECOND_CORE_RPC_USERNAME__", | ||||||
|  |     "PASSWORD": "__SECOND_CORE_RPC_PASSWORD__" | ||||||
|   }, |   }, | ||||||
|   "DATABASE": { |   "DATABASE": { | ||||||
|     "ENABLED": true, |     "ENABLED": __DATABASE_ENABLED__, | ||||||
|     "HOST": "__MYSQL_HOST__", |     "HOST": "__DATABASE_HOST__", | ||||||
|     "PORT": __MYSQL_PORT__, |     "PORT": __DATABASE_PORT__, | ||||||
|     "DATABASE": "__MYSQL_DATABASE__", |     "DATABASE": "__DATABASE_DATABASE__", | ||||||
|     "USERNAME": "__MYSQL_USERNAME__", |     "USERNAME": "__DATABASE_USERNAME__", | ||||||
|     "PASSWORD": "__MYSQL_PASSWORD__" |     "PASSWORD": "__DATABASE_PASSWORD__" | ||||||
|  |   }, | ||||||
|  |   "SYSLOG": { | ||||||
|  |     "ENABLED": __SYSLOG_ENABLED__, | ||||||
|  |     "HOST": "__SYSLOG_HOST__", | ||||||
|  |     "PORT": __SYSLOG_PORT__, | ||||||
|  |     "MIN_PRIORITY": "__SYSLOG_MIN_PRIORITY__", | ||||||
|  |     "FACILITY": "__SYSLOG_FACILITY__" | ||||||
|   }, |   }, | ||||||
|   "STATISTICS": { |   "STATISTICS": { | ||||||
|     "ENABLED": true, |     "ENABLED": __STATISTICS_ENABLED__, | ||||||
|     "TX_PER_SECOND_SAMPLE_PERIOD": 150 |     "TX_PER_SECOND_SAMPLE_PERIOD": __STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__ | ||||||
|  |   }, | ||||||
|  |   "BISQ": { | ||||||
|  |     "ENABLED": __BISQ_ENABLED__, | ||||||
|  |     "DATA_PATH": "__BISQ_DATA_PATH__" | ||||||
|   } |   } | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,41 +1,116 @@ | |||||||
| #!/bin/sh | #!/bin/sh | ||||||
| 
 | 
 | ||||||
| #MEMPOOL | # MEMPOOL | ||||||
| __MEMPOOL_BACKEND_MAINNET_HTTP_PORT__=${BACKEND_MAINNET_HTTP_PORT:=8999} | __MEMPOOL_NETWORK__=${MEMPOOL_NETWORK:=mainnet} | ||||||
| __MEMPOOL_BACKEND_MAINNET_CACHE_DIR__=${CACHE_DIR:=./cache} | __MEMPOOL_BACKEND__=${MEMPOOL_BACKEND:=electrum} | ||||||
| __MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} | __MEMPOOL_HTTP_PORT__=${BACKEND_HTTP_PORT:=8999} | ||||||
| # BITCOIN | __MEMPOOL_SPAWN_CLUSTER_PROCS__=${MEMPOOL_SPAWN_CLUSTER_PROCS:=0} | ||||||
| __BITCOIN_MAINNET_RPC_HOST__=${RPC_HOST:=127.0.0.1} | __MEMPOOL_API_URL_PREFIX__=${MEMPOOL_API_URL_PREFIX:=/api/v1/} | ||||||
| __BITCOIN_MAINNET_RPC_PORT__=${RPC_PORT:=8332} | __MEMPOOL_POLL_RATE_MS__=${MEMPOOL_POLL_RATE_MS:=2000} | ||||||
| __BITCOIN_MAINNET_RPC_USER__=${RPC_USER:=mempool} | __MEMPOOL_CACHE_DIR__=${MEMPOOL_CACHE_DIR:=./cache} | ||||||
| __BITCOIN_MAINNET_RPC_PASS__=${RPC_PASS:=mempool} | __MEMPOOL_CLEAR_PROTECTION_MINUTES__=${MEMPOOL_CLEAR_PROTECTION_MINUTES:=20} | ||||||
|  | __MEMPOOL_RECOMMENDED_FEE_PERCENTILE__=${MEMPOOL_RECOMMENDED_FEE_PERCENTILE:=50} | ||||||
|  | __MEMPOOL_BLOCK_WEIGHT_UNITS__=${MEMPOOL_BLOCK_WEIGHT_UNITS:=4000000} | ||||||
|  | __MEMPOOL_INITIAL_BLOCKS_AMOUNT__=${MEMPOOL_INITIAL_BLOCKS_AMOUNT:=8} | ||||||
|  | __MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__=${MEMPOOL_MEMPOOL_BLOCKS_AMOUNT:=8} | ||||||
|  | __MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__=${MEMPOOL_PRICE_FEED_UPDATE_INTERVAL:=3600} | ||||||
|  | __MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__=${MEMPOOL_USE_SECOND_NODE_FOR_MINFEE:=false} | ||||||
|  | __MEMPOOL_EXTERNAL_ASSETS__=${MEMPOOL_EXTERNAL_ASSETS:=[]} | ||||||
|  | 
 | ||||||
|  | # CORE_RPC | ||||||
|  | __CORE_RPC_HOST__=${CORE_RPC_HOST:=127.0.0.1} | ||||||
|  | __CORE_RPC_PORT__=${CORE_RPC_PORT:=8332} | ||||||
|  | __CORE_RPC_USERNAME__=${CORE_RPC_USERNAME:=mempool} | ||||||
|  | __CORE_RPC_PASSWORD__=${CORE_RPC_PASSWORD:=mempool} | ||||||
|  | 
 | ||||||
| # ELECTRUM | # ELECTRUM | ||||||
| __ELECTRUM_MAINNET_HTTP_HOST__=${ELECTRUM_HOST:=127.0.0.1} | __ELECTRUM_HOST__=${ELECTRUM_HOST:=127.0.0.1} | ||||||
| __ELECTRUM_MAINNET_HTTP_PORT__=${ELECTRUM_PORT:=50002} # 50001? | __ELECTRUM_PORT__=${ELECTRUM_PORT:=50002} | ||||||
| __ELECTRUM_MAINNET_TLS_ENABLED__=${ELECTRUM_TLS:=false} | __ELECTRUM_TLS_ENABLED__=${ELECTRUM_TLS:=false} | ||||||
| # MYSQL |  | ||||||
| __MYSQL_HOST__=${MYSQL_HOST:=127.0.0.1} |  | ||||||
| __MYSQL_PORT__=${MYSQL_PORT:=3306} |  | ||||||
| __MYSQL_DATABASE__=${MYSQL_DATABASE:=mempool} |  | ||||||
| __MYSQL_USERNAME__=${MYSQL_USER:=mempool} |  | ||||||
| __MYSQL_PASSWORD__=${MYSQL_PASS:=mempool} |  | ||||||
| 
 | 
 | ||||||
| mkdir -p "${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}" | # ESPLORA | ||||||
|  | __ESPLORA_REST_API_URL__=${ESPLORA_REST_API_URL:=http://127.0.0.1:3000} | ||||||
| 
 | 
 | ||||||
| sed -i "s/__BITCOIN_MAINNET_RPC_HOST__/${__BITCOIN_MAINNET_RPC_HOST__}/g" mempool-config.json | # SECOND_CORE_RPC | ||||||
| sed -i "s/__BITCOIN_MAINNET_RPC_PORT__/${__BITCOIN_MAINNET_RPC_PORT__}/g" mempool-config.json | __SECOND_CORE_RPC_HOST__=${SECOND_CORE_RPC_HOST:=127.0.0.1} | ||||||
| sed -i "s/__BITCOIN_MAINNET_RPC_USER__/${__BITCOIN_MAINNET_RPC_USER__}/g" mempool-config.json | __SECOND_CORE_RPC_PORT__=${SECOND_CORE_RPC_PORT:=8332} | ||||||
| sed -i "s/__BITCOIN_MAINNET_RPC_PASS__/${__BITCOIN_MAINNET_RPC_PASS__}/g" mempool-config.json | __SECOND_CORE_RPC_USERNAME__=${SECOND_CORE_RPC_USERNAME:=mempool} | ||||||
| sed -i "s/__ELECTRUM_MAINNET_HTTP_HOST__/${__ELECTRUM_MAINNET_HTTP_HOST__}/g" mempool-config.json | __SECOND_CORE_RPC_PASSWORD__=${SECOND_CORE_RPC_PASSWORD:=mempool} | ||||||
| sed -i "s/__ELECTRUM_MAINNET_HTTP_PORT__/${__ELECTRUM_MAINNET_HTTP_PORT__}/g" mempool-config.json | 
 | ||||||
| sed -i "s/__ELECTRUM_MAINNET_TLS_ENABLED__/${__ELECTRUM_MAINNET_TLS_ENABLED__}/g" mempool-config.json | # DATABASE | ||||||
| sed -i "s/__MYSQL_HOST__/${__MYSQL_HOST__}/g" mempool-config.json | __DATABASE_ENABLED__=${DATABASE_ENABLED:=true} | ||||||
| sed -i "s/__MYSQL_PORT__/${__MYSQL_PORT__}/g" mempool-config.json | __DATABASE_HOST__=${DATABASE_HOST:=127.0.0.1} | ||||||
| sed -i "s/__MYSQL_DATABASE__/${__MYSQL_DATABASE__}/g" mempool-config.json | __DATABASE_PORT__=${DATABASE_PORT:=3306} | ||||||
| sed -i "s/__MYSQL_USERNAME__/${__MYSQL_USERNAME__}/g" mempool-config.json | __DATABASE_DATABASE__=${DATABASE_DATABASE:=mempool} | ||||||
| sed -i "s/__MYSQL_PASSWORD__/${__MYSQL_PASSWORD__}/g" mempool-config.json | __DATABASE_USERNAME__=${DATABASE_USERNAME:=mempool} | ||||||
| sed -i "s!__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__!${__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__}!g" mempool-config.json | __DATABASE_PASSWORD__=${DATABASE_PASSWORD:=mempool} | ||||||
| sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/${__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__}/g" mempool-config.json | 
 | ||||||
| sed -i "s/__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_BACKEND_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json | # SYSLOG | ||||||
|  | __SYSLOG_ENABLED__=${SYSLOG_ENABLED:=false} | ||||||
|  | __SYSLOG_HOST__=${SYSLOG_HOST:=127.0.0.1} | ||||||
|  | __SYSLOG_PORT__=${SYSLOG_PORT:=514} | ||||||
|  | __SYSLOG_MIN_PRIORITY__=${SYSLOG_MIN_PRIORITY:=info} | ||||||
|  | __SYSLOG_FACILITY__=${SYSLOG_FACILITY:=local7} | ||||||
|  | 
 | ||||||
|  | # STATISTICS | ||||||
|  | __STATISTICS_ENABLED__=${STATISTICS_ENABLED:=true} | ||||||
|  | __STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__=${STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD:=150} | ||||||
|  | 
 | ||||||
|  | # BISQ | ||||||
|  | __BISQ_ENABLED__=${BISQ_ENABLED:=false} | ||||||
|  | __BISQ_DATA_PATH__=${BISQ_DATA_PATH:=/bisq/statsnode-data/btc_mainnet/db} | ||||||
|  | 
 | ||||||
|  | mkdir -p "${__MEMPOOL_CACHE_DIR__}" | ||||||
|  | 
 | ||||||
|  | sed -i "s/__MEMPOOL_NETWORK__/${__MEMPOOL_NETWORK__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_BACKEND__/${__MEMPOOL_BACKEND__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_HTTP_PORT__/${__MEMPOOL_HTTP_PORT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_SPAWN_CLUSTER_PROCS__/${__MEMPOOL_SPAWN_CLUSTER_PROCS__}/g" mempool-config.json | ||||||
|  | sed -i "s!__MEMPOOL_API_URL_PREFIX__!${__MEMPOOL_API_URL_PREFIX__}!g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_POLL_RATE_MS__/${__MEMPOOL_POLL_RATE_MS__}/g" mempool-config.json | ||||||
|  | sed -i "s!__MEMPOOL_CACHE_DIR__!${__MEMPOOL_CACHE_DIR__}!g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_CLEAR_PROTECTION_MINUTES__/${__MEMPOOL_CLEAR_PROTECTION_MINUTES__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__/${__MEMPOOL_RECOMMENDED_FEE_PERCENTILE__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_BLOCK_WEIGHT_UNITS__/${__MEMPOOL_BLOCK_WEIGHT_UNITS__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_INITIAL_BLOCKS_AMOUNT__/${__MEMPOOL_INITIAL_BLOCKS_AMOUNT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__/${__MEMPOOL_MEMPOOL_BLOCKS_AMOUNT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__/${__MEMPOOL_PRICE_FEED_UPDATE_INTERVAL__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__/${__MEMPOOL_USE_SECOND_NODE_FOR_MINFEE__}/g" mempool-config.json | ||||||
|  | sed -i "s/__MEMPOOL_EXTERNAL_ASSETS__/${__MEMPOOL_EXTERNAL_ASSETS__}/g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s/__CORE_RPC_HOST__/${__CORE_RPC_HOST__}/g" mempool-config.json | ||||||
|  | sed -i "s/__CORE_RPC_PORT__/${__CORE_RPC_PORT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__CORE_RPC_USERNAME__/${__CORE_RPC_USERNAME__}/g" mempool-config.json | ||||||
|  | sed -i "s/__CORE_RPC_PASSWORD__/${__CORE_RPC_PASSWORD__}/g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s/__ELECTRUM_HOST__/${__ELECTRUM_HOST__}/g" mempool-config.json | ||||||
|  | sed -i "s/__ELECTRUM_PORT__/${__ELECTRUM_PORT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__ELECTRUM_TLS_ENABLED__/${__ELECTRUM_TLS_ENABLED__}/g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s!__ESPLORA_REST_API_URL__!${__ESPLORA_REST_API_URL__}!g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s/__SECOND_CORE_RPC_HOST__/${__SECOND_CORE_RPC_HOST__}/g" mempool-config.json | ||||||
|  | sed -i "s/__SECOND_CORE_RPC_PORT__/${__SECOND_CORE_RPC_PORT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__SECOND_CORE_RPC_USERNAME__/${__SECOND_CORE_RPC_USERNAME__}/g" mempool-config.json | ||||||
|  | sed -i "s/__SECOND_CORE_RPC_PASSWORD__/${__SECOND_CORE_RPC_PASSWORD__}/g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s/__DATABASE_ENABLED__/${__DATABASE_ENABLED__}/g" mempool-config.json | ||||||
|  | sed -i "s/__DATABASE_HOST__/${__DATABASE_HOST__}/g" mempool-config.json | ||||||
|  | sed -i "s/__DATABASE_PORT__/${__DATABASE_PORT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__DATABASE_DATABASE__/${__DATABASE_DATABASE__}/g" mempool-config.json | ||||||
|  | sed -i "s/__DATABASE_USERNAME__/${__DATABASE_USERNAME__}/g" mempool-config.json | ||||||
|  | sed -i "s/__DATABASE_PASSWORD__/${__DATABASE_PASSWORD__}/g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s/__SYSLOG_ENABLED__/${__SYSLOG_ENABLED__}/g" mempool-config.json | ||||||
|  | sed -i "s/__SYSLOG_HOST__/${__SYSLOG_HOST__}/g" mempool-config.json | ||||||
|  | sed -i "s/__SYSLOG_PORT__/${__SYSLOG_PORT__}/g" mempool-config.json | ||||||
|  | sed -i "s/__SYSLOG_MIN_PRIORITY__/${__SYSLOG_MIN_PRIORITY__}/g" mempool-config.json | ||||||
|  | sed -i "s/__SYSLOG_FACILITY__/${__SYSLOG_FACILITY__}/g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s/__STATISTICS_ENABLED__/${__STATISTICS_ENABLED__}/g" mempool-config.json | ||||||
|  | sed -i "s/__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__/${__STATISTICS_TX_PER_SECOND_SAMPLE_PERIOD__}/g" mempool-config.json | ||||||
|  | 
 | ||||||
|  | sed -i "s/__BISQ_ENABLED__/${__BISQ_ENABLED__}/g" mempool-config.json | ||||||
|  | sed -i "s!__BISQ_DATA_PATH__!${__BISQ_DATA_PATH__}!g" mempool-config.json | ||||||
| 
 | 
 | ||||||
| node /backend/dist/index.js | node /backend/dist/index.js | ||||||
|  | |||||||
							
								
								
									
										0
									
								
								docker/data/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								docker/data/.gitkeep
									
									
									
									
									
										Normal file
									
								
							| @ -1,23 +1,10 @@ | |||||||
| version: "3.7" | version: "3.7" | ||||||
| 
 | 
 | ||||||
| services: | services: | ||||||
| 
 |  | ||||||
|   electrum: |  | ||||||
|     build: |  | ||||||
|       context: . |  | ||||||
|       dockerfile: docker/electrum/Dockerfile |  | ||||||
|     user: "1000:1000" |  | ||||||
|     restart: on-failure |  | ||||||
|     command: "" |  | ||||||
|     ports: |  | ||||||
|       - 50001:50001 |  | ||||||
|       - 50002:50002 |  | ||||||
|       - 4224:4224 |  | ||||||
|       - 8332:8332 |  | ||||||
|     environment: |  | ||||||
|       ELECTRUM: "electrum" |  | ||||||
|       # add electrs configs |  | ||||||
|   web: |   web: | ||||||
|  |     environment: | ||||||
|  |       FRONTEND_HTTP_PORT: "8080" | ||||||
|  |       BACKEND_MAINNET_HTTP_HOST: "api" | ||||||
|     image: mempool/frontend:latest |     image: mempool/frontend:latest | ||||||
|     user: "1000:1000" |     user: "1000:1000" | ||||||
|     restart: on-failure |     restart: on-failure | ||||||
| @ -25,10 +12,19 @@ services: | |||||||
|     command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'" |     command: "./wait-for db:3306 --timeout=720 -- nginx -g 'daemon off;'" | ||||||
|     ports: |     ports: | ||||||
|       - 80:8080 |       - 80:8080 | ||||||
|     environment: |  | ||||||
|       FRONTEND_HTTP_PORT: "8080" |  | ||||||
|       BACKEND_MAINNET_HTTP_HOST: "api" |  | ||||||
|   api: |   api: | ||||||
|  |     environment: | ||||||
|  |       MEMPOOL_BACKEND: "none" | ||||||
|  |       CORE_RPC_HOST: "172.27.0.1" | ||||||
|  |       CORE_RPC_PORT: "8332" | ||||||
|  |       CORE_RPC_USERNAME: "mempool" | ||||||
|  |       CORE_RPC_PASSWORD: "mempool" | ||||||
|  |       DATABASE_ENABLED: "true" | ||||||
|  |       DATABASE_HOST: "db" | ||||||
|  |       DATABASE_DATABASE: "mempool" | ||||||
|  |       DATABASE_USERNAME: "mempool" | ||||||
|  |       DATABASE_PASSWORD: "mempool" | ||||||
|  |       STATISTICS_ENABLED: "true" | ||||||
|     image: mempool/backend:latest |     image: mempool/backend:latest | ||||||
|     user: "1000:1000" |     user: "1000:1000" | ||||||
|     restart: on-failure |     restart: on-failure | ||||||
| @ -36,32 +32,15 @@ services: | |||||||
|     command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh" |     command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh" | ||||||
|     volumes: |     volumes: | ||||||
|       - ./data:/backend/cache |       - ./data:/backend/cache | ||||||
|  |   db: | ||||||
|     environment: |     environment: | ||||||
|       RPC_HOST: "127.0.0.1" |  | ||||||
|       RPC_PORT: "8332" |  | ||||||
|       RPC_USER: "mempool" |  | ||||||
|       RPC_PASS: "mempool" |  | ||||||
|       ELECTRUM_HOST: "127.0.0.1" |  | ||||||
|       ELECTRUM_PORT: "50002" |  | ||||||
|       ELECTRUM_TLS: "false" |  | ||||||
|       MYSQL_HOST: "db" |  | ||||||
|       MYSQL_PORT: "3306" |  | ||||||
|       MYSQL_DATABASE: "mempool" |       MYSQL_DATABASE: "mempool" | ||||||
|       MYSQL_USER: "mempool" |       MYSQL_USER: "mempool" | ||||||
|       MYSQL_PASS: "mempool" |       MYSQL_PASSWORD: "mempool" | ||||||
|       BACKEND_MAINNET_HTTP_PORT: "8999" |       MYSQL_ROOT_PASSWORD: "admin" | ||||||
|       CACHE_DIR: "/backend/cache" |  | ||||||
|       MEMPOOL_CLEAR_PROTECTION_MINUTES: "20" |  | ||||||
|   db: |  | ||||||
|     image: mariadb:10.5.8 |     image: mariadb:10.5.8 | ||||||
|     user: "1000:1000" |     user: "1000:1000" | ||||||
|     restart: on-failure |     restart: on-failure | ||||||
|     stop_grace_period: 1m |     stop_grace_period: 1m | ||||||
|     volumes: |     volumes: | ||||||
|       - ./mysql/data:/var/lib/mysql |       - ./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" |  | ||||||
|  | |||||||
| @ -2,7 +2,7 @@ | |||||||
| 
 | 
 | ||||||
| #backend | #backend | ||||||
| gitMaster="\.\.\/\.git\/refs\/heads\/master" | gitMaster="\.\.\/\.git\/refs\/heads\/master" | ||||||
| git ls-remote https://github.com/mempool/mempool.git $1 | awk '{ print $1}' > ./backend/master | git ls-remote https://github.com/mempool/mempool.git "$1^{}" | awk '{ print $1}' > ./backend/master | ||||||
| cp ./docker/backend/* ./backend/ | cp ./docker/backend/* ./backend/ | ||||||
| sed -i "s/${gitMaster}/master/g" ./backend/src/api/backend-info.ts | sed -i "s/${gitMaster}/master/g" ./backend/src/api/backend-info.ts | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										0
									
								
								docker/mysql/data/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								docker/mysql/data/.gitkeep
									
									
									
									
									
										Normal file
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user