-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Contributing | ||
|
||
In order to test this component, you need: | ||
- Docker | ||
- a test Zimfarm instance with a username + password (below we use the one from `dev` folder Docker compose stack) | ||
- a test SSH host (below we use the one from `dev` folder Docker compose stack) | ||
- a test S3 bucket on Wasabi (you will have to set compliance to fully test the uploader) | ||
- credentials to access this bucket (keyId and secretAccessKey suggested below) | ||
|
||
Rebuild the Docker image: | ||
|
||
``` | ||
docker build -t local-zf-uploader . | ||
``` | ||
|
||
## S3 tests | ||
|
||
Export the secret `S3_URL` as environment variable. Note that the S3 URL starts with `s3`. | ||
|
||
|
||
On Bash/Zsh shells (replace `<your_s3_host_name>`, `<your_key_id>`, `<your_secret_access_key>` and `<your_bucket>` with proper values): | ||
|
||
``` | ||
export S3_URL="s3://<your_s3_host_name>/?keyId=<your_key_id>&secretAccessKey=<your_secret_access_key>&bucketName=<your_bucket>" | ||
``` | ||
|
||
Run a test without compliance activated on the bucket: | ||
|
||
``` | ||
docker run -it --rm -v $PWD:/data local-zf-uploader uploader --file /data/CONTRIBUTING.md --upload-uri $S3_URL | ||
``` | ||
|
||
Run same test twice, it should work. | ||
|
||
Delete the file from the bucket and activate compliance (with a 1 day setting for instance). | ||
|
||
Run a test which will set the object compliance: | ||
|
||
``` | ||
docker run -it --rm -v $PWD:/data local-zf-uploader uploader --file /data/CONTRIBUTING.md --upload-uri $S3_URL --delete-after 30 | ||
``` | ||
|
||
It should succeed. If you run the same test a second time, it will fail due to compliance (HTTP 400 error). | ||
|
||
## SCP test | ||
|
||
Following test upload should succeed. | ||
|
||
``` | ||
docker run -it --rm -v $PWD:/data -v $PWD/../dev/ssh-host/id_rsa:/etc/ssh/keys/id_rsa -v $PWD/../dev/ssh-host/known_hosts:/etc/ssh/known_hosts --network zimfarm_default local-zf-uploader uploader --file /data/CONTRIBUTING.md --upload-uri scp://root@ssh-host:22/CONTRIBUTING.md --move | ||
``` | ||
|
||
## SFTP test | ||
|
||
Following test upload should succeed. | ||
|
||
``` | ||
docker run -it --rm -v $PWD:/data -v $PWD/../dev/ssh-host/id_rsa:/etc/ssh/keys/id_rsa -v $PWD/../dev/ssh-host/known_hosts:/etc/ssh/known_hosts --network zimfarm_default local-zf-uploader uploader --file /data/CONTRIBUTING.md --upload-uri sftp://root@ssh-host:22/CONTRIBUTING.md | ||
``` |