Coder Social home page Coder Social logo

saltatory / ipfs-sync Goto Github PK

View Code? Open in Web Editor NEW

This project forked from thediscordian/ipfs-sync

0.0 0.0 0.0 309 KB

A simple daemon which will watch files on your filesystem, mirror them to MFS, automatically update related pins, and update related IPNS keys.

License: BSD 3-Clause "New" or "Revised" License

Go 97.32% Makefile 2.68%

ipfs-sync's Introduction

ipfs-sync

Go Reference

Note: This software is very young. If you discover any bugs, please report them via the issue tracker.

ipfs-sync is a simple daemon which will watch files on your filesystem, mirror them to MFS, automatically update related pins, and update related IPNS keys, so you can always access your directories from the same address. You can use it to sync your documents, photos, videos, or even a website!

Buy Me A Coffee

Installation

If your OS or architechture isn't supported, please open an issue! If it's easily supported with Go, I'll definitely consider it ๐Ÿ˜Š.

Binary

If you're on an Arch based distro, ipfs-sync is available on the AUR.

Binaries are available on the releases page for other distros and OSs.

Source

You need go installed, with a working GOPATH and $GOPATH/bin should be added to your $PATH to execute the command.

go install github.com/TheDiscordian/ipfs-sync

Usage

The only required parameter is dirs, which can be specified in the config file, or as an argument. The ID parameter is simply a unique idenifier for you to remember, the IPNS key will be generated using this ID.

It's recommended you either use the included systemd user-service, or run ipfs-sync with a command like ipfs-sync -config $HOME/.ipfs-sync.yaml -db $HOME/.ipfs-sync.db, after placing a config file in ~/.ipfs-sync.yaml.

Usage of ipfs-sync:
  -basepath string
        relative MFS directory path (default "/ipfs-sync/")
  -config string
        path to config file to use (default "/home/user/.ipfs-sync.yaml")
  -copyright
        display copyright and exit
  -db string
        path to file where db should be stored (default "/home/user/.ipfs-sync.db")
  -dirs value
        set the dirs to monitor in json format like: [{"ID":"Example1", "Dir":"/home/user/Documents/", "Nocopy": false},{"ID":"Example2", "Dir":"/home/user/Pictures/", "Nocopy": false}]
  -endpoint string
        node to connect to over HTTP (default "http://127.0.0.1:5001")
  -ignore value
        set the suffixes to ignore (default: ["kate-swp", "swp", "part", "crdownload"])
  -ignorehidden
        ignore anything prefixed with "."
  -sync duration
        time to sleep between IPNS syncs (ex: 120s) (default 10s)
  -timeout duration
        longest time to wait for API calls like 'version' and 'files/mkdir' (ex: 60s) (default 30s)
  -v    display verbose output
  -version
        display version and exit

ipfs-sync can be setup and used as a service. Simply point it to a config file, and restart it whenever the config is updated. An example config file can be found at config.yaml.sample.

Example

Getting started is simple. The only required field is dirs, so if we wanted to sync a folder, we'd simply run:

ipfs-sync -dirs '[{"ID":"ExampleID", "Dir":"/home/user/Documents/ExampleFolder/", "Nocopy": false}]'
2021/02/12 18:03:38 ipfs-sync starting up...
2021/02/12 18:03:38 ExampleID not found, generating...
2021/02/12 18:03:38 Adding file to /ipfs-sync/ExampleFolder/index.html ...
2021/02/12 18:04:40 ExampleID loaded: k51qzi5uqu5dlpvinw1zhxzo4880ge5hg9tp3ao4ye3aujdru9rap2h7izk5lm

This command will first check if there's a key named ExampleID in ipfs-sync's namespace, if not, it'll generate and return one. In this example, it synced a simple website to k51qzi5uqu5dlpvinw1zhxzo4880ge5hg9tp3ao4ye3aujdru9rap2h7izk5lm. As you add/remove/change files in the directory now, they'll be visible live at that address.

The Nocopy option enables the --nocopy option when adding files for that shared directory, more info about the option can be found here, and it requires the ipfs filestore experimental feature enabled.

ipfs-sync's People

Contributors

thediscordian avatar jorropo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.