{"id":78,"date":"2013-11-17T15:10:18","date_gmt":"2013-11-17T14:10:18","guid":{"rendered":"http:\/\/localhost\/~johan\/wordpress\/?p=78"},"modified":"2014-10-05T20:57:38","modified_gmt":"2014-10-05T18:57:38","slug":"your-own-dropbox-with-a-raspberry-pi","status":"publish","type":"post","link":"https:\/\/www.chaosgeordend.nl\/wordpress\/2013\/11\/17\/your-own-dropbox-with-a-raspberry-pi\/","title":{"rendered":"Your own dropbox with a Raspberry Pi"},"content":{"rendered":"<div id=\"entry_img\"><a href=\"https:\/\/www.chaosgeordend.nl\/mt-blog-cg\/images\/SparkleShare_client_OSX.png\" rel=\"lightbox[78]\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.chaosgeordend.nl\/mt-blog-cg\/images\/thumbnails\/SparkleShare_client_OSX.png\" alt=\"Sparkleshare OS X client\" \/><\/a><\/div>\n<p>Create your own Dropbox-like solution with a Raspberry Pi and the Sparkleshare open source solution.<\/p>\n<p>SparkleShare creates a special folder, called a repository, on your computer. You can add remotely hosted folders (or &#8220;projects&#8221;) 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.<\/p>\n<p><!--more--><\/p>\n<div id=\"entry_img\"><a href=\"https:\/\/www.chaosgeordend.nl\/mt-blog-cg\/images\/SparkleShare-dashboard.jpg\" rel=\"lightbox[78]\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.chaosgeordend.nl\/mt-blog-cg\/images\/thumbnails\/SparkleShare-dashboard.jpg\" alt=\"Raspberry Pi dropbox alternative\" \/><\/a><br \/>\n<a href=\"https:\/\/www.chaosgeordend.nl\/mt-blog-cg\/images\/Sparkleshare_RPi.jpg\" rel=\"lightbox[78]\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/www.chaosgeordend.nl\/mt-blog-cg\/images\/thumbnails\/Sparkleshare_RPi.jpg\" alt=\"Raspberry Pi dropbox alternative\" \/><\/a><\/div>\n<p>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.<\/p>\n<p>Here it is powered from the cable-modem USB port and connected to the modem&#8217;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.<\/p>\n<p>Scripts and stylesheets used:<\/p>\n<ul>\n<li><a href=\"https:\/\/www.chaosgeordend.nl\/documents\/nodejs.sh\">nodejs.sh<\/a><\/li>\n<li><a href=\"https:\/\/www.chaosgeordend.nl\/documents\/sparkleshare-dashboard.sh\">sparkleshare-dashboard.sh<\/a><\/li>\n<li><a href=\"https:\/\/www.chaosgeordend.nl\/documents\/redis-server-init.sh\">redis-server-init.sh<\/a><\/li>\n<li><a href=\"https:\/\/www.chaosgeordend.nl\/documents\/server.js\">server.js<\/a><\/li>\n<li><a href=\"https:\/\/www.chaosgeordend.nl\/documents\/reset.css\">reset.css<\/a> converted with <a href=\"https:\/\/sass-lang.com\/install\">sass<\/a><\/li>\n<li><a href=\"https:\/\/www.chaosgeordend.nl\/documents\/style.css\">style.css<\/a> idem<\/li>\n<\/ul>\n<p>SparkleShare installation:<\/p>\n<pre lang=\"shell\"># ------------\r\n# SparkleShare\r\n# ------------\r\npi$ curl https:\/\/raw.github.com\/hbons\/Dazzle\/master\/dazzle.sh \r\n&gt; --output \/usr\/bin\/dazzle &amp;&amp; chmod +x \/usr\/bin\/dazzle\r\npi$ sudo dazzle setup\r\n\r\n# create your projects\r\npi$ sudo dazzle create private\r\npi$ sudo dazzle create public\r\npi$ sudo vi \/home\/storage\/.ssh\/authorized_keys\r\n[add ssh key for each connected user@computer]\r\n\r\n# Optionally edit the list of files to ignore (e.g. Mac OS X .DS_store and .lock files) or edit .gitignore, see <a href=\"https:\/\/help.github.com\/articles\/ignoring-files\">git exclude files<\/a>\r\npi$ sudo vi \/.git\/info\/exclude\r\n.DS_Store\r\n.lock.*\r\n<\/pre>\n<p>[2014-10-05 Update]<br \/>\nMoving it to another Pi somehow broke the dashboard. Downgrading some npm packages fixed it. These are the versions used:<\/p>\n<pre lang=\"shell\">pi$ npm install redis@0.12.1\r\npi$ npm install connect-redis@1.4.7\r\npi$ npm install express@2.5\r\npi$ npm install jade@0.35.0\r\n<\/pre>\n<p>Also there exist <a href=\"https:\/\/nl.wikipedia.org\/wiki\/Advanced_Packaging_Tool\">APT<\/a> packages for Redis and latest NodeJS (from <a href=\"https:\/\/blog.meadhbh.org\/2014_05_01_archive.html\">meadhbh blog<\/a>), so you don&#8217;t have to build these from source:<\/p>\n<pre lang=\"shell\">pi$ sudo apt-get install redis\r\npi@raspberrypi ~ $ sudo -s\r\nroot@raspberrypi:\/home\/pi# echo \"deb https:\/\/sm5.us\/gonk wheezy main\" >> \/etc\/apt\/sources.list # add meadhbh's repository\r\nroot@raspberrypi:\/home\/pi# exit\r\n\r\npi$ sudo apt-get remove nodejs\r\npi$ sudo apt-get autoremove\r\npi$ sudo apt-get install nodejs-latest\r\n<\/pre>\n<p>[\/update]<\/p>\n<p>Install NodeJS webserver:<\/p>\n<pre lang=\"shell\"># ------\r\n# NodeJS\r\n# ------\r\npi$ sudo mkdir \/opt\/node\r\npi$ sudo wget https:\/\/nodejs.org\/dist\/v0.10.2\/node-v0.10.2-linux-arm-pi.tar.gz\r\npi$ sudo tar xvzf node-v0.10.2-linux-arm-pi.tar.gz\r\npi$ sudo cp -r node-v0.10.2-linux-arm-pi\/* \/opt\/node\r\n\r\n# add Node.JS to the path variable, before the 'export PATH' line\r\npi$ sudo vi \/etc\/profile\r\n...\r\nNODE_JS_HOME=\"\/opt\/node\"\r\nPATH=\"$PATH:$NODE_JS_HOME\/bin\"\r\nexport PATH\r\n...\r\n\r\n# copy <a href=\"https:\/\/www.chaosgeordend.nl\/documents\/nodejs.sh\">nodejs.sh<\/a> to \/etc\/init.d, using FTP\r\npi$ chmod 755 \/etc\/init.d\/nodejs.sh\r\npi$ sudo update-rc.d nodejs.sh defaults\r\n\r\n# The \u2018server.js\u2019 file is just a simple Node.JS server which will listen on\r\n# port 8080 and display \u2018Hello World\u2019 and write some output to the console\r\npi$ mkdir \/home\/pi\/app\r\npi$ put <a href=\"https:\/\/www.chaosgeordend.nl\/documents\/server.js\">server.js<\/a> into the app dir (using vi or Ftp)\r\n\r\n# start the webserver\r\npi$ sudo \/etc\/init.d\/nodejs.sh start\r\n\r\n# and test it using a browser:\r\nhttps:\/\/:8080 or https:\/\/:8080\r\n<\/pre>\n<p>Redis database server installation:<\/p>\n<pre lang=\"shell\"># -----\r\n# Redis\r\n# -----\r\npi$ cd ~\r\npi$ sudo wget https:\/\/download.redis.io\/releases\/redis-2.6.16.tar.gz\r\npi$ sudo tar xzf redis-2.6.16.tar.gz\r\npi$ cd redis-2.6.1616\r\npi$ sudo make\r\n...\r\npi$ sudo make test\r\n# have a coffee break (&gt;25min) after all it's only a Pi\r\n\r\npi$ sudo make install\r\npi$ sudo cp redis.conf \/etc\/redis.conf\r\n[ pi$ sudo cp src\/redis-server \/usr\/local\/bin\/ ]\r\npi$ sudo vi \/etc\/redis.conf\r\n...\r\n#daemonize no\r\ndaemonize yes\r\n\r\n# no log, to reduce SD card i\/o\r\nlogfile stdout\r\n#logfile \/var\/log\/redis.log\r\n\r\n# dump.rdb path\r\n#dir .\/\r\ndir \/home\/pi\/\r\n...\r\n# testrun\r\npi$ redis-server\r\npi$ redis-cli time\r\n\r\n# copy the <a href=\"https:\/\/www.chaosgeordend.nl\/documents\/redis-server-init.sh\">redis-server.sh<\/a> script to \/etc\/init.d\r\npi$ chmod 755 \/etc\/init.d\/redis-server.sh\r\npi$ sudo update-rc.d redis-server.sh defaults 98 02\r\n<\/pre>\n<p>Network Package Manager:<\/p>\n<pre lang=\"shell\"># -----------------------------\r\n# Network Package Manager (NPM)\r\n# -----------------------------\r\npi$ cd ~\r\npi$ sudo curl https:\/\/npmjs.org\/install.sh | sh\r\n<\/pre>\n<p>SparkleShare web interface installation:<\/p>\n<pre lang=\"shell\"># ----------------------\r\n# SparkleShare-dashboard\r\n# ----------------------\r\n# install dependencies with NPM\r\npi$ npm install express@2.5 express-messages i18n jade connect-redis redis sass mime\r\n\r\npi$ cd ~\r\npi$ git clone https:\/\/github.com\/tommyd3mdi\/sparkleshare-dashboard.git\r\npi$ cd sparkleshare-dashboard\r\npi$ sudo \/opt\/node\/bin\/npm install express@2.5 express-messages i18n jade connect-redis redis sass mime\r\n\r\n# install the node_modules\r\npi$ cd sparkleshare-dashboard\r\npi$ npm install -d\r\n\r\n# copy the <a href=\"https:\/\/www.chaosgeordend.nl\/documents\/sparkleshare-dashboard.sh\">sparkleshare-dashboard.sh<\/a> script to \/etc\/init.d\r\npi$ chmod 755 \/etc\/init.d\/sparkleshare-dashboard.sh\r\npi$ sudo update-rc.d sparkleshare-dashboard.sh defaults 98 02\r\n\r\n# add user pi to the \u2018storage\u2019 group (to allow access via alias)\r\npi$ sudo adduser pi storage\r\n\r\n# symlinks to the repo's\r\npi$ sudo ln -s \/home\/storage\/private \/home\/pi\/sparkleshare-dashboard\/private_x\r\npi$ sudo ln -s \/home\/storage\/public \/home\/pi\/sparkleshare-dashboard\/public_x\r\n\r\n# edit (the alias to) the folders shown in the dashboard\r\npi$ sudo vi ~\/sparkleshare-dashboard\/config.js\r\n\r\n  { type: 'git', name: 'Public GIT folder', path: '\/home\/pi\/sparkleshare-dashboard\/public_x', pub: true },\r\n  { type: 'git', name: 'Private GIT folder', path: '\/home\/pi\/sparkleshare-dashboard\/private_x', pub: false }\r\n\r\n# test (from within the ssh session)\r\npi$ sudo \/etc\/init.d\/sparkleshare-dashboard start > \/dev\/null 2>&1 &\r\n\r\n# if all went well, reboot the Pi\r\npi$ sudo shutdown -r now\r\n\r\n# to conclude, if you have to switch off your Pi,\r\n# switch it off gracefully\r\npi$ sudo shutdown -h now\r\n<\/pre>\n<p>Links<\/p>\n<ul>\n<li><a href=\"https:\/\/sparkleshare.org\/\">SparkleShare clients<\/a> for OS X, Linux and Windows<\/li>\n<li>How to <a href=\"https:\/\/xlcwu.wordpress.com\/2012\/09\/07\/install-sparkleshare-and-sparkleshare-dashboard-in-ubuntu-lucid\/\">install SparkleShare on Ubuntu<\/a> Lucid Lynx<\/li>\n<li><a href=\"https:\/\/github.com\/tommyd3mdi\/sparkleshare-dashboard\">Sparkleshare dashboard<\/a> web interface<\/li>\n<li>Raspbian 2013-02-09 Wheezy from <a href=\"https:\/\/www.element14.com\/community\/community\/raspberry-pi#downloadcenter\">Element14<\/a><\/li>\n<li><a href=\"https:\/\/nodejs.org\/\">NodeJS<\/a> lightweight webserver<\/li>\n<li><a href=\"https:\/\/redis.io\/\">Redis<\/a> database server<\/li>\n<li>How to install a <a href=\"https:\/\/www.megaleecher.net\/Watchdog_for_Raspberry_Pi\">watchdog on RPi<\/a><\/li>\n<li>The RPi case is a 3D print from Redpepper&#8217;s design on <a href=\"https:\/\/www.thingiverse.com\/thing:30572\">Thingiverse<\/a><\/li>\n<li><a href=\"https:\/\/sass-lang.com\/\">Sass<\/a> Syntactically Awesome Stylesheets<\/li>\n<li>Gracefully <a href=\"https:\/\/raspberrypi.stackexchange.com\/questions\/381\/how-do-i-turn-off-my-raspberry-pi\">switching off your Pi<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8220;projects&#8221;) to this folder. These projects will be automatically kept in sync with both the host and all of your peers when &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.chaosgeordend.nl\/wordpress\/2013\/11\/17\/your-own-dropbox-with-a-raspberry-pi\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Your own dropbox with a Raspberry Pi&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[],"class_list":["post-78","post","type-post","status-publish","format-standard","hentry","category-raspberrypi"],"_links":{"self":[{"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/posts\/78","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/comments?post=78"}],"version-history":[{"count":18,"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/posts\/78\/revisions"}],"predecessor-version":[{"id":204,"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/posts\/78\/revisions\/204"}],"wp:attachment":[{"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/media?parent=78"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/categories?post=78"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chaosgeordend.nl\/wordpress\/wp-json\/wp\/v2\/tags?post=78"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}