diff --git a/Production/nginx.tmpl b/Production/nginx.tmpl index 3f7c69a..f00f37e 100644 --- a/Production/nginx.tmpl +++ b/Production/nginx.tmpl @@ -209,33 +209,39 @@ } {{ end }} {{ if (eq $serviceName "mempool_web") }} + # https://github.com/mempool/mempool/tree/master/production/nginx location /mempool/ { proxy_pass http://mempool_web:8080; + sub_filter_types *; + sub_filter_once off; + sub_filter 'base href="/' 'base href="/mempool/'; + sub_filter '="/resources' '="/mempool/resources'; + # static API docs - location = /api { + location = /mempool/api { try_files $uri $uri/ /en-US/index.html =404; } - location = /api/ { + location = /mempool/api/ { try_files $uri $uri/ /en-US/index.html =404; } # mainnet API - location /api/v1/ws { + location /mempool/api/v1/ws { proxy_pass http://mempool_api:8999/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "Upgrade"; } - location /api/v1 { + location /mempool/api/v1 { proxy_pass http://mempool_api:8999/api/v1; } - location /api/ { + location /mempool/api/ { proxy_pass http://mempool_api:8999/api/v1/; } # mainnet API - location /ws { + location /mempool/ws { proxy_pass http://mempool_api:8999/; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; diff --git a/docker-compose-generator/docker-fragments/opt-add-mempool.yml b/docker-compose-generator/docker-fragments/opt-add-mempool.yml index 1830a61..9ecc423 100644 --- a/docker-compose-generator/docker-fragments/opt-add-mempool.yml +++ b/docker-compose-generator/docker-fragments/opt-add-mempool.yml @@ -1,10 +1,14 @@ version: '3' +# reference: https://github.com/mempool/mempool/blob/master/docker/docker-compose.yml services: bitcoind: environment: BITCOIN_EXTRA_ARGS: | - rpcauth=mempool:d77ee0acf132038f6aaa9d4500d745ec$72cc78dcf18191c91d10c15ff8f7c3dbbd170c4d3107cca35d71c6bf96af2ed9 + # We need to use rpcauth because we also need cookieauth. rpcpassword disabled cookie file auth. + # Be careful if you copy the line below from the docker-compose.yml! A dollar sign is escaped. + rpcauth=mempool:d77ee0acf132038f6aaa9d4500d745ec$$72cc78dcf18191c91d10c15ff8f7c3dbbd170c4d3107cca35d71c6bf96af2ed9 + mempool_web: image: mempool/frontend:latest restart: on-failure @@ -20,34 +24,31 @@ services: image: mempool/backend:latest restart: on-failure stop_grace_period: 1m - command: "./wait-for-it.sh db:3306 --timeout=720 --strict -- ./start.sh" + command: "./wait-for-it.sh mempool_db:3306 --timeout=720 --strict -- ./start.sh" volumes: - mempool_api_datadir:/backend/cache environment: - RPC_HOST: "bitcoind" - RPC_PORT: "43782" - RPC_USER: "mempool" - RPC_PASS: "mempool" + MEMPOOL_BACKEND: "electrum" ELECTRUM_HOST: "electrumx" ELECTRUM_PORT: "50002" - ELECTRUM_TLS: "false" - MYSQL_HOST: "mempool_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" + ELECTRUM_TLS_ENABLED: "false" + CORE_RPC_HOST: "bitcoind" + CORE_RPC_PORT: "43782" + CORE_RPC_USERNAME: "mempool" + CORE_RPC_PASSWORD: "mempool" + DATABASE_ENABLED: "true" + DATABASE_HOST: "mempool_db" + DATABASE_DATABASE: "mempool" + DATABASE_USERNAME: "mempool" + DATABASE_PASSWORD: "mempool" mempool_db: image: mariadb:10.5.8 - restart: on-failure + restart: on-failure expose: - "3306" volumes: - "mempool_db_datadir:/var/lib/mysql" - - ./mysql/db-scripts:/docker-entrypoint-initdb.d environment: MYSQL_DATABASE: "mempool" MYSQL_USER: "mempool" @@ -56,13 +57,14 @@ services: btcpayserver: environment: - BTCPAY_EXTERNALSERVICES: "Mempool Explorer:/mempool-explorer" + BTCPAY_EXTERNALSERVICES: "Mempool Explorer:/mempool" + volumes: - - mempool_db_datadir: - - mempool_api_datadir: + mempool_db_datadir: + mempool_api_datadir: required: - - opt-add-electrumx - - opt-txindex + - "opt-add-electrumx" + incompatible: - pruning