s4

:arrows_counterclockwise: Fast and cheap synchronisation of files using Amazon S3

https://github.com/michaelaquilina/s4

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.5%) to scientific vocabulary

Keywords

aws python3 s3 sync synchronization
Last synced: 6 months ago · JSON representation

Repository

:arrows_counterclockwise: Fast and cheap synchronisation of files using Amazon S3

Basic Info
  • Host: GitHub
  • Owner: MichaelAquilina
  • License: gpl-3.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 1010 KB
Statistics
  • Stars: 73
  • Watchers: 2
  • Forks: 11
  • Open Issues: 28
  • Releases: 0
Topics
aws python3 s3 sync synchronization
Created over 9 years ago · Last pushed over 1 year ago
Metadata Files
Readme Changelog License

README.rst

==============
S4 = S3 Syncer
==============

|CircleCI| |CodeCov| |Black| |PyPi| |GPLv3|

Fast and cheap synchronisation of files using `Amazon
S3 `__.

S4 stands for "Simple Storage Solution (S3) Syncer".

The intention of this project is to be an open source alternative to
typical proprietary sync solutions like Dropbox. Because S4 interacts
with S3 directly, you can expect *very* fast upload and download speeds
as well as *very* cheap costs (See `Amazon S3
Pricing `__ for an idea of how much
this would cost you). See `Why?`_ for further motivation for this project.

You can also take advantage of other cool features that S3 provides like
`versioning `__.
Everytime you sync a version of a new file, you will now have the
ability to easily rollback to any previous version.

* Requirements_
* Installation_
* Setup_
* Synchronising_
* `Handling Conflicts`_
* `Other Subcommands`_
* `How S4 Works`_
* `Ignoring Files`_
* `Why?`_
* Contributing_

See it in action here:

|ASCIINEMA|

Requirements
------------

S4 requires python 3.5+ to work

Installation
------------

The easiest way to install S4 is through pip:

::

    $ pip install s4

You will need ``libmagic`` installed.
This is installed by default on most linux distributions but on MacOSX you need to install it with brew as follows:

::

    brew install libmagic

Setup
-----

Run ``s4 add`` to add a new sync local folder and target S3 uri:

::

    $ s4 add
    local folder: /home/username/myfolder1
    s3 uri: s3://mybucket/folder1
    AWS Access Key ID: AKIAJD53D9GCGKCD
    AWS Secret Access Key:
    region name: eu-west-2
    Provide a name for this entry [myfolder1]:

Synchronising
-------------

Run ``s4 sync`` in the project directory to synchronise the local
folders you specified with the folders in the bucket.

::

    $ s4 sync
    Syncing myfolder1 [/home/username/myfolder1/ <=> s3://mybucket/folder1/]
    Creating foobar.jpg (/home/username/myfolder1/ => s3://mybucket/folder1/)
    Creating boarding-pass.pdf (/home/username/myfolder1/ => s3://mybucket/folder1/)
    Flushing Index to Storage

All files will be automatically synced between the source and target
destinations where possible.

You may specify a specific folder to synchronise by the name you
provided during ``add``.

::

    $ s4 sync myfolder1


If you wish to synchronise your targets continuously, use the ``daemon`` command:

::

    $ s4 daemon myfolder1

NOTE: This command is only supported on machines that can run INotify. This typically means
Linux based operating systems.


Handling Conflicts
------------------

In the case where S4 cannot decide on a reasonable action by itself, it
will ask you to intervene:

::

    Syncing /home/username/myfolder1/ with s3://mybucket/folder1/

    Conflict for "test.txt". Which version would you like to keep?
       (1) /home/username/myfolder1/test.txt updated at 2017-01-23 12:26:24 (CREATED)
       (2) s3://mybucket/folder1/test.txt updated at 2017-01-23 12:26:30 (CREATED)
       (d) View difference (requires diff command)
       (X) Skip this file

    Choice (default=skip):

If you do not wish to fix the issue, you can simply skip the file for
now.

Other Subcommands
-----------------

Some other subcommands that you could find useful:

-  ``s4 targets`` - print existing targets
-  ``s4 edit`` - edit the settings of a targets
-  ``s4 rm`` - remove a target
-  ``s4 ls`` - print tracked files and metadata of a target

Use the ``--help`` parameter on each subcommand to get more details.

How S4 Works
------------

S4 keeps track of changes between files with a ``.index`` file at
the root of each folder you are syncing. This contains the keys of each
file being synchronised along with the timestamps found locally and
remotely in JSON format.

This is compressed (currently using gzip) to save space and increase
performance when loading.

If you are curious, you can view the contents of an index file using the
``s4 ls`` subcommand or you can view the file directly using a command
like ``zcat``.

    NOTE: Deleting this file will result in that folder being treated as if
    it was never synced before so make sure you *do not* delete it unless
    you know what you are doing.

All information about your configuration (such as targets, your keys etc..) are
stored in a JSON formatted file under ``~/.config/s4/sync.conf``.

Ignoring Files
--------------

Create a ``.syncignore`` file in the root of the directory being synced
to list patterns of subdirectories and files you wish to ignore. The
``.syncignore`` file uses the exact same pattern that you would expect
in ``.gitignore``. Each line specifies a `GLOB
pattern `__ to
ignore during sync.

Note that if you add a pattern which matches an item that was previously
synced, that item will be deleted from the target you are syncing with
next time you run S4.

Why?
----

There are a number of open source S3 backup tools out there - but none of them really satisfied the
requirements that this project tries to solve.

Here are is a list of open source solutions that I have tried in the past.

* ``s3cmd``: Provides a sync function that works very well for backing up - but stops working correctly
  as soon as there is second machine you want to sync to S3.

* ``owncloud/nextcloud``: Requires you to setup a server to perform your syncing. In terms of costs on AWS,
  this quickly becomes costly compared with just using S3. The speed of your uploads and downloads are also
  heavily bottlenectked by the network and hardware performance of your ec2 instance.

* ``seafile``: suffers from the same problem as owncloud/nextcloud.

* ``duplicity``: great backup tool, but does not provide a sync solution of any kind.

Contributing
------------

Pull requests are welcome! Make sure you pass all the tests, CircleCI will tell you if you don't ;)

When opening a pull request, please make sure it is from a separate branch in your fork.

.. |CircleCI| image:: https://circleci.com/gh/MichaelAquilina/S4.svg?style=svg
   :target: https://circleci.com/gh/MichaelAquilina/S4

.. |PyPi| image:: https://badge.fury.io/py/s4.svg
   :target: https://badge.fury.io/py/s4

.. |CodeCov| image:: https://codecov.io/gh/MichaelAquilina/s4/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/MichaelAquilina/s4

.. |GPLv3| image:: https://img.shields.io/badge/License-GPL%20v3-blue.svg
   :target: https://www.gnu.org/licenses/gpl-3.0

.. |ASCIINEMA| image:: https://asciinema.org/a/0GiXLN7YT4ki8qouedF0w8Wbk.png
   :target: https://asciinema.org/a/0GiXLN7YT4ki8qouedF0w8Wbk?autoplay=1

.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
   :target: https://github.com/ambv/black

Owner

  • Name: Michael Aquilina
  • Login: MichaelAquilina
  • Kind: user
  • Location: London, United Kingdom
  • Company: @snyk

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: over 2 years ago

All Time
  • Total Commits: 674
  • Total Committers: 5
  • Avg Commits per committer: 134.8
  • Development Distribution Score (DDS): 0.01
Past Year
  • Commits: 0
  • Committers: 0
  • Avg Commits per committer: 0.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Michael Aquilina m****a@g****m 667
epayet j****g@g****m 3
Troy Larson t****r@g****m 2
Michael Aquilina m****l@l****e 1
Adam Johnson me@a****u 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 40
  • Total pull requests: 62
  • Average time to close issues: 4 months
  • Average time to close pull requests: 4 months
  • Total issue authors: 12
  • Total pull request authors: 4
  • Average comments per issue: 2.8
  • Average comments per pull request: 1.69
  • Merged pull requests: 33
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • MichaelAquilina (25)
  • troylar (2)
  • ranaur (2)
  • splitice (2)
  • mitija (2)
  • ahansson89 (1)
  • ambrosiozack (1)
  • kdpawson (1)
  • drewhemm (1)
  • digitaltommy (1)
  • limnove (1)
  • saqib01 (1)
Pull Request Authors
  • MichaelAquilina (54)
  • ranaur (7)
  • lancehudson (2)
  • troylar (1)
Top Labels
Issue Labels
enhancement (2) help wanted (2) bug (2) good first issue (1)
Pull Request Labels

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 324 last-month
  • Total dependent packages: 0
    (may contain duplicates)
  • Total dependent repositories: 2
    (may contain duplicates)
  • Total versions: 43
  • Total maintainers: 2
pypi.org: s4

Fast and cheap synchronisation of files using Amazon S3

  • Versions: 42
  • Dependent Packages: 0
  • Dependent Repositories: 2
  • Downloads: 305 Last month
Rankings
Stargazers count: 8.1%
Dependent packages count: 10.0%
Forks count: 10.5%
Average: 11.0%
Dependent repos count: 11.6%
Downloads: 14.6%
Maintainers (1)
Last synced: 6 months ago
pypi.org: opt-s4

Fast and cheap synchronisation of files using Amazon S3

  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 19 Last month
Rankings
Dependent packages count: 7.1%
Stargazers count: 8.3%
Forks count: 10.7%
Average: 14.1%
Dependent repos count: 30.3%
Maintainers (1)
Last synced: 6 months ago

Dependencies

dev-requirements.txt pypi
  • Faker * development
  • freezegun * development
  • moto * development
  • pytest * development
  • pytest-cov * development
  • pytest-timeout * development
  • pytz * development
lint-requirements.txt pypi
  • black ==19.3b0
  • flake8 ==3.7.7
  • flake8-spellcheck ==0.8.0
  • isort ==4.3.20
  • readme_renderer ==24.0.0
requirements.txt pypi
  • boto3 >=1.9
  • clint >=0.5.1
  • filelock >=2.0.12
  • inotify-simple >=1.1.7
  • pathspec >=0.5.6
  • python-magic >=0.4.12
  • tabulate >=0.7.7
  • tqdm >=4.8.4
setup.py pypi