Skip to content
Snippets Groups Projects
Commit 5003b864 authored by Guilhem Niot's avatar Guilhem Niot
Browse files

Initialize the repository

parents
No related branches found
No related tags found
No related merge requests found
/*.aux
/*.bbl
/*.bcf
/*.run.xml
/*.toc
/*.blg
/*.log
/*.out
/*.fdb_latexmk
/*.fls
/*.synctex.gz
EPFLlogo.png

5.06 KiB

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% EPFL report package
% Goal: provide formatting for theses and project reports
% Author: Mathias Payer <mathias.payer@epfl.ch>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ProvidesPackage{EPFLreport}
\usepackage[absolute]{textpos}
\usepackage{graphicx}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[tracking=true,kerning=true,spacing=true]{microtype}
\usepackage[DIV=14,BCOR=2mm,headinclude=true,footinclude=false]{typearea}
\usepackage[
backend=biber,
style=numeric-comp,
hyperref=true,
%style=numeric,
%sorting=ydnt,
defernumbers=true,
maxbibnames=99,
]{biblatex}
\addbibresource{thesis.bib}
\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{8000}
\sloppy
\usepackage[french,german,english]{babel}
\usepackage{utopia}
\usepackage{setspace} % slightly larger spacing
\setstretch{1.1}
\usepackage{hyperref}
\hypersetup{pdfborder={0 0 0}, colorlinks=true, linkcolor=black, citecolor=black, urlcolor=black}
\newif\if@epflmscthesis
\newif\if@epflbscthesis
\newif\if@epflmscproject
\newif\if@epflbscproject
\DeclareOption{MScThesis}{\@epflmscthesistrue}
\DeclareOption{BScThesis}{\@epflbscthesistrue}
\DeclareOption{MScProject}{\@epflmscprojecttrue}
\DeclareOption{BScProject}{\@epflbscprojecttrue}
\newif\if@lablogo
\DeclareOption{lablogo}{\@lablogotrue}
\ProcessOptions\relax
\newcommand{\projectterm}{Project Report}
\if@epflmscthesis
\renewcommand{\projectterm}{Master Thesis}
\fi
\if@epflbscthesis
\renewcommand{\projectterm}{Bachelor Thesis}
\fi
\if@epflmscproject
\renewcommand{\projectterm}{Master Project Report}
\fi
\if@epflbscproject
\renewcommand{\projectterm}{Bachelor Project Report}
\fi
\def\@adviser{Thesis Advisor}
\newcommand{\adviser}[1]{
\def\@adviser{#1}
}
\def\@supervisor{Thesis Supervisor}
\newcommand{\supervisor}[1]{
\def\@supervisor{#1}
}
\def\@expert{Expert Reviewer}
\newcommand{\expert}[1]{
\def\@expert{#1}
}
\def\maketitle{\par
\begingroup
\renewcommand\thefootnote{\fnsymbol{footnote}}%
\def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
\long\def\@makefntext##1{\parindent 1em\noindent
\hbox to1.8em{\hss$\m@th^{\@thefnmark}$}##1}%
\if@twocolumn
\twocolumn[\@maketitle]%
\else \newpage
\global\@topnum\z@
\@maketitle \fi\@thanks
\endgroup
\setcounter{footnote}{0}%
\let\maketitle\relax
\let\@maketitle\relax
\let\thanks\relax}
\def\@maketitle{
\setlength{\parindent}{0pt}
\setlength{\parskip}{0pt}
\newlength{\drop}
\newlength{\tpheight}\setlength{\tpheight}{0.9\textheight}
\newlength{\txtheight}\setlength{\txtheight}{0.9\tpheight}
\begingroup
\thispagestyle{empty}
\drop=0.1\txtheight
\begin{textblock*}{4in}[0.3066,0.39](1.5in,0.85in)
\includegraphics[width=2.5in]{EPFLlogo}
\end{textblock*}
\if@lablogo
\begin{textblock*}{4in}[0.3066,0.39](5.7in,0.85in)
% \includegraphics[width=3in]{LABlogo}
\end{textblock*}
\fi
\vspace*{\drop}
\centering
{\LARGE École Polytechnique Fédérale de Lausanne}\\[2\baselineskip]
{\LARGE\sffamily \@title}\\[2\baselineskip]
by \@author\par
\vfill
{\LARGE \projectterm}\par
\vspace{\drop}
\centering
\@adviser\\
Project Advisor \\[1\baselineskip]
\@supervisor\\
Project Supervisor\par
\centering
\vspace{4\baselineskip}
EPFL IC IINFCOM SaCS \\
BC Building, Office BC 347 \\
CH-1015 Lausanne \\
Switzerland \\[\baselineskip]
\today
\par
\vfill
\endgroup
}
\def\@dedication{%
\begin{raggedleft}
Follow the white rabbit...\\
--- The Matrix\\
\end{raggedleft}
\vspace{4cm}
\begin{center}
Dedicated to my pet bunny.
\end{center}
The dedication is usually a short inspirational quote.
Define your dedication in \texttt{\textbackslash{}dedication\{...\}}
and show them with \texttt{\textbackslash{}makededication}.
}
\newcommand{\dedication}[1]{
\def\@dedication{#1}
}
\def\makededication{\par
% Dedication and acknowledgments
\cleardoublepage
\thispagestyle{empty}
\vspace*{3cm}
\@dedication
\setcounter{page}{0}
}
\def\@acknowledgments{%
This is where you thank those who supported you on this journey. Good examples
are your significant other, family, advisers, and other parties that inspired
you during this project. Generally this section is about 1/2 page to a page.
Consider acknowledging the use and location of this thesis package.
Define your acknowledgments in \texttt{\textbackslash{}acknowledgments\{...\}}
and show them with \texttt{\textbackslash{}makeacks}.
}
\newcommand{\acknowledgments}[1]{
\def\@acknowledgments{#1}
}
\def\makeacks{\par
% Achnowledgments
\cleardoublepage
\chapter*{Acknowledgments}
\markboth{Acknowledgments}{Acknowledgments}
\addcontentsline{toc}{chapter}{Acknowledgments}
\@acknowledgments
\bigskip
\noindent\textit{Lausanne, \today}
\hfill \@author
}
\def\abstract{\cleardoublepage
\chapter*{Abstract}
\markboth{Abstract}{Abstract}
\addcontentsline{toc}{chapter}{Abstract (English/Français)}}
\def\endabstract{}
\def\frenchabstract{\begin{otherlanguage}{french}
\cleardoublepage
\chapter*{Résumé}
\markboth{Résumé}{Résumé}}
\def\endfrenchabstract{\end{otherlanguage}}
\def\maketoc{
\cleardoublepage
\pdfbookmark{\contentsname}{toc}
\tableofcontents
\setlength{\parskip}{1em}
}
\endinput
name=thesis
all: *.tex *.bib
rubber --pdf $(name).tex
clean:
rubber --clean --pdf $(name).tex
# Smallworld initial project report
The code is available at https://github.com/rkuenzi-epfl/smallworld
It uses the template available at https://github.com/HexHive/thesis_template
File added
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% EPFL report package, main thesis file
% Goal: provide formatting for theses and project reports
% Author: Mathias Payer <mathias.payer@epfl.ch>
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,11pt,oneside]{report}
% Options: MScThesis, BScThesis, MScProject, BScProject
\usepackage[BScProject,lablogo]{EPFLreport}
\usepackage{xspace}
\usepackage{listings}
\usepackage{caption}
\usepackage{subcaption}
\renewcommand{\lstlistingname}{Configuration}
\lstset{
basicstyle=\footnotesize\ttfamily,
columns=flexible,
literate={-}{-}1,
breaklines=true,
}
\lstset{captionpos=b}
\AtBeginDocument{\def\chapterautorefname{Chapter}}
\AtBeginDocument{\def\sectionautorefname{Section}}%
\AtBeginDocument{\def\subsectionautorefname{Subsection}}%
%
\title{Smallworld: Gossiping with Raspberry Pis Locally}
\author{Paulette Vazquez and Guilhem Niot}
\supervisor{Dr. Erick Lavoie}
\adviser{Professor Anne-Marie Kermarrec}
\newcommand{\sysname}{FooSystem\xspace}
\begin{document}
\maketitle
\maketoc
\chapter{Another application: Dat Protocol}
Dat Protocol 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.
\section{Installation}
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.
\begin{figure}
\begin{lstlisting}[label=cmd:dat_install, caption=Installing dat-cli]
wget -qO- https://raw.githubusercontent.com/datproject/dat/master/download.sh | bash
# or
npm -g dat-cli
\end{lstlisting}
\end{figure}
\section{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.
A set of useful commands:
\begin{itemize}
\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 clone <url> <folder>}, retrieves files from a dat url
\item \emph{dat pull}, tries to retrieve a newer version of the files
\end{itemize}
\subsection{Real time synchronization with dat-share}
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
\begin{lstlisting}
npm install -g dat-store
\end{lstlisting}
You should then configure a systemd service to run the store in background. The configuration on the user's device is
\begin{figure}
\begin{lstlisting}[label=cmd:dat_store_systemd_user, caption=Configure dat-store systemd service on the user device]
# 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
\end{lstlisting}
\end{figure}
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}.
\begin{figure}
\begin{lstlisting}[label=cmd:dat_store_systemd_rasp, caption=Configure dat-store systemd service on the raspberry pi]
# This will create the service file.
sudo cat << EOF | sudo tee /etc/systemd/system/dat-store.service > /dev/null
[Unit]
Description=Dat storage provider exposed to the internet (for the raspberry pi).
[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 --expose-to-internet
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
\end{lstlisting}
\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. \\
This notion is particularly useful for remote control of other providers. \\
Dat-store provides interesting commands that we will use in our demo:
\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 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 clone <path> <url> [provider]}: Clones \emph{<url>} into a local folder.
\end{itemize}
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.
First, A executes the following commands:
\begin{lstlisting}[label=cmd:dat_store_example_A, caption=Commands executed by client A]
dat-store set-provider http://raspberry.local:3472 raspberry
mkdir mydat
dat-store add ./mydat
dat-store add ./mydat raspberry
\end{lstlisting}
Then, client B executes:
\begin{lstlisting}[label=cmd:dat_store_example_A, caption=Commands executed by client A]
dat-store list raspberry
dat-store clone ./mydat <url obtained from the previous command>
\end{lstlisting}
\cleardoublepage
\phantomsection
\addcontentsline{toc}{chapter}{Bibliography}
\printbibliography
\end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment