mirror of
https://github.com/Xahau/Validation-Ledger-Tx-Store-to-xPOP.git
synced 2025-12-06 17:27:57 +00:00
Add Docker Compose support
This commit is contained in:
22
README.md
22
README.md
@@ -8,6 +8,28 @@ Based on the work by @RichardAH: https://github.com/RichardAH/xpop-generator
|
||||
|
||||
## Run (Docker)
|
||||
|
||||
#### Docker Compose
|
||||
|
||||
To run this service & nginx in two separate preconfigured containers, simply run:
|
||||
|
||||
```bash
|
||||
docker-compose up
|
||||
```
|
||||
|
||||
Unless specified otherwise (with environment variables) a connection to XRPL Testnet will be made.
|
||||
|
||||
You will get a container running at port 3000 (unless configured differently), with the following routes:
|
||||
|
||||
- `http://{host}:3000` » Web Browser: homepage with some stats and links
|
||||
- `http://{host}:3000` » WebSocket: live events on xPOP generated
|
||||
- `http://{host}:3000/blob` » WebSocket: live events on xPOP generated + HEX XPOP
|
||||
- `http://{host}:3000/blob/{account}` » WebSocket: live events on xPOP generated + HEX XPOP for specific account
|
||||
- `http://{host}:3000/xpop/{hash}` » HEX encoded xPOP
|
||||
- `http://{host}:3000/{networkid}/{...}` » Web Browser Dirlisting & xPOP source files
|
||||
- `http://{host}:3000/{networkid}/{...}` » Called with `Content-Type: application/json`? JSON dirlisting
|
||||
|
||||
|
||||
#### Single Docker Container
|
||||
Run a container with HTTP exposed, for XRPL testnet, auto-remove container after running & interactive (allow for CTRL+C to kill).
|
||||
|
||||
Docker Hub: https://hub.docker.com/r/wietsewind/xpop
|
||||
|
||||
96
conf/nginx.conf
Normal file
96
conf/nginx.conf
Normal file
@@ -0,0 +1,96 @@
|
||||
user nginx;
|
||||
worker_processes auto;
|
||||
|
||||
error_log /dev/stderr notice;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /dev/stdout main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
# gzip on;
|
||||
|
||||
map $http_connection $connection_upgrade {
|
||||
"~*Upgrade" $http_connection;
|
||||
default keep-alive;
|
||||
}
|
||||
|
||||
map $http_content_type $is_json_request {
|
||||
"application/json" 1;
|
||||
default 0;
|
||||
}
|
||||
|
||||
upstream backend {
|
||||
server xpop:3000;
|
||||
keepalive 32;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 3000;
|
||||
server_name _;
|
||||
|
||||
autoindex_format html;
|
||||
|
||||
location /xpop {
|
||||
root /usr/share/nginx/html;
|
||||
autoindex off;
|
||||
}
|
||||
|
||||
if ($http_content_type ~* json) {
|
||||
set $json_request 1;
|
||||
}
|
||||
|
||||
location ~ ^/json(/.*)?$ {
|
||||
internal;
|
||||
alias /usr/share/nginx/html$1; # Point to the same root as the previous location
|
||||
autoindex on;
|
||||
autoindex_format json;
|
||||
}
|
||||
|
||||
location ~* ^/[0-9]+ {
|
||||
root /usr/share/nginx/html;
|
||||
autoindex on;
|
||||
|
||||
if ($is_json_request = 1) {
|
||||
rewrite ^ /json$request_uri? last;
|
||||
}
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_pass http://backend;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
proxy_set_header Connection $connection_upgrade;
|
||||
proxy_cache off;
|
||||
proxy_buffering off;
|
||||
# Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds
|
||||
proxy_read_timeout 100s;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
|
||||
# error_page 404 /404.html;
|
||||
# redirect server error pages to the static page /50x.html
|
||||
#
|
||||
# error_page 500 502 503 504 /50x.html;
|
||||
# location = /50x.html {
|
||||
# root /usr/share/nginx/html;
|
||||
# }
|
||||
|
||||
} # END: server {}
|
||||
}
|
||||
32
docker-compose.yml
Normal file
32
docker-compose.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
version: '3.3'
|
||||
services:
|
||||
nginx:
|
||||
container_name: xpopweb
|
||||
read_only: true
|
||||
volumes:
|
||||
- ./conf/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- nginxcache:/var/cache/nginx
|
||||
- nginxpid:/var/run
|
||||
- ./store/:/usr/share/nginx/html:ro
|
||||
ports:
|
||||
- ${PORT:-3000}:3000
|
||||
image: nginx:alpine
|
||||
xpop:
|
||||
container_name: xpop
|
||||
image: xpop:service
|
||||
build: .
|
||||
volumes:
|
||||
- ./store:/usr/src/app/store
|
||||
environment:
|
||||
- EVENT_SOCKET_PORT=3000
|
||||
- URL_PREFIX=${URL_PREFIX:-http://localhost:3000}
|
||||
- NETWORKID=${NETWORKID:-1}
|
||||
- UNLURL=${UNLURL:-https://vl.altnet.rippletest.net}
|
||||
- UNLKEY=${UNLKEY:-ED264807102805220DA0F312E71FC2C69E1552C9C5790F6C25E3729DEB573D5860}
|
||||
- NODES=${NODES:-wss://testnet.xrpl-labs.com,wss://s.altnet.rippletest.net:51233}
|
||||
- FIELDSREQUIRED=${FIELDSREQUIRED:-Fee,Account,OperationLimit}
|
||||
- NOVALIDATIONLOG=${NOVALIDATIONLOG}
|
||||
- NOELIGIBLEFULLTXLOG=${NOELIGIBLEFULLTXLOG}
|
||||
volumes:
|
||||
nginxcache:
|
||||
nginxpid:
|
||||
Reference in New Issue
Block a user