mirror of
https://github.com/mempool/mempool.git
synced 2025-01-17 18:52:34 +01:00
Adding production and deployment files.
This commit is contained in:
parent
3453e84889
commit
c8c1be594b
62
Dockerfile
Normal file
62
Dockerfile
Normal file
@ -0,0 +1,62 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN mkdir /mempool.space/
|
||||
COPY ./backend /mempool.space/backend/
|
||||
COPY ./frontend /mempool.space/frontend/
|
||||
COPY ./mariadb-structure.sql /mempool.space/mariadb-structure.sql
|
||||
#COPY ./nginx.conf /mempool.space/nginx.conf
|
||||
|
||||
RUN apk add mariadb mariadb-client jq git nginx npm rsync
|
||||
|
||||
RUN mysql_install_db --user=mysql --datadir=/var/lib/mysql/
|
||||
RUN /usr/bin/mysqld_safe --datadir='/var/lib/mysql/'& \
|
||||
sleep 60 && \
|
||||
mysql -e "create database mempool" && \
|
||||
mysql -e "grant all privileges on mempool.* to 'mempool'@'localhost' identified by 'mempool'" && \
|
||||
mysql mempool < /mempool.space/mariadb-structure.sql
|
||||
RUN sed -i "/^skip-networking/ c#skip-networking" /etc/my.cnf.d/mariadb-server.cnf
|
||||
|
||||
RUN export NG_CLI_ANALYTICS=ci && \
|
||||
npm install -g typescript && \
|
||||
cd /mempool.space/frontend && \
|
||||
npm install && \
|
||||
cd /mempool.space/backend && \
|
||||
npm install && \
|
||||
tsc
|
||||
|
||||
COPY ./nginx-nossl-docker.conf /etc/nginx/nginx.conf
|
||||
|
||||
ENV ENV dev
|
||||
ENV DB_HOST localhost
|
||||
ENV DB_PORT 3306
|
||||
ENV DB_USER mempool
|
||||
ENV DB_PASSWORD mempool
|
||||
ENV DB_DATABASE mempool
|
||||
ENV HTTP_PORT 80
|
||||
ENV API_ENDPOINT /api/v1/
|
||||
ENV CHAT_SSL_ENABLED false
|
||||
#ENV CHAT_SSL_PRIVKEY
|
||||
#ENV CHAT_SSL_CERT
|
||||
#ENV CHAT_SSL_CHAIN
|
||||
ENV MEMPOOL_REFRESH_RATE_MS 500
|
||||
ENV INITIAL_BLOCK_AMOUNT 8
|
||||
ENV DEFAULT_PROJECTED_BLOCKS_AMOUNT 3
|
||||
ENV KEEP_BLOCK_AMOUNT 24
|
||||
ENV BITCOIN_NODE_HOST bitcoinhost
|
||||
ENV BITCOIN_NODE_PORT 8332
|
||||
ENV BITCOIN_NODE_USER bitcoinuser
|
||||
ENV BITCOIN_NODE_PASS bitcoinpass
|
||||
ENV TX_PER_SECOND_SPAN_SECONDS 150
|
||||
|
||||
#RUN echo "mysqld_safe& sleep 20 && cd /mempool.space/backend && rm -f mempool-config.json && rm -f cache.json && touch cache.json && jq -n env > mempool-config.json && node dist/index.js" > /entrypoint.sh
|
||||
|
||||
RUN cd /mempool.space/frontend/ && \
|
||||
npm run build && \
|
||||
rsync -av --delete dist/mempool/ /var/www/html/
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
COPY ./entrypoint.sh /mempool.space/entrypoint.sh
|
||||
RUN chmod +x /mempool.space/entrypoint.sh
|
||||
WORKDIR /mempool.space
|
||||
CMD ["/mempool.space/entrypoint.sh"]
|
10
entrypoint.sh
Normal file
10
entrypoint.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
mysqld_safe&
|
||||
sleep 5
|
||||
nginx
|
||||
cd /mempool.space/backend
|
||||
rm -f mempool-config.json
|
||||
rm -f cache.json
|
||||
touch cache.json
|
||||
jq -n env > mempool-config.json
|
||||
node dist/index.js
|
73
mariadb-structure.sql
Normal file
73
mariadb-structure.sql
Normal file
@ -0,0 +1,73 @@
|
||||
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
||||
SET time_zone = "+00:00";
|
||||
|
||||
CREATE TABLE `statistics` (
|
||||
`id` int(11) NOT NULL,
|
||||
`added` datetime NOT NULL,
|
||||
`unconfirmed_transactions` int(11) UNSIGNED NOT NULL,
|
||||
`tx_per_second` float UNSIGNED NOT NULL,
|
||||
`vbytes_per_second` int(10) UNSIGNED NOT NULL,
|
||||
`mempool_byte_weight` int(10) UNSIGNED NOT NULL,
|
||||
`fee_data` longtext NOT NULL,
|
||||
`total_fee` double UNSIGNED NOT NULL,
|
||||
`vsize_1` int(11) NOT NULL,
|
||||
`vsize_2` int(11) NOT NULL,
|
||||
`vsize_3` int(11) NOT NULL,
|
||||
`vsize_4` int(11) NOT NULL,
|
||||
`vsize_5` int(11) NOT NULL,
|
||||
`vsize_6` int(11) NOT NULL,
|
||||
`vsize_8` int(11) NOT NULL,
|
||||
`vsize_10` int(11) NOT NULL,
|
||||
`vsize_12` int(11) NOT NULL,
|
||||
`vsize_15` int(11) NOT NULL,
|
||||
`vsize_20` int(11) NOT NULL,
|
||||
`vsize_30` int(11) NOT NULL,
|
||||
`vsize_40` int(11) NOT NULL,
|
||||
`vsize_50` int(11) NOT NULL,
|
||||
`vsize_60` int(11) NOT NULL,
|
||||
`vsize_70` int(11) NOT NULL,
|
||||
`vsize_80` int(11) NOT NULL,
|
||||
`vsize_90` int(11) NOT NULL,
|
||||
`vsize_100` int(11) NOT NULL,
|
||||
`vsize_125` int(11) NOT NULL,
|
||||
`vsize_150` int(11) NOT NULL,
|
||||
`vsize_175` int(11) NOT NULL,
|
||||
`vsize_200` int(11) NOT NULL,
|
||||
`vsize_250` int(11) NOT NULL,
|
||||
`vsize_300` int(11) NOT NULL,
|
||||
`vsize_350` int(11) NOT NULL,
|
||||
`vsize_400` int(11) NOT NULL,
|
||||
`vsize_500` int(11) NOT NULL,
|
||||
`vsize_600` int(11) NOT NULL,
|
||||
`vsize_700` int(11) NOT NULL,
|
||||
`vsize_800` int(11) NOT NULL,
|
||||
`vsize_900` int(11) NOT NULL,
|
||||
`vsize_1000` int(11) NOT NULL,
|
||||
`vsize_1200` int(11) NOT NULL,
|
||||
`vsize_1400` int(11) NOT NULL,
|
||||
`vsize_1600` int(11) NOT NULL,
|
||||
`vsize_1800` int(11) NOT NULL,
|
||||
`vsize_2000` int(11) NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE `transactions` (
|
||||
`blockheight` int(11) NOT NULL,
|
||||
`txid` varchar(65) NOT NULL,
|
||||
`fee` double NOT NULL,
|
||||
`feePerVsize` double NOT NULL
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
||||
ALTER TABLE `blocks`
|
||||
ADD PRIMARY KEY (`height`);
|
||||
|
||||
ALTER TABLE `statistics`
|
||||
ADD PRIMARY KEY (`id`);
|
||||
|
||||
ALTER TABLE `transactions`
|
||||
ADD PRIMARY KEY (`txid`),
|
||||
ADD KEY `blockheight` (`blockheight`);
|
||||
|
||||
|
||||
ALTER TABLE `statistics`
|
||||
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
|
60
nginx-nossl-docker.conf
Normal file
60
nginx-nossl-docker.conf
Normal file
@ -0,0 +1,60 @@
|
||||
user root;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 65;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
gzip on;
|
||||
gzip_comp_level 5;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied any;
|
||||
gzip_vary on;
|
||||
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # text/html is always compressed by gzip module
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name docker.lan;
|
||||
|
||||
root /var/www/html;
|
||||
|
||||
index index.html;
|
||||
server_name example.com; # managed by Certbot
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8999/api;
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass http://127.0.0.1:8999/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
}
|
||||
}
|
75
nginx.conf
Normal file
75
nginx.conf
Normal file
@ -0,0 +1,75 @@
|
||||
user www-data;
|
||||
worker_processes auto;
|
||||
pid /run/nginx.pid;
|
||||
include /etc/nginx/modules-enabled/*.conf;
|
||||
|
||||
events {
|
||||
worker_connections 768;
|
||||
# multi_accept on;
|
||||
}
|
||||
|
||||
http {
|
||||
sendfile on;
|
||||
tcp_nopush on;
|
||||
tcp_nodelay on;
|
||||
keepalive_timeout 300s;
|
||||
types_hash_max_size 2048;
|
||||
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
|
||||
ssl_prefer_server_ciphers on;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
gzip on;
|
||||
gzip_comp_level 5;
|
||||
gzip_min_length 256;
|
||||
gzip_proxied any;
|
||||
gzip_vary on;
|
||||
|
||||
gzip_types application/atom+xml application/javascript application/json application/ld+json application/manifest+json application/rss+xml application/vnd.geo+json application/vnd.ms-fontobject application/x-font-ttf application/x-web-app-manifest+json application/xhtml+xml application/xml font/opentype image/bmp image/svg+xml image/x-icon text/cache-manifest text/css text/plain text/vcard text/vnd.rim.location.xloc text/vtt text/x-component text/x-cross-domain-policy; # text/html is always compressed by gzip module
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
server_name example.com;
|
||||
|
||||
if ($host = example.com) {
|
||||
return 301 https://$host$request_uri;
|
||||
} # managed by Certbot
|
||||
|
||||
return 404; # managed by Certbot
|
||||
}
|
||||
|
||||
server {
|
||||
listen [::]:443 ssl http2; # managed by Certbot
|
||||
listen 443 ssl http2; # managed by Certbot
|
||||
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem; # managed by Certbot
|
||||
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem; # managed by Certbot
|
||||
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
|
||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
|
||||
|
||||
server_name example.com; # managed by Certbot
|
||||
|
||||
index index.html;
|
||||
root /var/www/html;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
|
||||
location /api {
|
||||
proxy_pass http://127.0.0.1:8999/api;
|
||||
}
|
||||
|
||||
location /ws {
|
||||
proxy_pass http://127.0.0.1:8999/;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection "Upgrade";
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user