Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initial work on logging files #264

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ terraform/.terraform
terraform/.terraform/environment
terraform/*.tfstate.backup
terraform/*.tfstate
*~
2 changes: 1 addition & 1 deletion Dockerfile.deps
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 2 additions & 0 deletions contrib/runits/bitcoin_for_liquid-log-config.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
u127.0.0.1:23394
p1-
2 changes: 2 additions & 0 deletions contrib/runits/bitcoin_for_liquid-log.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec svlogd /data/logs/bitcoin_for_liquid
2 changes: 2 additions & 0 deletions contrib/runits/electrs-log-config.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
u127.0.0.1:23394
p2-
2 changes: 2 additions & 0 deletions contrib/runits/electrs-log.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec svlogd /data/logs/electrs
2 changes: 2 additions & 0 deletions contrib/runits/nginx-log-config.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
u127.0.0.1:23394
p3-
2 changes: 2 additions & 0 deletions contrib/runits/nginx-log.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec svlogd /data/logs/nginx
2 changes: 2 additions & 0 deletions contrib/runits/nodedaemon-log-config.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
u127.0.0.1:23394
p4-
2 changes: 2 additions & 0 deletions contrib/runits/nodedaemon-log.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec svlogd /data/logs/nodedaemon
2 changes: 2 additions & 0 deletions contrib/runits/prerenderer-log-config.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
u127.0.0.1:23394
p5-
2 changes: 2 additions & 0 deletions contrib/runits/prerenderer-log.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec svlogd /data/logs/prerenderer
3 changes: 3 additions & 0 deletions contrib/runits/socat.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh -e

exec socat UDP-RECV:23394 -
2 changes: 2 additions & 0 deletions contrib/runits/tor-log-config.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
u127.0.0.1:23394
p6-
2 changes: 2 additions & 0 deletions contrib/runits/tor-log.runit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
exec svlogd /data/logs/tor
16 changes: 16 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"'
Expand Down Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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