From 617b43e1b1bacb962524d949f5321fe373a8e075 Mon Sep 17 00:00:00 2001 From: Riccardo Casatta Date: Tue, 4 Jun 2019 21:02:49 +0200 Subject: [PATCH] initial work on logging files --- .gitignore | 1 + Dockerfile.deps | 2 +- .../runits/bitcoin_for_liquid-log-config.runit | 2 ++ contrib/runits/bitcoin_for_liquid-log.runit | 2 ++ contrib/runits/electrs-log-config.runit | 2 ++ contrib/runits/electrs-log.runit | 2 ++ contrib/runits/nginx-log-config.runit | 2 ++ contrib/runits/nginx-log.runit | 2 ++ contrib/runits/nodedaemon-log-config.runit | 2 ++ contrib/runits/nodedaemon-log.runit | 2 ++ contrib/runits/prerenderer-log-config.runit | 2 ++ contrib/runits/prerenderer-log.runit | 2 ++ contrib/runits/socat.runit | 3 +++ contrib/runits/tor-log-config.runit | 2 ++ contrib/runits/tor-log.runit | 2 ++ run.sh | 16 ++++++++++++++++ 16 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 contrib/runits/bitcoin_for_liquid-log-config.runit create mode 100755 contrib/runits/bitcoin_for_liquid-log.runit create mode 100644 contrib/runits/electrs-log-config.runit create mode 100755 contrib/runits/electrs-log.runit create mode 100644 contrib/runits/nginx-log-config.runit create mode 100755 contrib/runits/nginx-log.runit create mode 100644 contrib/runits/nodedaemon-log-config.runit create mode 100755 contrib/runits/nodedaemon-log.runit create mode 100644 contrib/runits/prerenderer-log-config.runit create mode 100755 contrib/runits/prerenderer-log.runit create mode 100755 contrib/runits/socat.runit create mode 100644 contrib/runits/tor-log-config.runit create mode 100755 contrib/runits/tor-log.runit diff --git a/.gitignore b/.gitignore index 8183e4f1..34c02e69 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ terraform/.terraform terraform/.terraform/environment terraform/*.tfstate.backup terraform/*.tfstate +*~ diff --git a/Dockerfile.deps b/Dockerfile.deps index d1a310c4..ed685f6d 100644 --- a/Dockerfile.deps +++ b/Dockerfile.deps @@ -5,7 +5,7 @@ SHELL ["/bin/bash", "-c"] RUN mkdir -p /srv/explorer \ && apt-get -yqq update \ && apt-get -yqq upgrade \ - && apt-get -yqq install clang cmake nginx supervisor curl git tor + && apt-get -yqq install clang cmake nginx supervisor curl git tor socat RUN git clone --quiet --depth 1 --single-branch --branch v0.33.11 https://github.com/creationix/nvm.git /root/.nvm \ && rm -rf /root/.nvm/.git \ diff --git a/contrib/runits/bitcoin_for_liquid-log-config.runit b/contrib/runits/bitcoin_for_liquid-log-config.runit new file mode 100644 index 00000000..23d9238b --- /dev/null +++ b/contrib/runits/bitcoin_for_liquid-log-config.runit @@ -0,0 +1,2 @@ +u127.0.0.1:23394 +p1- diff --git a/contrib/runits/bitcoin_for_liquid-log.runit b/contrib/runits/bitcoin_for_liquid-log.runit new file mode 100755 index 00000000..31734193 --- /dev/null +++ b/contrib/runits/bitcoin_for_liquid-log.runit @@ -0,0 +1,2 @@ +#!/bin/sh +exec svlogd /data/logs/bitcoin_for_liquid diff --git a/contrib/runits/electrs-log-config.runit b/contrib/runits/electrs-log-config.runit new file mode 100644 index 00000000..493c1013 --- /dev/null +++ b/contrib/runits/electrs-log-config.runit @@ -0,0 +1,2 @@ +u127.0.0.1:23394 +p2- diff --git a/contrib/runits/electrs-log.runit b/contrib/runits/electrs-log.runit new file mode 100755 index 00000000..0f49aecc --- /dev/null +++ b/contrib/runits/electrs-log.runit @@ -0,0 +1,2 @@ +#!/bin/sh +exec svlogd /data/logs/electrs diff --git a/contrib/runits/nginx-log-config.runit b/contrib/runits/nginx-log-config.runit new file mode 100644 index 00000000..0084d696 --- /dev/null +++ b/contrib/runits/nginx-log-config.runit @@ -0,0 +1,2 @@ +u127.0.0.1:23394 +p3- diff --git a/contrib/runits/nginx-log.runit b/contrib/runits/nginx-log.runit new file mode 100755 index 00000000..5c9f1d36 --- /dev/null +++ b/contrib/runits/nginx-log.runit @@ -0,0 +1,2 @@ +#!/bin/sh +exec svlogd /data/logs/nginx diff --git a/contrib/runits/nodedaemon-log-config.runit b/contrib/runits/nodedaemon-log-config.runit new file mode 100644 index 00000000..7eab593f --- /dev/null +++ b/contrib/runits/nodedaemon-log-config.runit @@ -0,0 +1,2 @@ +u127.0.0.1:23394 +p4- diff --git a/contrib/runits/nodedaemon-log.runit b/contrib/runits/nodedaemon-log.runit new file mode 100755 index 00000000..b870d7ab --- /dev/null +++ b/contrib/runits/nodedaemon-log.runit @@ -0,0 +1,2 @@ +#!/bin/sh +exec svlogd /data/logs/nodedaemon diff --git a/contrib/runits/prerenderer-log-config.runit b/contrib/runits/prerenderer-log-config.runit new file mode 100644 index 00000000..5bf873b0 --- /dev/null +++ b/contrib/runits/prerenderer-log-config.runit @@ -0,0 +1,2 @@ +u127.0.0.1:23394 +p5- diff --git a/contrib/runits/prerenderer-log.runit b/contrib/runits/prerenderer-log.runit new file mode 100755 index 00000000..7427e583 --- /dev/null +++ b/contrib/runits/prerenderer-log.runit @@ -0,0 +1,2 @@ +#!/bin/sh +exec svlogd /data/logs/prerenderer diff --git a/contrib/runits/socat.runit b/contrib/runits/socat.runit new file mode 100755 index 00000000..242390fc --- /dev/null +++ b/contrib/runits/socat.runit @@ -0,0 +1,3 @@ +#!/bin/sh -e + +exec socat UDP-RECV:23394 - diff --git a/contrib/runits/tor-log-config.runit b/contrib/runits/tor-log-config.runit new file mode 100644 index 00000000..e7c1e72e --- /dev/null +++ b/contrib/runits/tor-log-config.runit @@ -0,0 +1,2 @@ +u127.0.0.1:23394 +p6- diff --git a/contrib/runits/tor-log.runit b/contrib/runits/tor-log.runit new file mode 100755 index 00000000..571129e8 --- /dev/null +++ b/contrib/runits/tor-log.runit @@ -0,0 +1,2 @@ +#!/bin/sh +exec svlogd /data/logs/tor diff --git a/run.sh b/run.sh index f8368d5f..af7e804e 100755 --- a/run.sh +++ b/run.sh @@ -22,7 +22,10 @@ ELECTRS_NETWORK=${NETWORK} mkdir -p /etc/service/tor +mkdir -p /data/logs/tor cp /srv/explorer/source/contrib/runits/tor.runit /etc/service/tor/run +cp /srv/explorer/source/contrib/runits/tor-log.runit /etc/service/tor/log/run +cp /srv/explorer/source/contrib/runits/tor-log-config.runit /data/logs/tor/config NGINX_NOSLASH_PATH="unused" NGINX_REWRITE_NOJS='return 301 " /nojs$uri"' @@ -72,9 +75,16 @@ function preprocess(){ if [ "$MODE" == "explorer" ]; then mkdir -p /etc/service/prerenderer /etc/service/nginx /etc/service/electrs + mkdir -p /data/logs/prerenderer /data/logs/nginx /data/logs/electrs preprocess /srv/explorer/source/contrib/runits/electrs.runit /etc/service/electrs/run + cp /srv/explorer/source/contrib/runits/electrs-log.runit /etc/service/electrs/log/run + cp /srv/explorer/source/contrib/runits/electrs-log-config.runit /data/logs/electrs/config cp /srv/explorer/source/contrib/runits/nginx.runit /etc/service/nginx/run + cp /srv/explorer/source/contrib/runits/nginx-log.runit /etc/service/nginx/log/run + cp /srv/explorer/source/contrib/runits/nginx-log-config.runit /data/logs/nginx/config preprocess /srv/explorer/source/contrib/runits/prerenderer.runit /etc/service/prerenderer/run + cp /srv/explorer/source/contrib/runits/prerenderer-log.runit /etc/service/prerenderer/log/run + cp /srv/explorer/source/contrib/runits/prerenderer-log-config.runit /data/logs/prerenderer/config chmod +x /etc/service/prerenderer/run /etc/service/electrs/run elif [ "$MODE" != "private-bridge" ] && [ "$MODE" != "public-bridge" ]; then echo "Mode can only be private-bridge, public-bridge or explorer" @@ -85,8 +95,11 @@ preprocess /srv/explorer/source/contrib/${DAEMON}-${NETWORK}-${MODE}.conf.in /da if [ "${DAEMON}" == "liquid" ]; then mkdir -p /etc/service/bitcoin + mkdir -p /data/logs/bitcoin preprocess /srv/explorer/source/contrib/bitcoin-mainnet-pruned-for-liquid.conf.in /data/.bitcoin.conf cp /srv/explorer/source/contrib/runits/bitcoin_for_liquid.runit /etc/service/bitcoin/run + cp /srv/explorer/source/contrib/runits/bitcoin_for_liquid-log.runit /etc/service/bitcoin/log/run + cp /srv/explorer/source/contrib/runits/bitcoin_for_liquid-log-config.runit /data/logs/bitcoin/config fi if [ -f /data/public_nodes ]; then @@ -126,7 +139,10 @@ if [ ! -d /data/logs ]; then fi mkdir -p /etc/service/${DAEMON} +mkdir -p /data/logs/nodedaemon preprocess /srv/explorer/source/contrib/runits/nodedaemon.runit /etc/service/${DAEMON}/run +cp /srv/explorer/source/contrib/runits/nodedaemon-log.runit /etc/service/${DAEMON}/log/run +cp /srv/explorer/source/contrib/runits/nodedaemon-log-config.runit /data/logs/nodedaemon/config chmod +x /etc/service/${DAEMON}/run exec /srv/explorer/source/contrib/runit_boot.sh