Bladeren bron

Merge pull request #21 from lil5/patch-docker-test

Create testing with docker & Fix apache conf
Dom Hastings 6 jaren geleden
bovenliggende
commit
409f945619
7 gewijzigde bestanden met toevoegingen van 123 en 36 verwijderingen
  1. 21 17
      examples/apache-directory-list-local/webdav.conf
  2. 21 19
      examples/apache-directory-list/webdav.conf
  3. 20 0
      test/Dockerfile
  4. 5 0
      test/build.sh
  5. 10 0
      test/clean.sh
  6. 23 0
      test/run-cdn.sh
  7. 23 0
      test/run-local.sh

+ 21 - 17
examples/apache-directory-list-local/webdav.conf

@@ -1,23 +1,27 @@
-ServerName webdav.server.com
-DocumentRoot /srv/webdav/root
+<VirtualHost *:80>
+    ServerName webdav.server.com
+    DocumentRoot /var/www/html/
 
 
-# This prevents indexes from being parsed (unless they're called the below...)
-AccessFileName .file-that-will-never-exist
-DirectoryIndex .file-that-will-never-exist
 
 
-# assuming webdav-js is checked out to /srv/webdav-js
-Alias /webdav-js /srv/web/webdav-js
+    # assuming webdav-js is checked out to /var/www/webdav-js
+    Alias /webdav-js /var/www/webdav-js
 
 
-<Location />
-    DAV on
+    <Location />
+        DirectoryIndex disabled
+        DAV on
+        AllowOverride None
 
 
-    Options +Indexes
-    HeaderName /webdav-js/examples/apache-directory-list-local/header.html
+        Options +Indexes -ExecCGI
+        HeaderName /webdav-js/examples/apache-directory-list-local/header.html
 
 
-    # the below only needed on a server configured with PHP
-    RemoveType .php
-    RemoveHandler .php
-    AddType text/plain .php
+        SetHandler None
+    </Location>
 
 
-    # Add simliar directives for other server-based lanauges
-</Location>
+    # Add security
+    <Directory /var/www/webdav-js>
+        Satisfy all
+        <LimitExcept GET>
+            Deny from all
+        </LimitExcept>
+    </Directory>
+</VirtualHost>

+ 21 - 19
examples/apache-directory-list/webdav.conf

@@ -1,25 +1,27 @@
-ServerName webdav.server.com
-DocumentRoot /srv/webdav/root
+<VirtualHost *:80>
+    ServerName webdav.server.com
+    DocumentRoot /var/www/html/
 
 
-# This prevents indexes from being parsed (unless they're called the below...)
-AccessFileName .file-that-will-never-exist
-DirectoryIndex .file-that-will-never-exist
 
 
-# assuming webdav-js is checked out to /srv/webdav-js
-Alias /header.html /srv/webdav-js/header.html
+    # assuming webdav-js is checked out to /var/www/webdav-js
+    Alias /webdav-js /var/www/webdav-js
 
 
-HeaderName /header.html
+    <Location />
+        DirectoryIndex disabled
+        DAV on
+        AllowOverride None
 
 
-<Location />
-    DAV on
+        Options +Indexes -ExecCGI
+        HeaderName /webdav-js/examples/apache-directory-list/header.html
 
 
-    Options +Indexes
-    HeaderName /header.html
+        SetHandler None
+    </Location>
 
 
-    # the below only needed on a server configured with PHP
-    RemoveType .php
-    RemoveHandler .php
-    AddType text/plain .php
-
-    # Add simliar directives for other server-based lanauges
-</Location>
+    # Add security
+    <Directory /var/www/webdav-js>
+        Satisfy all
+        <LimitExcept GET>
+            Deny from all
+        </LimitExcept>
+    </Directory>
+</VirtualHost>

+ 20 - 0
test/Dockerfile

@@ -0,0 +1,20 @@
+FROM debian:stretch
+
+RUN apt-get update -y && apt-get install -y apache2 php7.0
+
+RUN a2enmod \
+  proxy \
+  proxy_ajp \
+  proxy_http \
+  rewrite \
+  deflate \
+  headers \
+  proxy_balancer \
+  proxy_connect \
+  xml2enc \
+  proxy_html \
+  dav \
+  dav_fs \
+  ssl
+
+EXPOSE 80

+ 5 - 0
test/build.sh

@@ -0,0 +1,5 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+docker build -t webdav-js $DIR

+ 10 - 0
test/clean.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+
+if [ "$(docker ps -a | grep webdav-js-app)" ]; then
+	docker stop webdav-js-app
+	docker rm webdav-js-app
+fi
+
+if [ -z "$(docker images -q webdav-js 2> /dev/null)" ]; then
+	docker rmi webdav-js
+fi

+ 23 - 0
test/run-cdn.sh

@@ -0,0 +1,23 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+if [ "$(docker ps -a | grep webdav-js-app)" ]; then
+	docker stop webdav-js-app
+	docker rm webdav-js-app
+fi
+
+docker run -dit \
+--name webdav-js-app \
+-p 8080:80 \
+-v $DIR/../examples/apache-directory-list/webdav.conf:/etc/apache2/sites-enabled/webdav.conf:ro \
+-v $DIR/../:/var/www/webdav-js:ro \
+webdav-js sleep infinity
+
+docker exec -it webdav-js-app /bin/bash -c "\
+chown www-data -R /var/www/html 2> /dev/null; \
+rm /etc/apache2/sites-enabled/000-default.conf; \
+apachectl start || apachectl restart \
+"
+
+echo 'This can be tested on http://localhost:8080'

+ 23 - 0
test/run-local.sh

@@ -0,0 +1,23 @@
+#!/bin/bash
+
+DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+if [ "$(docker ps -a | grep webdav-js-app)" ]; then
+	docker stop webdav-js-app
+	docker rm webdav-js-app
+fi
+
+docker run -dit \
+--name webdav-js-app \
+-p 8080:80 \
+-v $DIR/../examples/apache-directory-list-local/webdav.conf:/etc/apache2/sites-enabled/webdav.conf:ro \
+-v $DIR/../:/var/www/webdav-js:ro \
+webdav-js sleep infinity
+
+docker exec -it webdav-js-app /bin/bash -c "\
+chown www-data -R /var/www/html 2> /dev/null; \
+rm /etc/apache2/sites-enabled/000-default.conf; \
+apachectl start || apachectl restart \
+"
+
+echo 'This can be tested on http://localhost:8080'