Since Dat is a distributed (peer-to-peer) data sharing tool, a computer must be actively sharing a dat for it to be available. If you're sharing files over Dat, you might want to set up a dedicated server that re-hosts your dat. This means that it'll still be available even after you turn off your personal computer.
Running Dat on a server can also be used for live backups. As long as you are connected to your server and syncing changes, your server can backup all of your content history - allowing you to view old content later.
We have built a tool into the Dat CLI called
dat store which enables you to set up a server to keep your Dats online. The tool also enables you to interact with servers that adhere to the HTTP Pinning Service API.
npm install -g dat dat-store dat store install-service dat store dat://64375abb733a62fa301b1f124427e825d292a6d3ba25a26c9d4303a7987bec65
If you don't have Node installed please follow the installation instructions for your platform here.
Check your node version, you should have version 4.0 or higher, but 6.10.3 or higher is preferred.
$ node -v
Install The CLI
Then, go to your server (using
ssh email@example.com) and install
dat and the
npm install -g dat dat-store
Start A Dat Store
Once the CLI is installed, you can run a Dat Store which will be used for to keep a list of Dats online. By default, it will run on http://localhost:3472
dat store run-service
By default, it will store the data for Dats inside
This can be overridden with the
dat store run-service --storage-location /example/location
You can interact with the store using the CLI.
dat store dat://64375abb733a62fa301b1f124427e825d292a6d3ba25a26c9d4303a7987bec65 dat store add dat://datproject.org
You can list all the Dats that are in the store:
dat store list
You can also remove Dats from the store
dat store remove dat://datproject.org
Run It Forever
You can install the Store to run as a service on the current machine. This is handled by the os-service module which supports Linux, Mac, and Windows.
dat store install-service
The service will be called
dat-store and can be managed by your operating system as you would any other service. To start and stop the service, you'll need to look into the specific commands for your operating system. For example, on Linux with Systemd you can use
sudo systemctl stop dat-store to stop the service and
sudo systemctl start dat-store to start it up again.
You can uninstall the service when you no longer need it.
dat store uninstall-service
You can configure the CLI to connect to a store that's running on another machine.
dat store set-provider http://192.168.1.1:3472
This can be used to share a Store between members of a community or company.
The provider URL and session token are stored in
~/.dat/store.json and are used for any dats.
Note that the CLI currently on supports having a single provider at a time.
If you'd like to have multiple providers, please comment on this issue with your use case.
It's strongly advised to layer some sort of authentication and HTTPS on top of the service if you want it to be accessible over the internet.
If you want a more advanced Store that has authentication built in, check out Homebase
Members of the Dat community have created Hashbase which is public Dat store that anybody can use.
To set it up with the CLI, you'll need to [create an account].
Then you'll need to point the CLI at Hashbase.
dat store set-provider https://hashbase.io
And finally, you'll need to log into Hashbase from the CLI
dat store login YOU_USERNAME_HERE
After this is ready, your calls to
dat store will automatically add your Dats to Hashbase which will make sure your content is kept online.