-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcompose.yaml
More file actions
91 lines (85 loc) · 3.49 KB
/
Copy pathcompose.yaml
File metadata and controls
91 lines (85 loc) · 3.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Local storage services for testing the backend against real endpoints: an
# S3-compatible one (RustFS) and a WebDAV one (dufs).
#
# docker compose up -d # start RustFS + create the test bucket + dufs
# RUSTFS_ENDPOINT=http://localhost:9000 cargo test -p fskit-s3-backend -- --ignored
# FSKIT_WEBDAV_ENDPOINT=http://localhost:9002 \
# cargo test -p fskit-s3-backend --test live_webdav -- --ignored # dufs
# FSKIT_WEBDAV_ENDPOINT=http://localhost:9003 \
# cargo test -p fskit-s3-backend --test live_webdav -- --ignored # apache (strict)
# docker compose down # stop (add -v to also wipe the volumes)
#
# S3 API: http://localhost:9000 Console: http://localhost:9001
# WebDAV: http://localhost:9002 (dufs) http://localhost:9003 (Apache, strict)
# Credentials below are for LOCAL DEV ONLY.
name: fskit-s3-dev
services:
rustfs:
image: rustfs/rustfs:latest
container_name: fskit-s3-rustfs
ports:
- "9000:9000" # S3 API
- "9001:9001" # web console
environment:
RUSTFS_ACCESS_KEY: fskit
RUSTFS_SECRET_KEY: fskit-secret
RUSTFS_VOLUMES: /data
RUSTFS_ADDRESS: 0.0.0.0:9000
RUSTFS_CONSOLE_ADDRESS: 0.0.0.0:9001
RUSTFS_CONSOLE_ENABLE: "true"
volumes:
- rustfs-data:/data
restart: unless-stopped
# One-shot: wait for the S3 API, then create the test bucket and seed a file.
createbucket:
image: amazon/aws-cli:latest
depends_on:
- rustfs
environment:
AWS_ACCESS_KEY_ID: fskit
AWS_SECRET_ACCESS_KEY: fskit-secret
AWS_DEFAULT_REGION: us-east-1
entrypoint:
- sh
- -c
- |
until aws --endpoint-url http://rustfs:9000 s3 ls >/dev/null 2>&1; do
echo "waiting for rustfs S3 API..."; sleep 2;
done
aws --endpoint-url http://rustfs:9000 s3 mb s3://test-bucket 2>/dev/null || true
echo "hello from rustfs" | aws --endpoint-url http://rustfs:9000 s3 cp - s3://test-bucket/hello.txt
aws --endpoint-url http://rustfs:9000 s3 ls s3://test-bucket
# WebDAV share for the `live_webdav.rs` tests. dufs is a small static file
# server that speaks WebDAV (PROPFIND/MKCOL/PUT/DELETE/COPY), so it exercises
# the real protocol without a Nextcloud-sized deployment. `--allow-all` enables
# the write methods; `--auth` puts it behind HTTP Basic, the auth the backend
# sends, so an unauthenticated regression would actually fail.
webdav:
image: sigoden/dufs:latest
container_name: fskit-s3-webdav
ports:
- "9002:5000" # WebDAV
command: ["/data", "--allow-all", "--auth", "fskit:fskit-secret@/:rw"]
volumes:
- webdav-data:/data
restart: unless-stopped
# A SECOND WebDAV server, on purpose. dufs above is permissive; Apache/mod_dav is
# strict — it answers `PROPFIND /dir` (no trailing slash) with `301 -> /dir/`, and
# real deployments are the strict kind (a Hetzner Storage Box, Nextcloud and
# ownCloud all front WebDAV with Apache). That difference hid a live bug where
# every subdirectory of a share came back as `Input/output error` while dufs was
# green, so run the live suite against BOTH. See scripts/dav-apache-init.sh.
webdav-apache:
image: httpd:2.4
container_name: fskit-s3-webdav-apache
ports:
- "9003:80" # WebDAV (strict)
command: ["sh", "/dav-init.sh"]
volumes:
- ./scripts/dav-apache-init.sh:/dav-init.sh:ro
- webdav-apache-data:/usr/local/apache2/htdocs
restart: unless-stopped
volumes:
rustfs-data:
webdav-data:
webdav-apache-data: