Skip to content

Commit

Permalink
switch to alpine add swap
Browse files Browse the repository at this point in the history
  • Loading branch information
ab77 committed Jan 12, 2018
1 parent a1112c6 commit c2a1c5c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 25 deletions.
12 changes: 11 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ log_action_begin_msg "disabling ufw"
if which ufw > /dev/null; then ufw disable &>> ${CWD}/netflix-proxy.log; fi
log_action_end_msg $?

if [[ $(cat /proc/swaps | wc -l) -le 1 ]]; then
log_action_begin_msg "setting up swapfile"
fallocate -l 2G /swapfile && \
chmod 600 /swapfile && \
mkswap /swapfile && \
swapon /swapfile && \
printf "/swapfile none swap sw 0 0\n" >> /etc/fstab
log_action_end_msg $?
fi

# obtain the interface with the default gateway
IFACE=$(get_iface 4)

Expand Down Expand Up @@ -292,7 +302,7 @@ sudo $(which pip) install -r ${CWD}/auth/requirements.txt &>> ${CWD}/netflix-pro
&& sudo $(which sqlite3) ${CWD}/auth/db/auth.db "UPDATE users SET password = '${HASH}' WHERE ID = 1;" &>> ${CWD}/netflix-proxy.log
log_action_end_msg $?

log_action_begin_msg "configuring reverse-proxy"
log_action_begin_msg "configuring admin frontend"
sudo cp ${CWD}/Caddyfile.template ${CWD}/Caddyfile &>> ${CWD}/netflix-proxy.log\
&& printf "proxy / localhost:${SDNS_ADMIN_PORT} {\n except /static\n header_upstream Host {host}\n header_upstream X-Forwarded-For {remote}\n header_upstream X-Real-IP {remote}\n header_upstream X-Forwarded-Proto {scheme}\n}\n"\
| sudo tee -a ${CWD}/Caddyfile &>> ${CWD}/netflix-proxy.log
Expand Down
22 changes: 7 additions & 15 deletions docker-sniproxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
FROM phusion/baseimage
FROM alpine:latest

MAINTAINER anton@belodedenko.me

RUN apt-get update\
&& apt-get upgrade -y -o Dpkg::Options::="--force-confold"

RUN apt-get -y install --no-install-recommends\
build-essential vim dnsutils curl git iptables\
autotools-dev cdbs debhelper dh-autoreconf dpkg-dev gettext\
libev-dev libpcre3-dev libudns-dev pkg-config fakeroot\
inetutils-traceroute net-tools iputils-ping libssl-dev
RUN apk add --no-cache\
sniproxy curl vim wget bash iputils bind-tools\
iproute2 util-linux net-tools tcpdump mtr iftop\
iperf iptables psmisc socat jq lsof ca-certificates\
findutils sipcalc grep openntpd ip6tables openssl\
procps gawk coreutils libev udns libressl

WORKDIR /root

RUN git clone https://github.com/dlundquist/sniproxy.git\
&& cd sniproxy\
&& ./autogen.sh\
&& dpkg-buildpackage\
&& dpkg -i ../sniproxy_*.deb

ADD functions ./

ADD run.sh ./
Expand Down
18 changes: 9 additions & 9 deletions scripts/globals
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
LC_ALL=C
DOCKER_BUILD=0
RESOLVER_PRI=8.8.8.8
RESOLVER_SEC=8.8.4.4
SCHEMA_VERSION=1
ATTEMPTS=3
TIMEOUT=5
SDNS_ADMIN_PORT=43867
NETFLIX_HOST=www.netflix.com
LC_ALL=${LC_ALL:-C}
DOCKER_BUILD=${DOCKER_BUILD:-0}
RESOLVER_PRI=${RESOLVER_PRI:-8.8.8.8}
RESOLVER_SEC=${RESOLVER_SEC:-8.8.4.4}
SCHEMA_VERSION=${SCHEMA_VERSION:-1}
ATTEMPTS=${ATTEMPT:-3}
TIMEOUT=${TIMEOUT:-5}
SDNS_ADMIN_PORT=${SDNS_ADMIN_PORT:-43867}
NETFLIX_HOST=${NETFLIX_HOST:-www.netflix.com}

0 comments on commit c2a1c5c

Please sign in to comment.