Merge pull request #101 from lancachenet/Offline-dns-fix

Fixed offline startup
This commit is contained in:
James Kinsman 2020-02-23 14:05:42 +00:00 committed by GitHub
commit 71ad35816c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -21,6 +21,7 @@ RUN mkdir -m 755 -p /data/cachedomains ;\
apt-get update ;\ apt-get update ;\
apt-get install -y jq git ; apt-get install -y jq git ;
RUN git clone --depth=1 --no-single-branch https://github.com/uklans/cache-domains/ /data/cache-domains
VOLUME ["/data/logs", "/data/cache", "/data/cachedomains", "/var/www"] VOLUME ["/data/logs", "/data/cache", "/data/cachedomains", "/var/www"]

View file

@ -2,16 +2,25 @@
IFS=' ' IFS=' '
mkdir -p /data/cachedomains mkdir -p /data/cachedomains
cd /data/cachedomains echo "Bootstrapping Monolithic from ${CACHE_DOMAINS_REPO}"
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
pushd /data/cachedomains > /dev/null
if [[ ! -d .git ]]; then if [[ ! -d .git ]]; then
git clone ${CACHE_DOMAINS_REPO} . git clone ${CACHE_DOMAINS_REPO} .
fi fi
if [[ "${NOFETCH:-false}" != "true" ]]; then if [[ "${NOFETCH:-false}" != "true" ]]; then
git fetch origin # Disable error checking whilst we attempt to get latest
set +e
git remote set-url origin ${CACHE_DOMAINS_REPO}
git fetch origin || echo "Failed to update from remote, using local copy of cache_domains"
git reset --hard origin/${CACHE_DOMAINS_BRANCH} git reset --hard origin/${CACHE_DOMAINS_BRANCH}
# Reenable error checking
set -e
fi fi
popd > /dev/null
TEMP_PATH=$(mktemp -d) TEMP_PATH=$(mktemp -d)
OUTPUTFILE=${TEMP_PATH}/outfile.conf OUTPUTFILE=${TEMP_PATH}/outfile.conf
echo "map \"\$http_user_agent£££\$http_host\" \$cacheidentifier {" >> $OUTPUTFILE echo "map \"\$http_user_agent£££\$http_host\" \$cacheidentifier {" >> $OUTPUTFILE