by K8CTR
Posted Sunday, February 7, 2016 7:30 PM
Gnawing at the back of my mind has been this tiny question about the portability of my SpiderOak NAS solution. In my last post, I suggested that the simplest approach to installing SpiderOakONE on an Intel based Synology was to use the SynoCommunity Debian Chroot package, and install the official headless .deb from SpiderOak within it. So, what would happen if say... I wanted to move my NAS to new hardware, could my existing SpiderOak install migrate over with just a copy & paste?
So to try and silence that annoying tiny question:So far, everything has seemed to work. Again, this is an unofficial project and doing anything like this with sensitive data is probably asking for trouble, I'm just sharing what I did because I like doing this kind of stuff, and it's always nice having a reference.
vi /var/packages/debian-chroot/scripts/start-stop-statusTo something like this...
start_daemon () { [...] grep -q "${CHROOTTARGET}/home " `realpath /var/services/homes` || mount -o bind `realpath /var/services/homes` ${CHROOTTARGET}/home grep -q "${CHROOTTARGET}/photo " `realpath /var/services/photo` || mount -o bind `realpath /var/services/photo` ${CHROOTTARGET}/media/photo grep -q "${CHROOTTARGET}/music " `realpath /var/services/music` || mount -o bind `realpath /var/services/music` ${CHROOTTARGET}/media/music grep -q "${CHROOTTARGET}/video " `realpath /var/services/video` || mount -o bind `realpath /var/services/video` ${CHROOTTARGET}/media/video [...] } stop_daemon () { [...] umount ${CHROOTTARGET}/home umount ${CHROOTTARGET}/media/photo umount ${CHROOTTARGET}/media/music umount ${CHROOTTARGET}/media/video }Within the chroot:
nano /etc/apt/sources.list # changed fr. to us. apt-get update apt-get install locales dpkg-reconfigure locales dpkg-reconfigure tzdata apt-get install curl openssh-server adduser josh -uid XXXX --gid XXXX --home /home/josh #Synology: id -u username; id -g username mkdir -p /media/photo mkdir -p /media/music mkdir -p /media/video apt-get install libfreetype6 libxrender1 libfontconfig1 nano /etc/ssh/sshd_config Port 2222 PermitRootLogin yes X11UseLocalhost yesThen probably something like cron to run the batch backups during non-peak times... And from my Mac with X11 installed... Don't forget to change your root PW, or try admin instead?
ssh -p 2222 -X root@diskstation /usr/bin/SpiderOakONE
by K8CTR
Posted Tuesday, December 22, 2015 9:26 PM
ssh -p 2222 -X root@diskstation /usr/bin/SpiderOakONE
by K8CTR
Posted Friday, February 20, 2015 8:43 PM
cd ~ wget https://spideroak.com/getbuild?platform=ubuntu&arch=i386 dpkg-deb -x spideroak_5.1.8_i386.deb spideroak
ipkg update ipkg install python26 cp -r ~/spideroak /opt/spideroak mkdir /opt/spideroak/conf vi /opt/spideroak/usr/bin/SpiderOak
#!/bin/sh if [ ! -d "/root/.SpiderOak" ]; then ln -s /opt/spideroak/conf /root/.SpiderOak fi LD_LIBRARY_PATH="/opt/spideroak/opt/SpiderOak/lib:/opt/lib:/usr/lib:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH QT_PLUGIN_PATH="/opt/spideroak/opt/SpiderOak/lib/plugins" ; export QT_PLUGIN_PATH SpiderOak_EXEC_SCRIPT=$(cd `dirname $0` ; pwd)/SpiderOak export SpiderOak_EXEC_SCRIPT exec "/opt/spideroak/opt/SpiderOak/lib/SpiderOak" "$@"
/opt/spideroak/usr/bin/SpiderOak --bootstrap=PATH_TO_THE_DOWNLOADED_JS_FILE /opt/spideroak/usr/bin/SpiderOak --help
/opt/spideroak/usr/bin/SpiderOak --include-dir=PATH_TO_INCLUDE_DIRECTORY /opt/spideroak/usr/bin/SpiderOak --batchmode (use the -v option for log output in the terminal)
ipkg install xdpyinfo xauth xterm xrender fontconfig freetype glib ttf-bitstream-vera
nano /etc/ssh/sshd_config X11Forwarding yes X11DisplayOffset10 XAuthLocation /opt/bin/xauth
ssh -X root@x.x.x.x /opt/spideroak/usr/bin/SpiderOak
by K8CTR
Posted Tuesday, February 17, 2015 5:23 PM
How fitting that the first post on my new blog is titled "Bootstrap".
[Git Repo]
log.info("made blog template"); log.info("published template code"); log.info("syntax highlighting");
by K8CTR
Posted Thursday, April 10, 2014 3:00 PM
For hosting multiple servers (Gitlab and some dev servers) through a single router port forward, I used the following configuration on a local Apache instance. There was a bit of an SSL issue which seemed to resolve when the reverse proxy hosted the SSL certificates for the configured domain as well. GitLab has a page on setting up https here.
SSL Cert
The SSL cert and private keys were generated on the destination server, then copied to the reverse proxy.
openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout sub.example.com.key -out sub.example.com.crt
ports.conf
NameVirtualHost *:443
Virtual Host (sites-available/000-default.conf)
<VirtualHost *:80> ServerName sub.example.com ServerAdmin josh@example.com ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined LogLevel error SSLProxyEngine on ProxyPreserveHost On ProxyRequests off ProxyPass / http://192.168.1.100/ ProxyPassReverse / http://192.168.1.100/ </VirtualHost> <IfModule mod_ssl.c> <VirtualHost *:443> ServerName sub.example.com SSLEngine On SSLProxyEngine On ProxyRequests Off SSLCertificateFile /etc/apache2/ssl/sub.example.com.crt SSLCertificateKeyFile /etc/apache2/ssl/sub.example.com.key #SSLCertificateChainFile /etc/apache2/ssl/sub.class1.server.ca.pem SSLCACertificateFile /etc/apache2/ssl/sub.example.com.crt SetOutputFilter INFLATE;proxy-html;DEFLATE; ProxyHTMLInterp On ProxyHTMLExtended On ProxyHTMLURLMap (.*)192.168.1.100(.*) https://sub.example.com$2 [Rin] ProxyPass / https://192.168.1.100/ ProxyPassReverse / https://192.168.1.100/ </VirtualHost> </IfModule>
by K8CTR
Posted Monday, March 3, 2014 6:04 PM
I needed a PHP implementation of LINQ to parse some seemingly arbitrary SOAP API response objects by avoiding if(method_exists()) and if(is_array()) then foreach(){if(is_object){}}. So I thought I'd share my tiny introduction to PHPLinq.
$names = array("APPLE", "BIRD", "CAT", "DOG", "EGG", "FISH", "GOAT", "HAM", "ICE", "JAM", "KOALA", "LIZARD"); // Easy: $resultsA = from('$name') ->in($names) ->where('$name => (strpos($name, "A") !== FALSE)') ->select('$name'); var_dump($resultsA); $resultsB = from('$name') ->in($resultsA) ->concat(array("MARS")) ->select('$name'); var_dump($resultsB); $resultsC = from('$name') ->in($resultsB) ->orderBy('$name => $name') ->reverse() ->select('$name'); var_dump($resultsC); $resultsD = from('$name') ->in($resultsC) ->count(); var_dump($resultsD); $resultsE = from('$name') ->in($resultsC) ->skip(1) ->take(2) ->select('$name'); var_dump($resultsE); // Ooo, nice: $names[] = "LIZARD"; $resultsF = from('$name') ->in($names) ->where('$name => (strpos($name, "A") !== FALSE)') ->ofType('string') ->distinct('$name => $name') ->orderBy('$name => $name') ->thenByDescending('$name => count($name)') ->select('new { "name" => $name }'); var_dump($resultsF); $resultsG = from('$name') ->in($resultsF) ->where('$name => (strpos($name->name, "A") !== FALSE)') ->orderBy('$name => $name->name') ->first(); var_dump($resultsG); $names2 = array("apple", "bird", "cat", "dog", "egg", "fish", "goat", "ham", "ice", "jam", "koala", "lizard"); $resultsH = from('$name')->in($names) ->join('$name2') ->in($names2) ->on('$name, $name2 => (strcasecmp($name, $name2) == 0)') ->select('$name = null, $name2 = null => $name." equal to ".$name2'); var_dump($resultsH);
What got in the way of actually using it, was the "installation" into my existing framework. Once I found the LinqToObjects Unit Tests things started to make more sense:
$phpLinq = Config::Get('PHPLinqIncludePath'); set_include_path(get_include_path().PATH_SEPARATOR.$phpLinq); require_once 'PHPLinq/LinqToObjects.php';
My initial production test, didn't work because I had converted the original SOAP reply object into a multi-dimensional array for convenience. PHPLinq treated the first layer of my array as a list of objects, and any subsequent arrays seem to be discarded and only the first element in the "object" array was queried/processed. This was easy enough for me to solve by not converting the original object into an array O_o. I then tested for the existence of an array within the object, build a "where" query to only pull out the objects in that array that matched the user's criteria (new feature), and sorted the result before returning it (also new feature)... nice.