-
-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #927 from openzim/upgrade_uploader
Upgrade uploader
- Loading branch information
Showing
12 changed files
with
203 additions
and
20 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
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
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,44 @@ | ||
FROM alpine:3 | ||
|
||
# Install SSH server | ||
RUN apk update && apk add --no-cache openssh-server | ||
|
||
# Create SSH directory and set permissions | ||
RUN mkdir /var/run/sshd | ||
RUN chmod 0755 /var/run/sshd | ||
|
||
# Copy SSH host keys to container | ||
COPY ssh_host_rsa_key /etc/ssh/ssh_host_rsa_key | ||
|
||
# Copy test client SSH public key to the container | ||
COPY id_rsa.pub /root/.ssh/authorized_keys | ||
|
||
RUN mkdir -p \ | ||
/root/artifacts \ | ||
/root/logs \ | ||
/root/zims/freecodecamp \ | ||
/root/zims/gutenberg \ | ||
/root/zims/ifixit \ | ||
/root/zims/mooc \ | ||
/root/zims/other \ | ||
/root/zims/phet \ | ||
/root/zims/stack_exchange \ | ||
/root/zims/ted \ | ||
/root/zims/videos \ | ||
/root/zims/vikidia \ | ||
/root/zims/wikibooks \ | ||
/root/zims/wikihow \ | ||
/root/zims/wikinews \ | ||
/root/zims/wikipedia \ | ||
/root/zims/wikiquote \ | ||
/root/zims/wikisource \ | ||
/root/zims/wikiversity \ | ||
/root/zims/wikivoyage \ | ||
/root/zims/wiktionary \ | ||
/root/zims/zimit | ||
|
||
# Expose SSH port | ||
EXPOSE 22 | ||
|
||
# Start SSH server | ||
CMD ["/usr/sbin/sshd", "-D"] |
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,27 @@ | ||
-----BEGIN RSA PRIVATE KEY----- | ||
MIIEpAIBAAKCAQEAp9q+SGUiadNhQQGEmQUEXTgSgStlThK3awQmZuSIN4QykLsa | ||
t/PluQidiVCVPi0Jv/7np5ufLHBpRLZOfsOUozm48yvEMeiXkYQImfMacsnUqFCL | ||
3dAEQ/TisHYkBalZSz5Tsq3SKUNr0REncM4XtH+xGFMICswcOZNH6MULBsU4s7WP | ||
7oFifCbKOVjsV8MxMOHEpxoXa3oai6YZWWp6+eMI+aE3K4/7yR5aW8ZGMxTHNmYI | ||
/NRnSFeMj9x9cl+MkivFZAzzgnMx2nHUZx8OLvFYH+sEumct4jKb7hruwSZMDaE1 | ||
75lVeQV1JuhgDEkEwD3MOU/DPnl40gJ64hgwCwIDAQABAoIBAAQzoQy931knzejr | ||
KU8NRZkxxKDQHcaRCF9Y6L8tnE1LdVqTHG2bYNY7ZXog9sNqLDLOpizXY+ogXDo4 | ||
mAlrSua1FLCdmVkoedbOJ8r2v2Q9MiIOdhnU0a6DzELfijJMFWyhQEYaPMcEpYfD | ||
tqmHtycxBRVXSr2+czxrt+KXQBnovoqkM3M/ritAyj6HhQ8ZgqecmKA0UNWHXMX9 | ||
fYJqeHtoek7DOM30C2qUOfiTE8Cd92BFyFffajL13tZPS0hD1yN3rE11khCbMfMo | ||
5n4lKykBw4G6EX4+mzTLPNxK29sead9IYfa0RteJIVXZG4GX7wnok8vVLm2f6k0N | ||
iMsNPMUCgYEA1t2X/7y/x/RMOpZ3dDvK2Zm3bnICah7nXK7afs/WFUiwkzFg92S1 | ||
jb3wsjEZ8vPn3nUam4caLelYG8GylXUnQJkqJ8bEzCaOOnKeWVVPy+QZvN1upVgC | ||
Zip8qlWqJYkKcKMNawLlkw51yeEXssbvwCHVYSazR0hLv3kvckU96DcCgYEAx/0r | ||
DBsb0DjmG/QQRTfkZ/TpifgWCEzuw5TQrONPwExRKxMmfYuT6mVuVPHxA6GH4y2R | ||
jdDl/CQT/iiS/dOxBDg8Z4W89BGm7YTf8OFUtknDAXlTYAmp6wAgbHrps5wYRPQY | ||
eYfvNRByWg1Vf4RTAWLHV7yNnmajFc/CmCpOpM0CgYEAteItChIIMkZNxQacJet7 | ||
gooJ6ddezeBNL3rggJqE+c1nk6IoGCPLQCo6N00zTyNC82Aj3uYVtimiKRTljHj4 | ||
ekltkvBCpSI6IaXm/24lN05mryauxA5lMYDjuPj9J/sCuGh+Mkjod3y1HuiJPBAE | ||
4ZqCW1P8TOoZHQODs3KDvi8CgYEAp3TZgr2AQI4kP+vRY+Q1IMb2dkyBRloE40fM | ||
o7eCo+ZDYOocJKunI3HjPMWJphyviA4z/qeYq9QZ2Ytn6ZpEcuAT1Csr2MKfH+tP | ||
CIflQu3ol2db5OKyoM/uVmdlILvnpnUtuTWVmr02wyi/GpNWXaa0fEap3qTakfzx | ||
WDC0wVECgYAV6plB4s007I6d6SgBYAQrUMSMlzNO8oTUAI8Zc/PEpQef0WMO7/11 | ||
MQDD25LTegbxW7+DT8Qwhh0U7MWO4dr0hl1QdiMpTYw0GWV9HpPx8ta37W3Jx/0i | ||
SrdQUEZ3rP/HXcQsW7nNBgplI+nRYL3eoVXAT9PgF0ug+EdFzHUcUQ== | ||
-----END RSA PRIVATE KEY----- |
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 @@ | ||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCn2r5IZSJp02FBAYSZBQRdOBKBK2VOErdrBCZm5Ig3hDKQuxq38+W5CJ2JUJU+LQm//uenm58scGlEtk5+w5SjObjzK8Qx6JeRhAiZ8xpyydSoUIvd0ARD9OKwdiQFqVlLPlOyrdIpQ2vRESdwzhe0f7EYUwgKzBw5k0foxQsGxTiztY/ugWJ8Jso5WOxXwzEw4cSnGhdrehqLphlZanr54wj5oTcrj/vJHlpbxkYzFMc2Zgj81GdIV4yP3H1yX4ySK8VkDPOCczHacdRnHw4u8Vgf6wS6Zy3iMpvuGu7BJkwNoTXvmVV5BXUm6GAMSQTAPcw5T8M+eXjSAnriGDAL |
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 @@ | ||
ssh-host ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCunjxQLDBHohVN13u/fMQNlHeM+QQK6N6LRNo6XO/Y08CKIh6s7YFmZdPWqslOilLdGQM8z8ShZd/WrCjGEbanYQI2c5TgduLd6CIjL3t07otLtf8KqXZCDBBtOvvlTUWHJQk1hN3STdfw+VNjdOMhLeWTtCAyO2zgJQTfkqrrjVul+m3ykAOQw4ULLpTefrZ2/qpcbJaDl8qoortpMuhHExxvMgJJhyx0cOLHA7UdEgEr+2BfMTj6BznB+udREYTFDFTgkDexHzdpptphtO2HCqyY06z8lacdOPw5mXe0Ilfr/EFDhtkk4i8MsdRLhaqtkzvw914t/4yZcFBDd1DNQzMcBK4W8WZUNeArsB14/UMhACFj2QUIGyxa8yoawQ5G8EaEf0Djg1MP+gnTFb2fu9vXBEO0Bu/TYOIfs9W9iKN5aw7NvupulCcO1eTQED3k5QIKeautKL42hnPCnL8SQQsS2JPRRzXtarjLIghog1chirQNFkfNiNjsa2ltOp0= |
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,39 @@ | ||
-----BEGIN OPENSSH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pE7f8z6wftlvlya | ||
dCnq2hmQJLVDTIZlbgT6AQ9VBs7FZP0ZmRSP49uV8JY/dEOqi+o6xaDHflsPF/tx5pC6KV | ||
WPxgoqrkmnwt7vgwmBd0vY75rgdxsEW/S1B8AvU43eG1Bi4HaqRHDeS2ffOCOI4dOkzU1z | ||
MyFIpIn0Sx7qXlRLdppu9JSz9ssCZR1QAAAMEAu6O4TlW+3IuQOTkpNPKHtS40VW9Rk4De | ||
995+ktFQFRbYeHptJWAs+abbTZfV6XBNsMx9z6C1x2J9v7/O7/lqGMyPCBsUn//FrtjA+l | ||
GUDCutEYiMewKsZpMzEY5XGbGV4srSHazrlYgVDi1MjWSo5zYG3EloJe/wrew26y76mREM | ||
yA9u+SLVJ3NBtFYtTkf7WecH2xtT2H6uedT+QeisVFKFpzdwIvyNUswgqS7S6vu8QL3nRM | ||
7twwb3BPpu4eGpAAAAI2Jlbm9pdEBVYnVudHUtMjIwNC1qYW1teS1hbWQ2NC1iYXNlAQID | ||
BAUGBw== | ||
-----END OPENSSH PRIVATE KEY----- |
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 | ||
``` |
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
kiwixstorage>=0.8.3,<0.9 | ||
kiwixstorage==0.8.3 |
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
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