This is an automated email from the ASF dual-hosted git repository.
xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-opendal.git
The following commit(s) were added to refs/heads/main by this push:
new 0e1dabda1 refactor(service/webdav): Add docker-compose file to
simplify the CI (#2873)
0e1dabda1 is described below
commit 0e1dabda195a907570d016af93f8897369bcb9e2
Author: Liuqing Yue <[email protected]>
AuthorDate: Sun Aug 27 19:31:35 2023 +0800
refactor(service/webdav): Add docker-compose file to simplify the CI (#2873)
* misc(service/webdav): Add docker-compose file to simplify the CI
* chore: delete debug tag
Signed-off-by: Liuqing Yue <[email protected]>
* fix: empty password
Signed-off-by: Liuqing Yue <[email protected]>
* fix: change dir name
Signed-off-by: Liuqing Yue <[email protected]>
* doc: add comment for redirecting docker compose
Signed-off-by: Liuqing Yue <[email protected]>
* fix: fix misusing of volume
Signed-off-by: Liuqing Yue <[email protected]>
---------
Signed-off-by: Liuqing Yue <[email protected]>
---
.github/workflows/service_test_webdav.yml | 43 ++++------------------
.../webdav/fixtures/config/nginx/http.conf | 13 +++++++
.../fixtures/docker-compose-webdav-with-auth.yml | 32 ++++++++++++++++
.../docker-compose-webdav-with-empty-passwd.yml | 31 ++++++++++++++++
.../webdav/fixtures/docker-compose-webdav.yml | 34 +++++++++++++++++
core/src/services/webdav/fixtures/htpasswd | 2 -
.../webdav/fixtures/nginx-with-basic-auth.conf | 28 --------------
core/src/services/webdav/fixtures/nginx.conf | 43 ----------------------
8 files changed, 118 insertions(+), 108 deletions(-)
diff --git a/.github/workflows/service_test_webdav.yml
b/.github/workflows/service_test_webdav.yml
index 9b130d27e..6d44c9700 100644
--- a/.github/workflows/service_test_webdav.yml
+++ b/.github/workflows/service_test_webdav.yml
@@ -46,15 +46,10 @@ jobs:
with:
need-nextest: true
- - name: Install nginx full for dav_ext modules
- run: sudo apt install nginx-full
-
- name: Start nginx
shell: bash
- working-directory: core
- run: |
- mkdir -p /tmp/static
- nginx -c `pwd`/src/services/webdav/fixtures/nginx.conf
+ working-directory: core/src/services/webdav/fixtures
+ run: docker compose -f docker-compose-webdav.yml up -d
- name: Test
shell: bash
@@ -73,16 +68,10 @@ jobs:
with:
need-nextest: true
- - name: Install nginx full for dav_ext modules
- run: sudo apt install nginx-full
-
- name: Start nginx
shell: bash
- working-directory: core
- run: |
- mkdir -p /tmp/static
- cp `pwd`/src/services/webdav/fixtures/htpasswd /tmp/htpasswd
- nginx -c
`pwd`/src/services/webdav/fixtures/nginx-with-basic-auth.conf
+ working-directory: core/src/services/webdav/fixtures
+ run: docker compose -f docker-compose-webdav-with-auth.yml up -d
- name: Test with password
shell: bash
@@ -103,16 +92,10 @@ jobs:
with:
need-nextest: true
- - name: Install nginx full for dav_ext modules
- run: sudo apt install nginx-full
-
- name: Start nginx
shell: bash
- working-directory: core
- run: |
- mkdir -p /tmp/static
- cp `pwd`/src/services/webdav/fixtures/htpasswd /tmp/htpasswd
- nginx -c
`pwd`/src/services/webdav/fixtures/nginx-with-basic-auth.conf
+ working-directory: core/src/services/webdav/fixtures
+ run: docker compose -f docker-compose-webdav-with-empty-passwd.yml up
-d
- name: Test empty password
shell: bash
@@ -132,20 +115,10 @@ jobs:
with:
need-nextest: true
- - name: Install nginx full for dav_ext modules
- run: sudo apt install nginx-full
-
- name: Start nginx
shell: bash
- working-directory: core
- run: |
- mkdir -p /tmp/static
- mkdir -p /var/lib/nginx
- # make nginx worker has permission to operate it
- chmod a+rw /tmp/static/
- # make nginx worker has permission to operate it
- sudo chmod 777 /var/lib/nginx/body
- nginx -c `pwd`/src/services/webdav/fixtures/nginx.conf
+ working-directory: core/src/services/webdav/fixtures
+ run: docker compose -f docker-compose-webdav.yml up -d
- name: Test with redirect
shell: bash
diff --git a/core/src/services/webdav/fixtures/config/nginx/http.conf
b/core/src/services/webdav/fixtures/config/nginx/http.conf
new file mode 100644
index 000000000..4bacedfad
--- /dev/null
+++ b/core/src/services/webdav/fixtures/config/nginx/http.conf
@@ -0,0 +1,13 @@
+# the following configuration is for redirect test
+server {
+ listen 81;
+ server_name localhost;
+ access_log /tmp/forward-access.log;
+ error_log /tmp/forward-error.log;
+
+ location / {
+ client_max_body_size 1024M;
+ # forward all other requests to port 80
+ proxy_pass http://127.0.0.1:80;
+ }
+}
diff --git
a/core/src/services/webdav/fixtures/docker-compose-webdav-with-auth.yml
b/core/src/services/webdav/fixtures/docker-compose-webdav-with-auth.yml
new file mode 100644
index 000000000..6bb1b419e
--- /dev/null
+++ b/core/src/services/webdav/fixtures/docker-compose-webdav-with-auth.yml
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+version: '3.8'
+
+services:
+ webdav:
+ image: dgraziotin/nginx-webdav-nononsense
+ ports:
+ - "8080:80"
+ volumes:
+ - webdav-data:/data
+ environment:
+ - WEBDAV_USERNAME=bar
+ - WEBDAV_PASSWORD=bar
+
+volumes:
+ webdav-data:
diff --git
a/core/src/services/webdav/fixtures/docker-compose-webdav-with-empty-passwd.yml
b/core/src/services/webdav/fixtures/docker-compose-webdav-with-empty-passwd.yml
new file mode 100644
index 000000000..c7046213b
--- /dev/null
+++
b/core/src/services/webdav/fixtures/docker-compose-webdav-with-empty-passwd.yml
@@ -0,0 +1,31 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+version: '3.8'
+
+services:
+ webdav:
+ image: dgraziotin/nginx-webdav-nononsense
+ ports:
+ - "8080:80"
+ volumes:
+ - webdav-data:/data
+ environment:
+ - WEBDAV_USERNAME=foo
+
+volumes:
+ webdav-data:
diff --git a/core/src/services/webdav/fixtures/docker-compose-webdav.yml
b/core/src/services/webdav/fixtures/docker-compose-webdav.yml
new file mode 100644
index 000000000..27edb45e6
--- /dev/null
+++ b/core/src/services/webdav/fixtures/docker-compose-webdav.yml
@@ -0,0 +1,34 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+version: '3.8'
+
+services:
+ webdav:
+ image: dgraziotin/nginx-webdav-nononsense
+ ports:
+ - "8080:80"
+ # the following port is used by the test redirect
+ - "8081:81"
+ volumes:
+ - webdav-data:/data
+ # the following volume is used to redirect 81 port to 80 port
+ # ./config/nginx/http.conf will be appended to the default nginx.conf
+ - ./config:/config
+
+volumes:
+ webdav-data:
diff --git a/core/src/services/webdav/fixtures/htpasswd
b/core/src/services/webdav/fixtures/htpasswd
deleted file mode 100644
index 73f39cf91..000000000
--- a/core/src/services/webdav/fixtures/htpasswd
+++ /dev/null
@@ -1,2 +0,0 @@
-foo:$2y$10$GxAX8rC4qDTymm1AxocMmeWIT3ILwGg8Bk.U.SdMVbk7.iH5Cvf9y
-bar:$2y$10$lNipq5OoOCIoFphWtGsTD./Lw323C0bNBKaPjcR/deoS3OwxJD.qS
diff --git a/core/src/services/webdav/fixtures/nginx-with-basic-auth.conf
b/core/src/services/webdav/fixtures/nginx-with-basic-auth.conf
deleted file mode 100644
index e88826b51..000000000
--- a/core/src/services/webdav/fixtures/nginx-with-basic-auth.conf
+++ /dev/null
@@ -1,28 +0,0 @@
-load_module /usr/lib/nginx/modules/ngx_http_dav_ext_module.so;
-
-error_log /tmp/error.log;
-pid /tmp/nginx.pid;
-
-events {
- worker_connections 1024;
-}
-
-http {
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
- access_log /tmp/access.log;
- root /tmp/static;
-
- location / {
- client_body_temp_path /tmp;
- log_not_found off;
- dav_methods PUT DELETE MKCOL COPY MOVE;
- dav_ext_methods PROPFIND;
- create_full_put_path on;
- client_max_body_size 1024M;
- auth_basic "Administrator’s Area";
- auth_basic_user_file /tmp/htpasswd;
- }
- }
-}
diff --git a/core/src/services/webdav/fixtures/nginx.conf
b/core/src/services/webdav/fixtures/nginx.conf
deleted file mode 100644
index 1ba753cfe..000000000
--- a/core/src/services/webdav/fixtures/nginx.conf
+++ /dev/null
@@ -1,43 +0,0 @@
-load_module /usr/lib/nginx/modules/ngx_http_dav_ext_module.so;
-
-error_log /tmp/error.log;
-pid /tmp/nginx.pid;
-
-events {
- worker_connections 1024;
-}
-
-http {
- # the following configuration is for redirect test
- server {
- listen 127.0.0.1:8081;
- server_name localhost;
- access_log /tmp/forward-access.log;
- error_log /tmp/forward-error.log;
-
- location / {
- if ($request_method = GET) {
- return 302 http://$server_name:8080$request_uri;
- }
- client_max_body_size 1024M;
- # forward all other requests to port 8080
- proxy_pass http://127.0.0.1:8080;
- }
- }
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
- access_log /tmp/access.log;
- root /tmp/static;
-
- location / {
- client_body_temp_path /tmp;
- log_not_found off;
- dav_methods PUT DELETE MKCOL COPY MOVE;
- dav_ext_methods PROPFIND;
- create_full_put_path on;
- client_max_body_size 1024M;
- }
- }
-}