Your own dropbox with a Raspberry Pi

Sparkleshare OS X client

Create your own Dropbox-like solution with a Raspberry Pi and the Sparkleshare open source solution.

SparkleShare creates a special folder, called a repository, on your computer. You can add remotely hosted folders (or “projects”) to this folder. These projects will be automatically kept in sync with both the host and all of your peers when someone adds, removes or edits a file.

Raspberry Pi dropbox alternative

Raspberry Pi dropbox alternative

The RPi is managed headless from within a SSH session. Follows the steps taken to install Sparkleshare and the web dashboard. Starting from a Pi having Raspbian Wheezy installed.

Here it is powered from the cable-modem USB port and connected to the modem’s free Ethernet port. If you want to access your repository over the Net and not only on your LAN, setup port forwarding on your modem for ports 22, 80, 443 and optionally 3000 (for the dashboard) too.

Scripts and stylesheets used:

SparkleShare installation:

# ------------
# SparkleShare
# ------------
pi$ curl 
> --output /usr/bin/dazzle && chmod +x /usr/bin/dazzle
pi$ sudo dazzle setup
# create your projects
pi$ sudo dazzle create private
pi$ sudo dazzle create public
pi$ sudo vi /home/storage/.ssh/authorized_keys
[add ssh key for each connected user@computer]
# Optionally edit the list of files to ignore (e.g. Mac OS X .DS_store and .lock files) or edit .gitignore, see <a href="">git exclude files</a>
pi$ sudo vi /.git/info/exclude

[2014-10-05 Update]
Moving it to another Pi somehow broke the dashboard. Downgrading some npm packages fixed it. These are the versions used:

pi$ npm install redis@0.12.1
pi$ npm install connect-redis@1.4.7
pi$ npm install express@2.5
pi$ npm install jade@0.35.0

Also there exist APT packages for Redis and latest NodeJS (from meadhbh blog), so you don’t have to build these from source:

pi$ sudo apt-get install redis
pi@raspberrypi ~ $ sudo -s
root@raspberrypi:/home/pi# echo "deb wheezy main" >> /etc/apt/sources.list # add meadhbh's repository
root@raspberrypi:/home/pi# exit
pi$ sudo apt-get remove nodejs
pi$ sudo apt-get autoremove
pi$ sudo apt-get install nodejs-latest


Install NodeJS webserver:

# ------
# NodeJS
# ------
pi$ sudo mkdir /opt/node
pi$ sudo wget
pi$ sudo tar xvzf node-v0.10.2-linux-arm-pi.tar.gz
pi$ sudo cp -r node-v0.10.2-linux-arm-pi/* /opt/node
# add Node.JS to the path variable, before the 'export PATH' line
pi$ sudo vi /etc/profile
export PATH
# copy <a href=""></a> to /etc/init.d, using FTP
pi$ chmod 755 /etc/init.d/
pi$ sudo update-rc.d defaults
# The ‘server.js’ file is just a simple Node.JS server which will listen on
# port 8080 and display ‘Hello World’ and write some output to the console
pi$ mkdir /home/pi/app
pi$ put <a href="">server.js</a> into the app dir (using vi or Ftp)
# start the webserver
pi$ sudo /etc/init.d/ start
# and test it using a browser:
https://:8080 or https://:8080

Redis database server installation:

# -----
# Redis
# -----
pi$ cd ~
pi$ sudo wget
pi$ sudo tar xzf redis-2.6.16.tar.gz
pi$ cd redis-2.6.1616
pi$ sudo make
pi$ sudo make test
# have a coffee break (&gt;25min) after all it's only a Pi
pi$ sudo make install
pi$ sudo cp redis.conf /etc/redis.conf
[ pi$ sudo cp src/redis-server /usr/local/bin/ ]
pi$ sudo vi /etc/redis.conf
#daemonize no
daemonize yes
# no log, to reduce SD card i/o
logfile stdout
#logfile /var/log/redis.log
# dump.rdb path
#dir ./
dir /home/pi/
# testrun
pi$ redis-server
pi$ redis-cli time
# copy the <a href=""></a> script to /etc/init.d
pi$ chmod 755 /etc/init.d/
pi$ sudo update-rc.d defaults 98 02

Network Package Manager:

# -----------------------------
# Network Package Manager (NPM)
# -----------------------------
pi$ cd ~
pi$ sudo curl | sh

SparkleShare web interface installation:

# ----------------------
# SparkleShare-dashboard
# ----------------------
# install dependencies with NPM
pi$ npm install express@2.5 express-messages i18n jade connect-redis redis sass mime
pi$ cd ~
pi$ git clone
pi$ cd sparkleshare-dashboard
pi$ sudo /opt/node/bin/npm install express@2.5 express-messages i18n jade connect-redis redis sass mime
# install the node_modules
pi$ cd sparkleshare-dashboard
pi$ npm install -d
# copy the <a href=""></a> script to /etc/init.d
pi$ chmod 755 /etc/init.d/
pi$ sudo update-rc.d defaults 98 02
# add user pi to the ‘storage’ group (to allow access via alias)
pi$ sudo adduser pi storage
# symlinks to the repo's
pi$ sudo ln -s /home/storage/private /home/pi/sparkleshare-dashboard/private_x
pi$ sudo ln -s /home/storage/public /home/pi/sparkleshare-dashboard/public_x
# edit (the alias to) the folders shown in the dashboard
pi$ sudo vi ~/sparkleshare-dashboard/config.js
  { type: 'git', name: 'Public GIT folder', path: '/home/pi/sparkleshare-dashboard/public_x', pub: true },
  { type: 'git', name: 'Private GIT folder', path: '/home/pi/sparkleshare-dashboard/private_x', pub: false }
# test (from within the ssh session)
pi$ sudo /etc/init.d/sparkleshare-dashboard start > /dev/null 2>&1 &
# if all went well, reboot the Pi
pi$ sudo shutdown -r now
# to conclude, if you have to switch off your Pi,
# switch it off gracefully
pi$ sudo shutdown -h now