Przeglądaj źródła

Create testing with docker & Fix apache conf

* The apache conf files were not properly written.
* Testing with docker for simler testing (use ./test/clean.sh to remove 
all images and containers from your pc)
Lucian I. Last 6 lat temu
rodzic
commit
b8693d613e

+ 12 - 19
examples/apache-directory-list-local/webdav.conf

@@ -1,23 +1,16 @@
-ServerName webdav.server.com
-DocumentRoot /srv/webdav/root
+<VirtualHost *:80>
+    ServerName localhost
+    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
 
-    Options +Indexes
-    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
-
-    # Add simliar directives for other server-based lanauges
-</Location>
+        Options +Indexes
+        HeaderName /webdav-js/examples/apache-directory-list-local/header.html
+    </Location>
+</VirtualHost>

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

@@ -1,25 +1,16 @@
-ServerName webdav.server.com
-DocumentRoot /srv/webdav/root
+<VirtualHost *:80>
+    ServerName localhost
+    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
 
-<Location />
-    DAV on
-
-    Options +Indexes
-    HeaderName /header.html
-
-    # 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>
+        Options +Indexes
+        HeaderName /webdav-js/examples/apache-directory-list/header.html
+    </Location>
+</VirtualHost>

+ 20 - 0
test/Dockerfile

@@ -0,0 +1,20 @@
+FROM debian:jessie
+
+RUN apt-get update -y && apt-get install -y apache2
+
+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

+ 22 - 0
test/run-cdn.sh

@@ -0,0 +1,22 @@
+#!/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
+# npm run build
+
+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 \
+"

+ 22 - 0
test/run-local.sh

@@ -0,0 +1,22 @@
+#!/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
+# npm run build
+
+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 \
+"