Skip to content

Commit

Permalink
feat: nginx support.
Browse files Browse the repository at this point in the history
  • Loading branch information
aieyes committed Nov 26, 2019
1 parent 18a8e7e commit c707677
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 15 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ubuntu:bionic-20190612 AS add-apt-repositories

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y gnupg \
&& DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y gnupg \
&& apt-key adv --fetch-keys http://www.webmin.com/jcameron-key.asc \
&& echo "deb http://download.webmin.com/download/repository sarge contrib" >> /etc/apt/sources.list

Expand All @@ -13,6 +13,7 @@ ENV BIND_USER=bind \
BIND_VERSION=9.11.3 \
PROFTP_VERSION=1.3.5e-1build1 \
PROFTP_USER=ftpuser \
NGINX_VERSION=1.14.0 \
WEBMIN_VERSION=1.9 \
DATA_DIR=/data

Expand All @@ -25,14 +26,15 @@ RUN rm -rf /etc/apt/apt.conf.d/docker-gzip-indexes \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y \
bind9=1:${BIND_VERSION}* bind9-host=1:${BIND_VERSION}* dnsutils \
proftpd-basic=${PROFTP_VERSION}* \
nginx=${NGINX_VERSION}* \
webmin=${WEBMIN_VERSION}* \
&& rm -rf /var/lib/apt/lists/*

COPY entrypoint.sh /sbin/entrypoint.sh

RUN chmod 755 /sbin/entrypoint.sh

EXPOSE 53/udp 53/tcp 10000/tcp 22/tcp 21/tcp
EXPOSE 53/udp 53/tcp 10000/tcp 22/tcp 21/tcp 80/tcp

ENTRYPOINT ["/sbin/entrypoint.sh"]

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
all: build

build:
@docker build --tag=omofresh/bindftp .
@docker build --tag=aieyes/locserver .
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9.12.0-20191122
9.13.0-20191126
7 changes: 4 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
version: '2'

services:
bindftp:
locserver:
restart: always
image: omofresh/bindftp:9.12.0-20191122
image: aieyes/locserver:9.13.0-20191126
ports:
- "53:53/udp"
- "53:53/tcp"
- "10000:10000/tcp"
- "22:22/tcp"
- "21:21/tcp"
- "80:80/tcp"
volumes:
- /srv/docker/bindftp:/data
- /srv/docker/locserver:/data
20 changes: 19 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ BIND_DATA_DIR=${DATA_DIR}/bind
WEBMIN_DATA_DIR=${DATA_DIR}/webmin
PROFTP_DATA_DIR=${DATA_DIR}/proftpd
FTPUSER_PASSWORD=${FTPUSER_PASSWORD:-ftpuser}
NGINX_DATA_DIR=${DATA_DIR}/nginx

# ProFTPD files
FTPD_BIN=/usr/sbin/proftpd
Expand Down Expand Up @@ -82,6 +83,19 @@ create_bind_data_dir() {
ln -sf ${BIND_DATA_DIR}/lib /var/lib/bind
}

create_nginx_data_dir() {
mkdir -p ${NGINX_DATA_DIR}
chmod -R 0755 ${NGINX_DATA_DIR}
chown -R root:root ${NGINX_DATA_DIR}

# populate the default webmin configuration if it does not exist
if [ ! -d ${NGINX_DATA_DIR}/etc ]; then
mv /etc/nginx ${NGINX_DATA_DIR}/etc
fi
rm -rf /etc/nginx
ln -sf ${NGINX_DATA_DIR}/etc /etc/nginx
}

create_webmin_data_dir() {
mkdir -p ${WEBMIN_DATA_DIR}
chmod -R 0755 ${WEBMIN_DATA_DIR}
Expand Down Expand Up @@ -121,6 +135,8 @@ create_bind_cache_dir
create_proftpd_user
create_proftpd_data_dir

create_nginx_data_dir

start_proftpd() {
if [ -f $PIDFILE ]; then
pid=`cat $PIDFILE`
Expand Down Expand Up @@ -163,9 +179,11 @@ if [[ -z ${1} ]]; then
/etc/init.d/webmin start
fi

echo "Starting proftpd..."
start_proftpd

echo "Starting nginx..."
/etc/init.d/nginx start

echo "Starting named..."
exec $(which named) -u ${BIND_USER} -g ${EXTRA_ARGS}

Expand Down
8 changes: 4 additions & 4 deletions kubernetes/pod.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
apiVersion: v1
kind: Pod
metadata:
name: bindftp
name: locserver
labels:
name: bindftp
name: locserver
spec:
containers:
- name: bindftp
image: omofresh/bindftp
- name: locserver
image: aieyes/locserver
env:
- name: WEBMIN_ENABLED
value: false
Expand Down
6 changes: 3 additions & 3 deletions kubernetes/service.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: bindftp
name: locserver
labels:
name: bindftp
name: locserver
spec:
type: LoadBalancer
ports:
- port: 53
targetPort: 53
protocol: UDP
selector:
name: bindftp
name: locserver

0 comments on commit c707677

Please sign in to comment.