Skip to content

Commit

Permalink
Merge pull request #224 from cleydyr/issue-222
Browse files Browse the repository at this point in the history
#222 remake the validation with a real server running
  • Loading branch information
cleydyr authored May 31, 2020
2 parents 7d6812a + b33d23c commit 9b2840e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
7 changes: 5 additions & 2 deletions nginx/conf.d/biblivre.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
upstream tomcat {
server app:8080;
}

proxy_cache_path /var/cache/nginx/ levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=off;

server {
Expand All @@ -23,9 +27,8 @@ server {
server_name biblivre;
listen 80;
location / {
set $foobar http://app:8080/Biblivre6/;
proxy_cache my_cache;
proxy_pass $foobar;
proxy_pass http://tomcat/Biblivre6/;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
Expand Down
21 changes: 11 additions & 10 deletions scripts/check_nginx.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
#!/bin/bash
rootPath=$PWD/../nginx/conf.d/biblivre.conf
nginxVersion=latest

result=`docker run --rm -t -a stdout --name tmp-nginx -v $PWD/nginx/conf.d/:/etc/nginx/conf.d:ro nginx nginx -c /etc/nginx/nginx.conf -t`
docker network create tmp >> /dev/null

# Look for the word successful and count the lines that have it
# This validation could be improved if needed
successful=$(echo $result | grep successful | wc -l)
docker run --network tmp -t --rm -d --name app tomcat:9-jdk8 >> /dev/null
docker run --network tmp --rm -t -a stdout --name tmp-nginx -v $PWD/nginx/conf.d/:/etc/nginx/conf.d:ro nginx nginx -c /etc/nginx/nginx.conf -t

if [ $successful = 0 ]; then
exitCode=$?

if [ $exitCode -ne 0 ]; then
echo FAILED
echo "$result"
exit 1
else
echo SUCCESS
exit 0
fi

docker stop app >> /dev/null
docker network rm tmp >> /dev/null

exit $exitCode

0 comments on commit 9b2840e

Please sign in to comment.