Move docker files in subdir

This commit is contained in:
Bastien 2021-02-03 02:12:15 +01:00
parent 543fe8c735
commit 6782229a3d
11 changed files with 14 additions and 46 deletions

View File

@ -2,13 +2,16 @@ FROM node:12-buster-slim AS builder
WORKDIR /build WORKDIR /build
COPY . . COPY . .
RUN sed -i "s!../.git/refs/heads/master!master!g" ./src/api/backend-info.ts RUN sed -i "s!../.git/refs/heads/master!master!g" ./src/api/backend-info.ts
RUN apt-get update RUN apt-get update
RUN apt-get install -y build-essential python3 pkg-config RUN apt-get install -y build-essential python3 pkg-config
RUN npm ci --production RUN npm ci --production
RUN npm i typescript RUN npm i typescript
RUN npm run build RUN npm run build
RUN mv mempool-config-docker.json mempool-config.json
RUN mv ./docker/* .
FROM node:12-buster-slim FROM node:12-buster-slim

View File

@ -1,38 +0,0 @@
{
"MEMPOOL": {
"NETWORK": "mainnet",
"BACKEND": "electrum",
"HTTP_PORT": __MEMPOOL_BACKEND_MAINNET_HTTP_PORT__,
"SPAWN_CLUSTER_PROCS": 0,
"API_URL_PREFIX": "/api/v1/",
"POLL_RATE_MS": 2000,
"CACHE_DIR": "__MEMPOOL_BACKEND_MAINNET_CACHE_DIR__"
},
"CORE_RPC": {
"HOST": "__BITCOIN_MAINNET_RPC_HOST__",
"PORT": __BITCOIN_MAINNET_RPC_PORT__,
"USERNAME": "__BITCOIN_MAINNET_RPC_USER__",
"PASSWORD": "__BITCOIN_MAINNET_RPC_PASS__"
},
"ELECTRUM": {
"HOST": "__ELECTRS_MAINNET_HTTP_HOST__",
"PORT": __ELECTRS_MAINNET_HTTP_PORT__,
"TLS_ENABLED": false,
"TX_LOOKUPS": true
},
"ESPLORA": {
"REST_API_URL": "http://127.0.0.1:3000"
},
"DATABASE": {
"ENABLED": true,
"HOST": "__MYSQL_HOST__",
"PORT": __MYSQL_PORT__,
"DATABASE": "mempool",
"USERNAME": "mempool",
"PASSWORD": "mempool"
},
"STATISTICS": {
"ENABLED": true,
"TX_PER_SECOND_SAMPLE_PERIOD": 150
}
}

View File

@ -36,7 +36,6 @@
"locutus": "^2.0.12", "locutus": "^2.0.12",
"mysql2": "^1.6.1", "mysql2": "^1.6.1",
"node-worker-threads-pool": "^1.4.2", "node-worker-threads-pool": "^1.4.2",
"typescript": "~3.9.7",
"ws": "^7.3.1" "ws": "^7.3.1"
}, },
"devDependencies": { "devDependencies": {

View File

@ -7,6 +7,8 @@ RUN apt-get install -y build-essential rsync
RUN npm i RUN npm i
RUN npm run build RUN npm run build
RUN mv ./docker/* .
FROM nginx:1.17.8-alpine FROM nginx:1.17.8-alpine
WORKDIR /patch WORKDIR /patch
@ -14,8 +16,8 @@ WORKDIR /patch
COPY --from=builder /build/entrypoint.sh . COPY --from=builder /build/entrypoint.sh .
COPY --from=builder /build/wait-for . COPY --from=builder /build/wait-for .
COPY --from=builder /build/dist/mempool /var/www/mempool COPY --from=builder /build/dist/mempool /var/www/mempool
COPY --from=builder /build/nginx-docker.conf /etc/nginx/nginx.conf COPY --from=builder /build/nginx.conf /etc/nginx/
COPY --from=builder /build/nginx-mempool-docker.conf /etc/nginx/conf.d/nginx-mempool.conf COPY --from=builder /build/nginx-mempool.conf /etc/nginx/conf.d/
RUN chmod +x /patch/entrypoint.sh RUN chmod +x /patch/entrypoint.sh
RUN chmod +x /patch/wait-for RUN chmod +x /patch/wait-for

View File

@ -1,6 +1,8 @@
#!/bin/sh #!/bin/sh
__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__=${BACKEND_MAINNET_HTTP_HOST:=127.0.0.1} __MEMPOOL_BACKEND_MAINNET_HTTP_HOST__=${BACKEND_MAINNET_HTTP_HOST:=127.0.0.1}
__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__=${BACKEND_MAINNET_HTTP_PORT:=8999}
sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__/${__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__}/g" /etc/nginx/conf.d/nginx-mempool.conf sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__/${__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__}/g" /etc/nginx/conf.d/nginx-mempool.conf
sed -i "s/__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/${__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__}/g" /etc/nginx/conf.d/nginx-mempool.conf
exec "$@" exec "$@"

View File

@ -41,21 +41,21 @@
proxy_pass https://mempool.space; proxy_pass https://mempool.space;
} }
location /api/v1/ws { location /api/v1/ws {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:8999/; proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade"; proxy_set_header Connection "Upgrade";
} }
location /api/v1 { location /api/v1 {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:8999/api/v1; proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/api/v1;
} }
location /api/ { location /api/ {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:8999/api/v1/; proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/api/v1/;
} }
# mainnet API # mainnet API
location /ws { location /ws {
proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:8999/; proxy_pass http://__MEMPOOL_BACKEND_MAINNET_HTTP_HOST__:__MEMPOOL_BACKEND_MAINNET_HTTP_PORT__/;
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade"; proxy_set_header Connection "Upgrade";