\title{Smallworld: Gossiping with Raspberry Pis Locally}
\title{Smallworld: Adding Dat support}
\author{Paulette Vazquez and Guilhem Niot}
\author{Paulette Vazquez and Guilhem Niot}
\supervisor{Dr. Erick Lavoie}
\supervisor{Dr. Erick Lavoie}
\adviser{Professor Anne-Marie Kermarrec}
\adviser{Professor Anne-Marie Kermarrec}
...
@@ -41,19 +41,28 @@
...
@@ -41,19 +41,28 @@
\begin{document}
\begin{document}
\maketitle
\maketitle
\maketoc
% \maketoc
\chapter{Another application: Dat Protocol}
\section{Another application: Dat Protocol}
Dat Protocol is a peer-to-peer protocol that allows sharing files in a distributed network.
% TODO: add ref + why is it different from SSB
% both built on append only logs, but Dat more active, and mature libraries
% TODO: high level motivation
The Dat Protocol [ref] is a peer-to-peer protocol that allows sharing files in a distributed network.
It differs from BitTorrent in that contents can be updated by their author.
It differs from BitTorrent in that contents can be updated by their author.
\section{Installation}
\subsection{Installation}
The installation of Dat is quite straightforward. The dat-cli command utility allows to simply interact with Dat files. The commands in Figure \ref{cmd:dat_install} are used to install dat-cli.
% TODO: what we've achieved in the report: brings a service that is similar to something like Dropbox, with different
% TODO: try replicating remotely
% TODO: explain what's dat-cli, why we use it
% TODO: Remove dat-cli
The installation of Dat is quite straightforward. The commands in \ref{cmd:dat_install} are used to install dat-cli.
It must be installed on both the emitter and the receiver devices.
It must be installed on both the emitter and the receiver devices.
...
@@ -66,34 +75,33 @@ It must be installed on both the emitter and the receiver devices.
...
@@ -66,34 +75,33 @@ It must be installed on both the emitter and the receiver devices.
\end{lstlisting}
\end{lstlisting}
\end{figure}
\end{figure}
\section{Using dat}
\subsection{Using dat}
The dat-cli command utility allows to simply interact with Dat files.
It is possible to create a shared folder using \emph{dat share} in the folder to share. This command will give a dat url starting with \emph{dat://} that can be used to retrieve the files on other clients.
% It is possible to create a shared folder using \emph{dat share} in the folder to share. This command will give a dat url starting with \emph{dat://} that can be used to retrieve the files on other clients.
A set of useful commands:
% A set of useful commands:
\begin{itemize}
% \begin{itemize}
\item\emph{dat share}, to share a folder (starts a daemon that waits for incoming connexions)
% \item \emph{dat share}, to share a folder (starts a daemon that waits for incoming connexions)
\item\emph{dat sync}, tries to retrieve newer version of the files, and share the files for incoming connexions
% \item \emph{dat sync}, tries to retrieve newer version of the files, and share the files for incoming connexions
\item\emph{dat clone <url> <folder>}, retrieves files from a dat url
% \item \emph{dat clone <url> <folder>}, retrieves files from a dat url
\item\emph{dat pull}, tries to retrieve a newer version of the files
% \item \emph{dat pull}, tries to retrieve a newer version of the files
\end{itemize}
% \end{itemize}
\subsection{Real time synchronization with dat-share}
\subsubsection{Real time synchronization with dat-store}
% TODO: what's dat-store: reverse the order of the following
A tool to do just that is \emph{dat-store}. It provides a service that can be run in background, can be remotely controlled, and does all the work for you.
Dat does not directly provide a daemon to run in background and automatically synchronize folders for you. \\
On the opposite, Dat does not directly provide a daemon to run in background and automatically synchronize folders for you. \\
A tool to do just that is \emph{dat-store}. It provides a service that can be run in background, can be remotely controlled, and does all the work for you.
It should be installed on both the client and the Raspberry Pi using
It should be installed on both the client and the Raspberry Pi using
\begin{lstlisting}
\begin{lstlisting}
npm install -g dat-store
npm install -g dat-store
\end{lstlisting}
\end{lstlisting}
\textbf{Note:} In case you have permission errors, you should NOT try running it with sudo. The correct solution is to fix the permissions of your npm installation. See the \href{https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory}{manual guide}.
\textbf{Note:} In case you have permission errors, you may need to fix the permissions of your NPM installations. See the \href{https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally#manually-change-npms-default-directory}{manual guide}. Using sudo instead won't fix the problem. \\
You should then configure a systemd service to run the store in background. The configuration on the user's device is done according to figure\ref{cmd:dat_store_systemd_user}. The configuration on the Raspberry Pi is achieved following figure\ref{cmd:dat_store_systemd_rasp}.
You should then configure a systemd service to run the store in background. You have to configure both your device and the Raspberry Pi. For the user device you can follow Configuration\ref{cmd:dat_store_systemd_user}. For the Raspberry Pi you can follow Configuration\ref{cmd:dat_store_systemd_rasp}.
\begin{figure}
\begin{figure}
\begin{lstlisting}[label=cmd:dat_store_systemd_user, caption=Configure dat-store systemd service on the user device]
\begin{lstlisting}[label=cmd:dat_store_systemd_user, caption=Configure dat-store systemd service on the user device]
...
@@ -153,16 +161,20 @@ sudo systemctl status dat-store
...
@@ -153,16 +161,20 @@ sudo systemctl status dat-store
\end{lstlisting}
\end{lstlisting}
\end{figure}
\end{figure}
Dat-store uses the concept of provider. Providers are instances of dat-store running either locally or remotely. The default one is your local instance, but you can also configure other providers, like the Raspberry Pi. \\
% TODO: explain during the introduction of dat-store
Dat-store introduces the concept of provider. Providers are instances of dat-store running either locally or remotely. The default one is your local instance, but you can also configure other providers, like the Raspberry Pi. \\
This notion is particularly useful for remote control of other providers. \\
This notion is particularly useful for remote control of other providers. \\
Dat-store provides interesting commands that we will use in our demo:
%TODO: add reference
Dat-store provides interesting commands that we will use in our demo: [reference]
\begin{itemize}
\begin{itemize}
\item\emph{dat-store add <url|path> [provider]}: Adds a folder or a dat url to the dat-store of the specified provider.
\item\emph{dat-store add <url|path> [provider]}: Adds a folder or a dat url to the dat-store of the specified provider.
\item\emph{dat-store set-provider <url> [provider]}: Sets the url of the specified provider.
\item\emph{dat-store set-provider <url> [provider]}: Sets the url of the specified provider.
\item\emph{dat-store list [provider]}: Retrieves the list of available Dats in the specified provider.
\item\emph{dat-store list [provider]}: Retrieves the list of available Dats in the specified provider.
\item\emph{dat-store clone <path> <url> [provider]}: Clones \emph{<url>} into a local folder.
\item\emph{dat-store clone <path> <url> [provider]}: Clones \emph{<url>} into a local folder.
\end{itemize}
\end{itemize}
% TODO: Remove the chapter numbers
% TODO: move to introduction,, this report will describe how to use Dat as if it was a dropbox like service and we will cover the case where we replicate between A and B where the rasp is an intermediary.
We can then imagine the case where we have two clients A and B and one Raspberry Pi used as a permanent store to synchronize a folder from A to B.
We can then imagine the case where we have two clients A and B and one Raspberry Pi used as a permanent store to synchronize a folder from A to B.
...
@@ -193,3 +205,7 @@ Then, client B executes:
...
@@ -193,3 +205,7 @@ Then, client B executes:
\printbibliography
\printbibliography
\end{document}
\end{document}
% TODO: talk about pushpin + reference and what we've observed: that it didn't sync well + npm issue on rasp
% TODO: need for knowing when the replication is done, state + motivate the problem, sketch the solutions