-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
|
||
#run the container with port 9000 exposed and mapped to host, in order to be able to accept incomming requestes from nginx | ||
docker run -it --rm -p 9000:9000 nrobert/idnow-app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
run.sh | ||
build.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,12 @@ | ||
FROM ubuntu:14.04 | ||
|
||
RUN apt-get install -q -y nginx | ||
|
||
ADD nginx-site /etc/nginx/sites-available/default | ||
ADD start-nginx.sh /root/ | ||
|
||
# forward request and error logs to docker log collector | ||
RUN ln -sf /dev/stdout /var/log/nginx/access.log | ||
RUN ln -sf /dev/stderr /var/log/nginx/error.log | ||
|
||
ENTRYPOINT ["/root/start-nginx.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
server { | ||
|
||
listen 80 default_server; | ||
server_name _; | ||
location / { | ||
proxy_pass http://192.168.5.171:9000; | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash -ex | ||
|
||
usage="Usage: $0 <valid IP address of the listening app>" | ||
|
||
#check if there is an argument | ||
if [ $# -ne 1 ] ; then | ||
echo $usage | ||
exit 1 | ||
fi | ||
#check if the arg is a valid IP address | ||
oIFS=$IFS | ||
IFS="." | ||
arr=($1) | ||
IFS=$oIFS | ||
for i in "${!arr[@]}" | ||
do | ||
if [ $i -gt 3 ] || [ ${arr[$i]} -gt 255 ] ; then | ||
echo $usage | ||
exit 1 | ||
fi | ||
|
||
done | ||
|
||
#run the container with port 80 exposed and mapped to the host so it's accesible | ||
docker run -it --rm -p 80:80 docker-example-nginx-proxy $1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash -ex | ||
|
||
#pass on the listening ip of the app server to nginx | ||
perl -pli -e "/proxy_pass/ and s/\/[\d\.]*:/\/$1:/" etc/nginx/sites-available/default | ||
|
||
#run nginx in foreground | ||
nginx -g "daemon off;" |