mirror of
https://github.com/versity/versitygw.git
synced 2026-08-28 20:06:02 +00:00
* feat(azure): implement server-side copy with fallback Add server-side object copy for the Azure backend using StartCopyFromURL, with a fallback to download+reupload when server-side copy is unavailable. The copy logic lives in backend/azure/copy.go and handles metadata, tagging and object lock configurations. The copy-source SAS service version is configurable via the --copy-sas-version flag (AZ_COPY_SAS_VERSION) and defaults to the SDK version, so production is unchanged. Endpoints that lag the SDK's SAS version (e.g. Azurite) cannot verify a SAS signed with the newer version and can set an older one. On a metadata-COPY, the internal website-redirect key is dropped from the destination to match the download+reupload fallback. Testing: - Add CopyObject_cross_bucket_server_side_copy, which copies an object with data, user metadata, content-type and tags across two buckets and verifies all are preserved and an ETag is returned. - Configure the Azurite functional-test gateway with AZ_COPY_SAS_VERSION and let Azurite trust its self-signed test certificate (NODE_EXTRA_CA_CERTS) so it can fetch the copy source from its own HTTPS endpoint, ensuring CI exercises the real server-side copy path instead of always falling back. Signed-off-by: Nils Leger <nils.leger@getflip.com> * docs: update copyright year Signed-off-by: Nils Leger <nils.leger@getflip.com> * fix: always fallback to download+upload whenever there is an error building the server-side copy URL Signed-off-by: Nils Leger <nils.leger@getflip.com> --------- Signed-off-by: Nils Leger <nils.leger@getflip.com>
52 lines
2.1 KiB
YAML
52 lines
2.1 KiB
YAML
services:
|
|
posix:
|
|
build:
|
|
context: .
|
|
dockerfile: tests/Dockerfile.dev
|
|
args:
|
|
- IAM_DIR=${IAM_DIR}
|
|
- SETUP_DIR=${SETUP_DIR}
|
|
volumes:
|
|
- ./:/app
|
|
ports:
|
|
- "${POSIX_PORT}:${POSIX_PORT}"
|
|
command: ["sh", "-c", CompileDaemon -build="go build -C ./cmd/versitygw -o versitygw" -command="./cmd/versitygw/versitygw -p :$POSIX_PORT -a $ACCESS_KEY_ID -s $SECRET_ACCESS_KEY --iam-dir $IAM_DIR posix $SETUP_DIR"]
|
|
proxy:
|
|
build:
|
|
context: .
|
|
dockerfile: tests/Dockerfile.dev
|
|
volumes:
|
|
- ./:/app
|
|
ports:
|
|
- "${PROXY_PORT}:${PROXY_PORT}"
|
|
command: ["sh", "-c", CompileDaemon -build="go build -C ./cmd/versitygw -o versitygw" -command="./cmd/versitygw/versitygw -p :$PROXY_PORT s3 -a $ACCESS_KEY_ID -s $SECRET_ACCESS_KEY --endpoint http://posix:$POSIX_PORT"]
|
|
azurite:
|
|
image: mcr.microsoft.com/azure-storage/azurite
|
|
ports:
|
|
- "10000:10000"
|
|
- "10001:10001"
|
|
- "10002:10002"
|
|
restart: always
|
|
hostname: azurite
|
|
# Server-side copy makes Azurite fetch the copy source from its own HTTPS
|
|
# endpoint; trust the self-signed test cert so that TLS validation succeeds.
|
|
environment:
|
|
NODE_EXTRA_CA_CERTS: /tests/certs/azurite.pem
|
|
command: "azurite --oauth basic --cert /tests/certs/azurite.pem --key /tests/certs/azurite-key.pem --blobHost 0.0.0.0 --skipApiVersionCheck"
|
|
volumes:
|
|
- ./tests/certs:/tests/certs
|
|
azuritegw:
|
|
build:
|
|
context: .
|
|
dockerfile: tests/Dockerfile.dev
|
|
volumes:
|
|
- ./:/app
|
|
ports:
|
|
- 7070:7070
|
|
# Azurite lags the SDK's SAS version and can't verify a copy-source SAS signed
|
|
# with it, so pin the copy-source SAS to a version Azurite supports. Production
|
|
# leaves this unset and uses the SDK default.
|
|
environment:
|
|
AZ_COPY_SAS_VERSION: "2025-11-05"
|
|
command: ["sh", "-c", CompileDaemon -build="go build -C ./cmd/versitygw -buildvcs=false -o versitygw" -command="./cmd/versitygw/versitygw -a $ACCESS_KEY_ID -s $SECRET_ACCESS_KEY --iam-dir $IAM_DIR azure -a $AZ_ACCOUNT_NAME -k $AZ_ACCOUNT_KEY --url https://azurite:10000/$AZ_ACCOUNT_NAME"]
|