Coder Social home page Coder Social logo

dat-store's Introduction

dat-store

dat-store aims to solve the question of "How do I make sure my Dat is being shared".

It can be used as a CLI to watch for changes in a folder, or to keep a Dat online based on its URL.

You can download an executible without needing to set up Node.js from the latest release.

Note: dat-store uses features from node 10.10.0 so please make sure your version is higher than that.

npm install -g dat-store

# Alternately you can download the latest release for your platform:
# https://github.com/datproject/dat-store/releases

# Run a store on http://localhost:3282
dat-store run-service

# Add a dat to the dat-store so it's always being shared
dat-store add hyper://0a9e202b8055721bd2bc93b3c9bbc03efdbda9cfee91f01a123fdeaadeba303e/

# Add a folder to the dat-store to create a new archive and copy changes from your folder into it.
dat-store add ./example

# Start synchronizing changes in an archive to a local folder
dat-store clone ./example hyper://example.com

# Configure external storage provider
dat-store set-provider https://hashbase.io/ hashbase
dat-store login yourusername hashbase
dat-store add hyper://0a9e202b8055721bd2bc93b3c9bbc03efdbda9cfee91f01a123fdeaadeba303e/ hashbase

How it works:

  • Uses dat-pinning-service-client to talk to storage providers that adhere to DEP 0003
  • Can start a local storage provider with dat-store run-service
  • Runs on http://localhost:3472. Configure port with --port, configure hostname / network interface with --host.
  • Server logs can be turned off using --verbose false
  • Binds to port 3282 for interacting with the P2P network. This can be configured with the --p2p-port CLI option.
  • The service uses the Dat SDK to manage archives
  • Can work with multiple providers at the same time
  • Listens on /gateway/:key/path to serve files from your achives.

FAQ

Where is stuff stored?

This project makes use of the env-paths module to determine the best place to store data based on the platform.

The config file is stored using the conf module, with the name dat-store. You can override the folder it'll be stored in with the --config-location flag.

The store service is using the data directory, also with the name dat-store. You can override the folder the data will be stored at using the --storage-location flag. You can configure whether the store keeps track of just the latest changes, or the full history with the --latest flag. By default, it will store the entire history.

How do I deal with multiple stores?

dat-store supports multiple remote stores using the optional provider CLI argument. Whenever you add remove or list, you can specify a provider argument to tell the CLI which store it should be talking to. Think of providers as being similar to git remotes. You can add a provider with the dat-store set-provider http://example.com/ PROVIDER_NAME_HERE command.

You can list your currently configured providers with dat-store list-providers.

How do I add a folder?

Depending on where a store is located, there are different ways that it can handle folders.

For locally running stores, you can add a folder which will create a .dat file with the key of your archive and will begin to sync changes from your folder to the archive.

You can also use the clone command with a URL and a folder to create a .dat file with the URL of the cloned archive and begin loading changes from the archive into your folder.

For remote stores, it's a little different. Since a remote store is running on a different computer, it doesn't have a way to access your local folder. In that case, dat-store will find the Dat URL from inside the folder and will send it out to the store like it normally would.

These two modes of operation can be combined together. When you create a dat, add it to your local store. Then add the URL to the remote store. This way, when you make a change to the folder, the local store will update the Dat, and the remote store will get the change and spread it to the rest of the network.

How do I secure my store?

You can require authentication for your dat-store by specifying the --authorization-username and --authorization-password flags when you run the service.

How do I remotely control my store from the Internet?

By default dat-store run-service will only listen on local connections.

If you want to remotely control your service from the Internet, specify the --expose-to-internet flag. This will make the API for adding and removing stores listen on all network interfaces.

This flag is not needed to share or download archives over the Internet, and is only intended for advanced users. You should probably combine this with the authorization flags so that random people don't abuse your store.

NGINX Tips

You should also consider putting your store behind NGINX with a letsecrypt certificate so that "Man In the Middle" attacks can't steal your login credentials or dat URLs.

If you use NGINX, make sure your /etc/nginx/sites-available/your-pinning-server.com server config file looks something like this. For example, to redirect your traffic of mydatstore subdomain to the default port 3472 for dat-store:

server {
  server_name mydatstore.my-pinning-server.com;

  location / {
    proxy_pass http://localhost:3472;
    proxy_set_header    Host            $host;
    proxy_set_header    X-Real-IP       $remote_addr;
    proxy_set_header    X-Forwarded-for $remote_addr;
    port_in_redirect    off;
    proxy_http_version  1.1;
    proxy_set_header    Upgrade         $http_upgrade;
    proxy_set_header    Connection      "Upgrade";
  }

    listen 80;
    listen [::]:80;

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    
    # ... Certbot managed cerificate stuff down here ...#
}

The fastify server will take care of the rest of your serving needs for the store.

Can I access the files in an archive over HTTP?

Yes, you can send requests to the path /gateway/:key/path/to/file. (e.g. http://localhost:42069/gateway/94f0...whatever/index.html) Only archives that are being tracked by the store will be loadable. If you want a general purpose gateway, check out fastify-hyperdrive.

You can use NGINX again to serve the contents of an archive as a top level website with something like the following:

server {
  server_name blog.my-pinning-server.com;

  location / {
    proxy_pass http://localhost:3472/gateway/94f0cab7f60fcc2a711df11c85db5e0594d11e8a3efd04a06f46a3c34d03c418/;
    proxy_set_header    Host            $host;
    proxy_set_header    X-Real-IP       $remote_addr;
    proxy_set_header    X-Forwarded-for $remote_addr;
    port_in_redirect    off;
    proxy_http_version  1.1;
    proxy_set_header    Upgrade         $http_upgrade;
    proxy_set_header    Connection      "Upgrade";
  }

    listen 80;
    listen [::]:80;

    listen [::]:443 ssl; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    
    # ... Certbot managed cerificate stuff down here ...#
}

How do I make it run in the background?

Linux (SystemD)

# Paste this into an interactive bash or zsh shell, or save it as a file and run it with sh.

# This will create the service file.
sudo cat << EOF | sudo tee /etc/systemd/system/dat-store.service > /dev/null
[Unit]
Description=Dat storage provider, keeps dats alive in the background.

[Service]
Type=simple
# Check that dat-store is present at this location
# If it's not, replace the path with its location
ExecStart=$(which dat-store) run-service
Restart=always

[Install]
WantedBy=multi-user.target
EOF

sudo chmod 644 /etc/systemd/system/dat-store.service

sudo systemctl daemon-reload
sudo systemctl enable dat-store
sudo systemctl start dat-store

sudo systemctl status dat-store

Windows (NSSM)

  • Download NSSM
  • Run the GUI with nssm install dat-store
  • For the Path option, navigate to %USERPROFILE%\AppData\Roaming\npm and click on dat-store.bat
  • Set the arguments to run-service
  • In the Login section, have it log in as your account. This is needed so it can have write access to your folders.
  • Set the log location for STDOUT and STDERR so you can debug stuff
  • Enjoy!

To uninstall it, run nssm remove "dat-store"

Commands

dat-store [command]

Commands:
  dat-store add <url|path> [provider]       Add a Dat to your storage provider.
  dat-store clone <path> <url> [provider]   Sync changes from a Dat into a local
                                            folder.
  dat-store remove <url|path> [provider]    Remove a Dat from your storage
                                            provider.
  dat-store list [provider]                 List the Dats in your storage
                                            provider.
  dat-store set-provider <url> [provider]   Set the URL of your storage
                                            provider.
  dat-store get-provider [provider]         Get the URL of your storage
                                            provider.
  dat-store list-providers                  Get the list of providers and their
                                            names
  dat-store unset-provider [provider]       Reset your storage provider to the
                                            default: http://localhost:3472
  dat-store login <username> [provider]     Logs you into your storage provider.
  [password]
  dat-store logout                          Logs you out of your storage
                                            provider.
  dat-store run-service                     Runs a local storage provider.

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

dat-store's People

Contributors

benhylau avatar da2x avatar douganderson444 avatar elonsatoshi avatar jaller94 avatar martinheidegger avatar millette avatar rangermauve avatar todrobbins avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dat-store's Issues

'dat store add' returns an invalid URL error.

Hi all,

I managed to get the systemd script to run, and the status indicates that the service was properly loaded. However, I then tried to add a .dat URL, as follows.

dat store add dat://key

I got the following error. I am pretty sure that the URL is correct because I created it locally. 'dat store list' returns a similar error. Would appreciate any help, thanks!

dat-store add <url|path> [provider]

Add a Dat to your storage provider.

Options:
  --version                  Show version number                       [boolean]
  --help                     Show help                                 [boolean]
  --storage-location         The folder to store dats in
  --port                     The port to use for the HTTP API    [default: 3472]
  --host                     The hostname to make the HTTP server listen on
  --verbose                  Whether the HTTP server should output logs
                                                       [boolean] [default: true]
  --dat-port                 The port to listen for P2P connections on
                                                                 [default: 3282]
  --latest                   Whether to download just the latest changes
                                                      [boolean] [default: false]
  --allow-cors               Allow CORS requests so any website can talk to the
                             store                    [boolean] [default: false]
  --expose-to-internet       Allow connections from the internet, not just the
                             localhost                [boolean] [default: false]
  --authentication-username  Require users to use Basic Auth with this username
                             to connect                   [string] [default: ""]
  --authentication-password  Require users to use Basic Auth with this password
                             to connect                            [default: ""]
  --manifest-timeout         time out if the PDA cannot be read with timeout
                             milliseconds                         [default: 500]

ReferenceError: URL is not defined
    at DatStorageClient._loadPSA (/usr/local/lib/node_modules/dat-store/node_modules/dat-storage-client/index.js:73:21)
    at DatStorageClient._getHref (/usr/local/lib/node_modules/dat-store/node_modules/dat-storage-client/index.js:85:34)
    at DatStorageClient._getDatsPath (/usr/local/lib/node_modules/dat-store/node_modules/dat-storage-client/index.js:103:29)
    at DatStorageClient.add (/usr/local/lib/node_modules/dat-store/node_modules/dat-storage-client/index.js:45:32)
    at StoreClient.add (/usr/local/lib/node_modules/dat-store/client.js:190:24)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
    at Function.Module.runMain (module.js:695:11)
    at startup (bootstrap_node.js:188:16)
    at bootstrap_node.js:609:3

Trouble with install-service on Ubuntu

This is from chat logs, but wanted to post here so it doesn't get lost:

I couldn't run dat store install-service as my regular user (result was EACCES: permission denied, open '/etc/init.d/dat-store'), so I tried sudo but npm complained:

sudo: dat: command not found.

Finally, I had to symlink my version of node to /usr/local via
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/node" "/usr/local/bin/node"
and
sudo ln -s "$NVM_DIR/versions/node/$(nvm version)/bin/npm" "/usr/local/bin/npm"

Then, I can login as root via sudo bash and dat store install-service seemed to succeed.

I also had a small issue with this error: Error: EACCES: permission denied, open '/home/duane/.config/dat-store-nodejs/config.json.2768840111 but a chown -R duane:duane /home/duane/.config/dat-store-nodejs fixed it.

Currently, dat-store seems to be installed, but it is not "working" since it doesn't seem to be publishing the dats that I've added to the store (but dat share works ok).

SSL config with NGINX

Trying not to reinvent the wheel here while working on following the dat-share NGINX setup advice. First time with NGINX 💯

Once I added the SSL with Letsencrypt via CertBot of course it broke everything that was working with http 😒

To set this up right, @RangerMauve how do you set up the SSL on port 3472 ?

... I'm also trying hard to locate where the files are to point that root folder to them, but haven't figured that out yet.

Suggestions appreciated :) I'll gladly PR the README again once I figure this out 💃

add folder support

trying to flesh out a feature for adding directories and not just keys to dat-store

  • ability to add directories with or without existing dat keys
  • ability to have dat-store handle syncing all these local directories to the dat network thereby avoiding issues with multiple instances of dat running on a single computer
  • bonus points : sync level, full , partial or only latest changes ?

Add CI for building binaries

It'd be useful to be able to distribute the utility without requiring that folks set up node.js and NPM and go through all that rigamaroll.

Ideally people should be able to go to the releases page and download the latest version + run it locally.

This might also be useful down the line for integrating with package managers like apt (or one of the billions of Linux alternatives).

Here's a utility that can help: https://github.com/vercel/pkg

A PR for a Github Action would be very much welcome.

Store full history of dat

dat-librarian uses dat-node under the hood. Because it stores the files on disk, it doesn't support the full history. I assumed dat-store did store history but hadn't really thought through it.

We should store history =). Happy to discuss how to best do this. And TBH we should be clearer about this in dat-node, though I would like to store history by default if possible.

I broke dat-store list

I was repeatedly hitting dat-store list about every 3 seconds, to see the list refresh, and then it just stopped working. Weird. I rebooted ubuntu, stopped and restarted the dat-store, all the cycling I could do, the psa doc still serves up, but no listing of the data anymore.

It's strange, have no idea why, I'll see if I can figure it out but it's stumping me.

Updating for hyper:// and an easy install for users

From a discussion in Discord, here are a few ideas that (may) come together:

  • The "closed laptop" problem. I wrote a Beaker+Agregore app; I want to make sure that it loads for anyone who navigates to it; so I can't turn off my computer anymore. :(
  • Neither centralized, nor PC-to-PC, rather: Federated. Desktop and laptop PCs are waning as a consumer platform (in place of smartphones and tablets and streaming TV sticks). Saying your thing is for everyone in the world, but then not having a way to access it from even mobile web, is increasingly problematic.

Here's what were thinking to make:

  • Easy instructions that non server admins can follow to rent a low cost ($5/month) VPS, and type a few commands on the command line, then...
  • navigate a regular browser to your VPS's IP address, where a HTML UI lets you (and only you, the administrator) sign in, where you can...
  • paste in your hyperdrive address, and have your server join the swarm. Now you can turn your computer off 💻😴

Features we can build on this later:

  • More ability to see and limit how much bandwidth your server is using (because really, you just want it there for availability--once a swarm gets going, it's better if everyone just peers bandwidth)
  • Actual HTTP/HTTPs delivery of content from the hyperdrive

From this launchpoint, lots of weird/cool stuff we haven't even thought of yet may be possible. For instance, a blog site where you can get started on either a hyper-enabled browser or a traditional one (that has, in its back-end, one of these federated hyper servers), move your blog back and forth or have it be both places, have super huge files only available on hyper (and thus, turn individual blog content into an on-ramp for new users to the decentralized web)

@RangerMauve @pfrazee

Can’t upload from directories

$ dat store run-service --port=3280 &
$ mkdir test-directory/ && cd test-directory/
$ touch file1 file2 file3
$ dat create --yes=true --dir=./
$ cat dat.json
$ dat store add ./
# then restart the dat-store service
$ cd $(mktemp -d)
$ dat clone dat://dat-key-ecoed-by-cat --port=3282

This never completes. No files are transferred.

Uploads seems to work fine when added via dat store add dat://some-day-key instead of adding a directory.

Support binding to specific interfaces

It should be possible to specify which interfaces to listen on. Say I only want the service listening on 198.51.100.12 and 2001:db8::cafe instead of every available interface on the system.

difficulties with node 11

using node version 10.23.0 this works great for me.

but with node 11.15.0 i get the following error when starting the service.

kale ~ $ dat-store run-service
/home/kale/.nvm/versions/node/v11.15.0/lib/node_modules/dat-store/node_modules/yargs/yargs.js:1172
      else throw err
           ^

ReferenceError: globalThis is not defined
    at Object.<anonymous> (/home/kale/.nvm/versions/node/v11.15.0/lib/node_modules/dat-store/node_modules/queue-microtask/index.js:5:25)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/home/kale/.nvm/versions/node/v11.15.0/lib/node_modules/dat-store/node_modules/avvio/plugin.js:3:24)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)

documentation for configuring service

heya,

I am following the docs to install an os-service (on OSX and Linux).

It's not immediately clear how I would go about configuring the service to use a non-standard directory for data storage.

The docs say that it uses conf and env-paths but it's not clear how I would go about creating a file to modify the default data directory (and where this file lives on disk).

Support multi-hyperdrive

It would be nice to support loading multi-hyperdrives by their hyper:// URLs and automatically downloading data for all of them.

Exec Line in SystemD

Hi

I'm having a bit of trouble regarding this line for the SystemD setup:

ExecStart=/usr/bin/dat-store run-service

Question Part A) If one were to want to use

sudo dat-store install-service --allow-cors --expose-to-internet

...I understand we'd have to tweak the Exec line? Will changing run >to> install + [options] create issues? Any examples I've seen of this always ExecStart a bash script, is that the way to go on this one?

Question Part B) I'm also getting the good old "status=203/EXEC" error in my Digital Ocean VM when I try any of this, haven't quite figured out why, but apparently it has something to do with this line.

Any help/insight would be greatly appreesh! 💃

dat add resolves domain’s Dat key instead of adding the domain as-is

  1. $ dat store run-service --storage-location dat-dir/ &
  2. $ dat store add dat://example.com
  3. $ ls dat-dir/

Actual: seeing the Dat key as it was resolved at the time the domain was added.

Expect: to see example.com in the Dat storage directory listing.

If the domain’s Dat key changes then Dat store should start using the new key. Storing the raw resolved Dat key is only expected when adding a raw Dat key directly. Humans reference domains because they’re easy to remember and they can be updated to point to new locations.

Note: the domain should be resolved by the add command to verify that it has a Dat key and provide errors (good UX). After that then the domain should be re-resolved periodically (the DNS datkey records’ TTL or the .well-known/dat TTL knows how long the key is valid before it should be refreshed – see also this issue. Updating once a day or even on startup is probably good enough for initial support if the TTL is difficult to get.)

Support multiple providers

Based on feedback from @Karissa, it would be useful if we could support having multiple (named) stores in the CLI.

It'd looks something like

dat store set-provider [name] <provider>

dat store add [name] <url>

Where name is the human readable name (kind of like a git branch), and provider is the URL of the provider. If the name isn't supplied, it should be set to default which will be set to localhost by default.

This is a big-ish change so I'd rather get some feedback on whether people want it before implementing.

clone command doesn't seem to work

Running run-service in the background, I've added an archive and it shows up when I list but when I then try to clone it to a dir it doesn't work (parts censored)

% ./bin.js clone ../../../dir/ectory hyper://asdfasdf/
dat-store clone <path> <url> [provider]

Sync changes from a Dat into a local folder.

Options:
  --version                  Show version number                       [boolean]
  --help                     Show help                                 [boolean]
  --storage-location         The folder to store dats in
  --port                     The port to use for the HTTP API    [default: 3472]
  --host                     The hostname to make the HTTP server listen on
  --verbose                  Whether the HTTP server should output logs
                                                       [boolean] [default: true]
  --p2p-port                 The port to listen for P2P connections on
                                                                 [default: 3282]
  --latest                   Whether to download just the latest changes
                                                      [boolean] [default: false]
  --allow-cors               Allow CORS requests so any website can talk to the
                             store                    [boolean] [default: false]
  --expose-to-internet       Allow connections from the internet, not just the
                             localhost                [boolean] [default: false]
  --authentication-username  Require users to use Basic Auth with this username
                             to connect                   [string] [default: ""]
  --authentication-password  Require users to use Basic Auth with this password
                             to connect                            [default: ""]
  --manifest-timeout         time out if the PDA cannot be read with timeout
                             milliseconds                         [default: 500]

TypeError: getService(...).clone is not a function
    at Object.clone [as handler] (/home/me/prj/web/dat-store/index.js:90:26)
    at Object.runCommand (/home/me/prj/web/dat-store/node_modules/yargs/lib/command.js:242:26)
    at Object.parseArgs [as _parseArgs] (/home/me/prj/web/dat-store/node_modules/yargs/yargs.js:1087:30)
    at Object.parse (/home/me/prj/web/dat-store/node_modules/yargs/yargs.js:575:25)
    at module.exports (/home/me/prj/web/dat-store/index.js:74:12)
    at Object.<anonymous> (/home/me/prj/web/dat-store/bin.js:2:14)
    at Module._compile (internal/modules/cjs/loader.js:1256:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10)
    at Module.load (internal/modules/cjs/loader.js:1105:32)
    at Function.Module._load (internal/modules/cjs/loader.js:967:14)

Repo just now cloned and npm i'd

Question: How to host a (read-only) provider?

How can I host my own read-only dat-store provider that others can subscribe to without a login using dat-store set-provider [url] [name]?

The ReadMe only shows how to use hasbase.io accounts as a provider, but i wish to host one myself.

Background

The Dat Installer for Android is a pretty cool project and I hope that dat:// becomes an option in the F-Droid client at some point.
To see how well (or badly) this would work, I plan to mirror the F-Droid repo on the dat protocol. That's roughly 1800 archives to keep track of and serve on at least one peer each.
To allow my servers and others to subscribe to all archives with one command, I am looking to set up a dat-store provider.

port not configurable for `dat store list`

I set the API port to 3500 on the service via dat store run-service --port 3500.

However, when I try to list dat stores, the --port flag seems to be ignored:

$ dat store --port 3500 list
dat-store list [provider]

List the Dats in your storage provider.

Options:
  --version           Show version number                              [boolean]
  --help              Show help                                        [boolean]
  --storage-location  The folder to store dats in
  --port              The port to use for the HTTP API           [default: 3472]
  --host              The hostname to make the HTTP server listen on
  --verbose           Whether the HTTP server should output logs
                                                       [boolean] [default: true]
  --dat-port          The port to listen for P2P connections on  [default: 3282]
  --latest            Whether to download just the latest changes
                                                      [boolean] [default: false]

Error: Could not connect to service http://localhost:3472
Make sure you have a local service running with 'dat store install-service'
Also check if the remote service you have configured is online
    at StoreClient.init (/home/duane/.nvm/versions/node/v10.15.3/lib/node_modules/dat-store/client.js:146:36)
    at process._tickCallback (internal/process/next_tick.js:68:7)

I also tried dat store list --port 3500

install-service doesn't work on macos

The command dat store install-serviceresults in:

/usr/local/lib/node_modules/dat-store/index.js:126
    if (e) throw e
           ^

Error: writeFile(/etc/init.d/dat-store) failed: ENOENT: no such file or directory, open '/etc/init.d/dat-store'
    at /usr/local/lib/node_modules/dat-store/node_modules/os-service/index.js:293:11
    at fs.open (fs.js:1190:7)
    at FSReqCallback.args [as oncomplete] (fs.js:145:20)

macOS 10.14.4
node v11.14.0

suggestion for dat-store

Hello,

We are considering this P2P "dat" project for https://encycloreader.org It is possible to build a downloadable zip file for dat-store that can be unpacked and run without admin privileges on Linux, similar to the "dat" project? This command "npm install -g dat-store" requires sudo.

S.C.

Some usability issues with dat-store and local folders

Hello @RangerMauve,

Here some observations I had trying to use dat-store. Those might not be bugs at all, so feel free to close!

I am running the dat-store service as an unprivileged (nodejs) user, in order to contain any possible damage... When I am running dat-store add . on a directory as my main user, I am getting the following error

{ Error: socket hang up
    at createHangUpError (_http_client.js:323:15)
    at Socket.socketOnEnd (_http_client.js:426:23)
    at Socket.emit (events.js:203:15)
    at endReadableNT (_stream_readable.js:1145:12)
    at process._tickCallback (internal/process/next_tick.js:63:19) code: 'ECONNRESET' }

This is caused by the service user not being able to write to the files in /.dat. It starts working when I set mode 0666 on all files inside /.dat. Perhaps a more descriptive error message could help young players (like myself)? (I hadn't initially considered permissions to be an issue, since I was running the dat-store command in the context of my main user that also owned the files.)

Secondly: I presumed that The store will load up the dat archive inside your folder, watch for changes, and share them with the rest of the network. would mean that the dat-store service would watch for files that get modified in the directory, and automatically add them to the Dat archive, but it looks like one still manually does dat sync?

Thanks & best

SDK pull a hypercore from dat-store?

Hi,

Does dat-store also pin hypercores easily?

I'm able to add hypercore url to the dat-store, but not seeing them appear as a peer with the Hypercore discovery extension. Wondering if the dat-store supports hypercore discovery, or just hyperdrive.

I'm thinking if I can get the SDK to pull a hypercore from dat-store, then I could more easily replicate the hypertrie without all the complex discovery,peer,pipe,ws,stream messiness.

Thoughts?

  // hypercore(storage, [key], [options])
  const feed = new Hypercore(rawStorage, myPinnedHypercoreURL, {
    persist: true,
    extensions: ['discovery']
  })

  feed.on('peer-add', (peer) => {
    console.log('Got a peer!')   //never fires for pinned hypercore :(

   // read the pinned hypercore
  // make a hypertrie from the downloaded hypercore 

  })
})

Request: Percentage of dat completed

One more and I'll get out of the way, any chance of adding an additional command to view the percentage completed of each dat, or possibly adding it as part of the dat-store list command?

Unable to install dat-store with npm

This is what happens when I try to install it:

% sudo npm install -g dat-store
/usr/local/bin/dat-store -> /usr/local/lib/node_modules/dat-store/bin.js

> [email protected] install /usr/local/lib/node_modules/dat-store/node_modules/fd-lock
> node-gyp-build


> [email protected] install /usr/local/lib/node_modules/dat-store/node_modules/sodium-native
> node-gyp-build "node preinstall.js" "node postinstall.js"


> [email protected] install /usr/local/lib/node_modules/dat-store/node_modules/utp-native
> node-gyp-build


> [email protected] install /usr/local/lib/node_modules/dat-store/node_modules/os-service
> node-gyp rebuild

gyp WARN EACCES current user ("nobody") does not have permission to access the dev dir "/root/.cache/node-gyp/10.15.2"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/dat-store/node_modules/os-service/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/dat-store/node_modules/os-service/.node-gyp'
gyp ERR! System Linux 4.19.0-6-amd64
gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/dat-store/node_modules/os-service
gyp ERR! node -v v10.15.2
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-11-14T01_04_46_654Z-debug.log

Operating system is Debian 10. What am I doing wrong here?

The "url" argument must be of type string. Received type object

dat store add dat://daniel.priv.no/

TypeError [ERR_INVALID_ARG_TYPE]: The "url" argument must be of type string. Received type object
    at Url.parse (url.js:154:11)
    at urlParse (url.js:148:13)
    at /usr/lib/node_modules/dat-store/node_modules/dat-pinning-service-client/index.js:143:16
    at DatPinningServiceClient.addDat (/usr/lib/node_modules/dat-store/node_modules/dat-pinning-service-client/index.js:90:90)
    at Promise (internal/util.js:275:30)
    at new Promise (<anonymous>)
    at DatPinningServiceClient.addDat (internal/util.js:274:12)
    at StoreClient.callClient (/usr/lib/node_modules/dat-store/client.js:67:48)
    at StoreClient.add (/usr/lib/node_modules/dat-store/client.js:116:17)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Document implications of running a storage provider

When running a storage provider, an HTTP endpoint ist exposed that lists all stored dats. As the keys of the dats are included in this list, that means that by running a storage provider and adding dats to it, you basically make these dats public. That might not be what users intend to do (they might assume that by adding a dat to a storage provider, it would remain private as long as the key is not published in another way. Therefore, the current behaviour should be documented, and maybe even made optional (or possibly add some token based authentication or similar).

Possible reconnect issue on partially downloaded .dat

Hey Ranger, just installed dat-store and am running into a potential issue where if a reboot or some kind of interruption on initial download happens, there doesn't seem to be an attempt to reconnect to finish the download. Yet if another (new) .dat url the download will kick up on that one no issue.

The full .dats I am attempting to download from are both stored on separate cli and homebase instances if that matters at all. So they should be served correctly on the local network.

Love the new tool to work with, and appreciate all the work put into it.

Edit: Even after a full download seems like the same issue

Edit: ended up dats being served were on a different subnet. Served dats are on 10.0.10.x, dat-store instance on 192.168.0.x. Initial download works fantastic but cannot seem to reconnect. Removed the dat-store instance from the 192.168.0.x network and added to the 10.0.10.x network and the reconnect is working no problem.

Sorry about all the edits, I should have worked this out before I opened the issue.

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.