Skip to content

Commit

Permalink
docker via Vagrant and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
justb4 committed Apr 22, 2016
1 parent f77e1d9 commit fcd0506
Show file tree
Hide file tree
Showing 7 changed files with 399 additions and 32 deletions.
2 changes: 1 addition & 1 deletion docker/apache2/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ MAINTAINER just@justobjects.nl
RUN export DEBIAN_FRONTEND=noninteractive TERM=linux && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections && \
apt-get update && \
apt-get upgrade
apt-get -y upgrade

RUN apt-get install -y openssh-server apache2 supervisor

Expand Down
2 changes: 1 addition & 1 deletion docker/apache2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ docker build -t geonovum/apache2 .

## Running

docker run -p 2222:22 -p 8081:80 -t -i geonovum/apache2
docker run -p 2222:22 -p 80:80 -t -i geonovum/apache2

This runs the image and exposes ports 2222 and 8081 mappoing these to the standard
ports 22 and 80 within the container.
Expand Down
153 changes: 153 additions & 0 deletions docker/boot2docker-fw.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
#!/bin/bash
# From: https://gist.github.com/deinspanjer/9215467
#
usage ()
{
cat <<UsageHERE
boot2docker-fwd -- Helper function to quickly manage port forwards between the boot2docker-vm and the host
Usage: boot2docker-fwd [ -n RULE_NAME ] [ -h HOST_PORT ] [ -p {tcp|udp} ] [ -i HOST_IP ] GUEST_PORT
or boot2docker-fwd -d RULE_NAME
or boot2docker-fwd -l
or boot2docker-fwd -A
or boot2docker-fwd -D
Options:
-n Use RULE_NAME as the name for the rule -- Defaults to "tcp<GUEST_PORT>" or "udp<GUEST_PORT>"
-h Forward HOST_PORT to the guest -- Defaults to the same number as GUEST_PORT
-p Forward tcp or udp traffic to GUEST_PORT -- Defaults to "tcp"
-i Bind the port forward to HOST_IP -- Defaults to the local only loopback, "127.0.0.1"
-d Delete the rule named RULE_NAME from the boot2docker-vm port forwards.
-l List the current port forwards defined for boot2docker-vm
-A Create forward rules for all the ports that docker uses by default with the -P option (49000-49900)
-D Delete all custom rules (i.e. everything except the "docker" and "ssh" rules)
GUEST_PORT The listening port inside boot2docker that will receive connections forwarded by the host
Examples:
boot2docker-fwd 8000
> Rule tcp8000: tcp port 8000 on host IP 127.0.0.1 forwarded to guest port 8000
boot2docker-fwd -n fubar -h 8888 8000
> Rule fubar: tcp port 8888 on host IP 127.0.0.1 forwarded to guest port 8000
boot2docker-fwd -d fubar
> Rule fubar deleted
Notes:
Please don't delete the built in "docker" and "ssh" rules. Things will break.
UsageHERE
}

list_rules_matching ()
{
# VBoxManage showvminfo boot2docker-vm | grep "NIC [0-9]* Rule([0-9]*): *name = $1"
VBoxManage showvminfo default | grep "NIC [0-9]* Rule([0-9]*): *name = $1"
}

if [ $# -eq 0 ]
then
usage
exit 1
fi

HOST_IP=127.0.0.1
PROTOCOL=tcp

while getopts "n:h:p:i:d:lAD" opt
do
case $opt in
n)
RULE_NAME="$OPTARG"
;;
h)
if [ "$OPTARG" -eq "$OPTARG" ] 2>/dev/null
then
HOST_PORT=$OPTARG
else
usage
exit 1
fi
;;
p)
if [ "$OPTARG" = "tcp" -o "$OPTARG" = "udp" ]
then
PROTOCOL=$OPTARG
else
usage
exit 1
fi
;;
i)
HOST_IP="$OPTARG"
;;
d)
# Check for a numeric name, prefix the tcp default if so
if [ "$OPTARG" -eq "$OPTARG" ] 2>/dev/null
then
RULE_NAME="tcp$OPTARG"
else
RULE_NAME="$OPTARG"
fi
list_rules_matching $RULE_NAME
if [ $? -eq 0 ]
then
# VBoxManage controlvm boot2docker-vm natpf1 delete "$RULE_NAME"
VBoxManage controlvm default natpf1 delete "$RULE_NAME"
if [ $? -eq 0 ]
then
echo "Rule deleted."
else
echo "Rule not deleted!"
fi
else
echo "Rule $RULE_NAME not found."
fi
exit $?
;;
l)
list_rules_matching
exit 0
;;
A)
echo "Creating 1802 port forwarding rules. Please wait..."
for i in {49000..49900}; do
VBoxManage controlvm boot2docker-vm natpf1 "tcp-port$i,tcp,,$i,,$i"
VBoxManage controlvm boot2docker-vm natpf1 "udp-port$i,udp,,$i,,$i"
done
exit 0
;;
D)
NUM_RULES=$(VBoxManage showvminfo boot2docker-vm | grep 'NIC [0-9]* Rule([0-9]*): *name = ' | grep -o 'name = [^,]*' | grep -cv ' docker\| ssh')
echo "Deleting $NUM_RULES port forwarding rules. Please wait..."
for rule in $(VBoxManage showvminfo boot2docker-vm | grep 'NIC [0-9]* Rule([0-9]*): *name = ' | grep -o 'name = [^,]*' | grep -v ' docker\| ssh' | cut -d ' ' -f 3 )
do
VBoxManage controlvm boot2docker-vm natpf1 delete "$rule"
done
exit 0
;;
esac
done

if [ "$1" -eq "$1" ] 2>/dev/null
then
GUEST_PORT=$1
else
usage
exit 1
fi

if [ -z "$RULE_NAME" ]
then
RULE_NAME="${PROTOCOL}${GUEST_PORT}"
fi


# VBoxManage controlvm boot2docker-vm natpf1 "$RULE_NAME,$PROTOCOL,$HOST_IP,$HOST_PORT,,$GUEST_PORT"
VBoxManage controlvm default natpf1 "$RULE_NAME,$PROTOCOL,$HOST_IP,$HOST_PORT,,$GUEST_PORT"
if [ $? -eq 0 ]
then
list_rules_matching $RULE_NAME
echo "Rule created."
else
echo "Error creating rule!"
fi
exit $?
44 changes: 44 additions & 0 deletions docker/postgis/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
FROM ubuntu:14.04
# FROM python:2.7

MAINTAINER just@justobjects.nl

# Use local cached debs from host (saves your bandwidth!)
# Change ip below to that of your apt-cacher-ng host
# Or comment this line out if you do not with to use caching
# ADD 71-apt-cacher-ng /etc/apt/apt.conf.d/71-apt-cacher-ng
RUN export DEBIAN_FRONTEND=noninteractive TERM=linux && \
echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

RUN apt-get -y update
RUN apt-get install -y software-properties-common
RUN apt-add-repository ppa:ubuntugis/ubuntugis-unstable
RUN apt-get -y update

#-------------Application Specific Stuff ----------------------------------------------------

# python-imaging \
# python-yaml \
# libjpeg-dev \
# zlib1g-dev \
# libfreetype6-dev \
# python-virtualenv

RUN apt-get install -y \
git \
libproj0 \
libgeos-dev \
python-lxml \
python-gdal \
libgdal-dev \
build-essential \
python-dev \
python-setuptools

# ADD start.sh /start.sh
# RUN chmod 0755 /start.sh
RUN git clone https://github.com/justb4/stetl /opt/stetl

RUN cd /opt/stetl; python setup.py install

ENTRYPOINT ["/usr/local/bin/stetl"]
2 changes: 2 additions & 0 deletions docker/stetl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ Note that full paths are required.

cd test/1_copystd
docker run -v `pwd`:`pwd` -w `pwd` -t -i geonovum/stetl -c etl.cfg

Many Stetl configs require a connection to PostGIS.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit fcd0506

Please sign in to comment.