Skip to content

Commit

Permalink
Add CONTRIBUTING guide for uploader
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit74 committed Feb 26, 2024
1 parent 8d748a8 commit b529dc3
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions uploader/CONTRIBUTING.md
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
```

0 comments on commit b529dc3

Please sign in to comment.