Skip to main content

SCP/SFTP helper for Kiwix, openZIM and offspot uploads to our dropbox

Project description

uploader

Dedicated container/script to upload files to openzim/kiwix warehouses

Files are uploaded via SFTP or SCP using OpenSSH and (pubkey authentication). Files are uploaded to S3 assuming bucketName, keyId and secretAccessKey in query string.

Usage

  • Specify file to upload with --file.
  • Mount the RSA private key onto /etc/ssh/keys/id_rsa or use --private_key
  • Use an scp://, sftp://, s3:// URLs to specify target.
  • Specify a full path (with filename) to upload to a specific name or end with a / for uploading inside a folder
docker run \
    -v ~/.ssh/id_rsa:/etc/ssh/keys/id_rsa:ro \
    -v /path/:/path:rw \
    ghcr.io/openzim/uploader \
    uploader \
    --file /path/my_file.zim \
    --upload-uri sftp://uploader@warehouse.farm.openzim.org/zim/ \
    --upload-uri "s3://s3.us-west-1.wasabisys.com/?bucketName=my-bucket&keyId=my-key&secretAccessKey=my-secret" \
    --move \
    --delete

Parameters

  • --username: if your URI has no username, you can specify it here.
  • --move: upload to a temporary filename (<fname>.tmp) and rename it upon completion. Note that SCP is not able to do it so it uploads an <fname>.complete file upon completion instead.
  • --delete: delete source file once uploaded successfuly.
  • --compress: enable transfer compression.
  • --bandwidth: enable bandwidth limit. Set it in Kbps.
  • --cipher: change default cipher (aes128-ctr).
  • --resume: resume partially uploaded file (SFTP only)

Python

PyPI version shields.io

pip3 install kiwix_uploader[all]
uploader --help
from kiwix_uploader import check_and_upload_file

check_and_upload_file(
    src_path="/path/my_file.zim",
    upload_uri="sftp://uploader@warehouse.farm.openzim.org/zim/",
    private_key="~/.ssh/id_rsa",
)

Note: check_and_upload_file returns an unix-like returncode (0 on success)

from kiwix_uploader import multi_file_upload

multi_file_upload(
    src_path="/path/my_file.zim",
    upload_uris=["sftp://uploader@warehouse.farm.openzim.org/zim/"],
    private_key="~/.ssh/id_rsa",
)

Note: multi_file_upload returns an UploadResults (see upload module)

remove_file_retrying(
    upload_url="sftp://uploader@warehouse.farm.openzim.org/zim/my_file.zim",
    private_key=Path("~/.ssh/id_ed25519").expanduser()
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kiwix_uploader-1.7.2.tar.gz (27.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kiwix_uploader-1.7.2-py3-none-any.whl (30.3 kB view details)

Uploaded Python 3

File details

Details for the file kiwix_uploader-1.7.2.tar.gz.

File metadata

  • Download URL: kiwix_uploader-1.7.2.tar.gz
  • Upload date:
  • Size: 27.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kiwix_uploader-1.7.2.tar.gz
Algorithm Hash digest
SHA256 f1a5f232257e80cff4be0308f60f8af828e6ffb73618ae81375def29b70a62ac
MD5 7d4a05db468f05f6979844c91f1158a4
BLAKE2b-256 ee5e72ca44e4931d664394e8855148b3b9c8425b67c86c771e53d7740351c5f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiwix_uploader-1.7.2.tar.gz:

Publisher: Publish.yaml on kiwix/uploader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file kiwix_uploader-1.7.2-py3-none-any.whl.

File metadata

  • Download URL: kiwix_uploader-1.7.2-py3-none-any.whl
  • Upload date:
  • Size: 30.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for kiwix_uploader-1.7.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6520b136a47f76208cff78d5661563183c98a4a81da2d2596da7b9c1ea0e7a5e
MD5 3ecd8a204e6b82bd181c543424fd7b94
BLAKE2b-256 368abb1eab6db6ac80527e12ff1f432cc45a26cb7bbcdbf5f182df3762825d6a

See more details on using hashes here.

Provenance

The following attestation bundles were made for kiwix_uploader-1.7.2-py3-none-any.whl:

Publisher: Publish.yaml on kiwix/uploader

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page