Merge pull request #784 from SkynetLabs/use-dnsmasq-for-aliasing

use dnsmasq for aliasing siasky.net and all the subdomains
This commit is contained in:
Karol Wypchło 2021-05-25 16:38:27 +02:00 committed by GitHub
commit 33b99f1e33
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 6 deletions

View File

@ -1,5 +1,7 @@
FROM node:16.1.0-alpine FROM node:16.1.0-alpine
RUN apk update && apk add dnsmasq
WORKDIR /usr/app WORKDIR /usr/app
# schedule critical checks to run every 5 minutes (any failures will disable server) # schedule critical checks to run every 5 minutes (any failures will disable server)
@ -16,9 +18,15 @@ COPY cli cli
EXPOSE 3100 EXPOSE 3100
ENV NODE_ENV production ENV NODE_ENV production
# command consists of 3 parts: # 1. alias siasky.net with current server ip to ommit load balancer
# 1. starting crond # 2. prepend dnsmasq nameserver so it tries to resolve first
# 2. aliasing siasky.net and account.siasky.net with current server ip so health checks # 3. start dnsmasq in the background
# test portal end-to-end on prod domain (important for testing ssl certificates) # 4. start crond in the background
# 3. running api service # 5. start the health-check api service
CMD [ "sh", "-c", "crond ; echo $(node src/whatismyip.js) siasky.net account.siasky.net >> /etc/hosts ; node --max-http-header-size=64000 src/index.js" ] CMD [ "sh", "-c", \
"echo address=/siasky.net/$(node src/whatismyip.js) > /etc/dnsmasq.d/siasky.net.conf ; \
echo -e \"nameserver 127.0.0.1\n$(cat /etc/resolv.conf)\" > /etc/resolv.conf ; \
dnsmasq ; \
crond ; \
node --max-http-header-size=64000 src/index.js" \
]