From 9a0d89de57e60eee8ec30a4e5826db9d8c0771b5 Mon Sep 17 00:00:00 2001 From: Gonzalo Javier Aune Date: Fri, 15 May 2020 12:54:29 +0100 Subject: [PATCH] Moved docker related files to new folder and introduction of ENTRYPOINT script --- Dockerfile | 13 +++++++------ docker/entrypoint.sh | 6 ++++++ lnd.conf.sample => docker/lnd.conf.sample | 2 +- lnd_supervisor.conf => docker/lnd_supervisor.conf | 2 +- .../relay_supervisor.conf | 2 +- supervisord.conf => docker/supervisord.conf | 0 unique-peer.txt => docker/unique-peer.txt | 0 7 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 docker/entrypoint.sh rename lnd.conf.sample => docker/lnd.conf.sample (82%) rename lnd_supervisor.conf => docker/lnd_supervisor.conf (59%) rename relay_supervisor.conf => docker/relay_supervisor.conf (52%) rename supervisord.conf => docker/supervisord.conf (100%) rename unique-peer.txt => docker/unique-peer.txt (100%) diff --git a/Dockerfile b/Dockerfile index 39aef8d..68ee11c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -60,9 +60,9 @@ RUN npm cache clean --force VOLUME /relay/.lnd -COPY ./lnd.conf.sample /relay/.lnd/lnd.conf +COPY ./docker/lnd.conf.sample /relay/.lnd/lnd.conf -RUN shuf -n 6 ./unique-peer.txt >> /relay/.lnd/lnd.conf +RUN shuf -n 6 ./docker/unique-peer.txt >> /relay/.lnd/lnd.conf RUN git clone https://github.com/stakwork/sphinx-keysend-test/ /sphinx-keysend/ WORKDIR /sphinx-keysend/ @@ -72,7 +72,8 @@ RUN npm install WORKDIR /relay/ RUN mkdir -p /var/log/supervisor -COPY ./supervisord.conf /etc/supervisord.conf -COPY ./lnd_supervisor.conf /etc/supervisor.d/lnd_supervisor.ini -COPY ./relay_supervisor.conf /etc/supervisor.d/relay_supervisor.ini -CMD ["/usr/bin/supervisord"] +COPY ./docker/supervisord.conf /etc/supervisord.conf +COPY ./docker/lnd_supervisor.conf /etc/supervisor.d/lnd_supervisor.ini +COPY ./docker/relay_supervisor.conf /etc/supervisor.d/relay_supervisor.ini + +ENTRYPOINT [ "./docker/entrypoint.sh" ] diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh new file mode 100644 index 0000000..a99cf82 --- /dev/null +++ b/docker/entrypoint.sh @@ -0,0 +1,6 @@ +# export NODE_DOMAIN=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) +export NODE_DOMAIN=lvh.me +export NODE_ALIAS=$HOSTNAME +export NODE_IP=$NODE_SCHEME://$NODE_DOMAIN + +/usr/bin/supervisord \ No newline at end of file diff --git a/lnd.conf.sample b/docker/lnd.conf.sample similarity index 82% rename from lnd.conf.sample rename to docker/lnd.conf.sample index 7f96480..1c0529b 100644 --- a/lnd.conf.sample +++ b/docker/lnd.conf.sample @@ -8,6 +8,6 @@ rpclisten=0.0.0.0:10009 ignore-historical-gossip-filters=true nobootstrap=true -numgraphsyncpeers=1 +numgraphsyncpeers=7 routing.assumechanvalid=1 autopilot.active=false \ No newline at end of file diff --git a/lnd_supervisor.conf b/docker/lnd_supervisor.conf similarity index 59% rename from lnd_supervisor.conf rename to docker/lnd_supervisor.conf index e6a0ef4..260b496 100644 --- a/lnd_supervisor.conf +++ b/docker/lnd_supervisor.conf @@ -1,6 +1,6 @@ [program:lnd] user=root -command=sh -c 'lnd --lnddir=/relay/.lnd/ --alias=$HOSTNAME --tlsextradomain=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) --externalip=$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN)' +command=sh -c 'lnd --lnddir=/relay/.lnd/ --alias=$HOSTNAME --tlsextradomain=$NODE_DOMAIN --externalip=$NODE_DOMAIN' startretries=999999999999999999999999999 autostart=true autorestart=true diff --git a/relay_supervisor.conf b/docker/relay_supervisor.conf similarity index 52% rename from relay_supervisor.conf rename to docker/relay_supervisor.conf index c765433..2a17b11 100644 --- a/relay_supervisor.conf +++ b/docker/relay_supervisor.conf @@ -1,6 +1,6 @@ [program:relay] user=root -command=sh -c 'export NODE_ALIAS=$HOSTNAME && export NODE_IP=$NODE_SCHEME://$(curl $ECS_CONTAINER_METADATA_URI | echo $(jq -r .DockerName).$NODE_DOMAIN) && npm run start-ecs --prefix /relay/' +command=sh -c 'npm run start-ecs --prefix /relay/' startretries=999999999999999999999999999 autostart=true autorestart=true diff --git a/supervisord.conf b/docker/supervisord.conf similarity index 100% rename from supervisord.conf rename to docker/supervisord.conf diff --git a/unique-peer.txt b/docker/unique-peer.txt similarity index 100% rename from unique-peer.txt rename to docker/unique-peer.txt