Srikanth Perinkulam

Menu Close

Search results: "nextcloud"

Snappy Nextcloud

Last year, I procured a Nextcloud box and moved part of my data to it. I’d just heard about Ubuntu Snappy Core OS and was keen on porting my install to that setup. I finally got around doing that last week and thought I’d quickly jot down the install steps for reference later. Essentially, I installed the Core OS on a 32GB microSD card and installed Nextcloud as a snap. Two 1TB hard drives service the Pi3 and are synced with rclone. Below is a crude outline of the setup:

Install and sign-in to the UbuntuCore OS:

1.Download the latest Ubuntu Core OS and use Etcher to burn it on to a microSSD card.

2.On your local machine generate a public/private rsa key using the following command:
ssh-keygen -t rsa
Create an UbuntuOne account if you don’t already have one and import your ssh key to your account. You’ll need this to ssh into your Core OS pretty soon.

3.Slide in the microSSD card onto the Pi3 board. Then connect a monitor, keyboard and hard drive to the Pi3 and power it on. The Pi3 Board B comes with in-built wi-fi and bluetooth and once powered on it should automatically prompt you to connect to the wi-fi and then to your UbuntuONE account. Once this is setup, you should be able to ssh into the CoreOS from your local machine using:
ssh [email protected]
+ If ssh fails – “Error – signandsend_pubkey: signing failed: agent refused operation”. This is most likely because the ssh agent is already running but isn’t able to find the private keys. To add the keys to the authentication agent, enter ssh-add. Also to see list of fingerprints of all identities added use ssh-add -l + To add a password for the user: sudo passwd ubuntu-username + To re-configure network at anytime: sudo console-conf

External Drive setup
1.I use two external hard-drives one as a primary and the other as a secondary. First format the drives: sudo fdisk /dev/sda
+ Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): o
Created a new DOS disklabel with disk identifier 0x8b913f43.
Command (m for help): n
Partition type
p primary (0 primary, 0 extended, 4 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1):
First sector (2048-1953458175, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-1953458175, default 1953458175):
Created a new partition 1 of type 'Linux' and of size 931.5 GiB.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

2.Format the partition and give it the label data. This label will be used to reference it for mounting later: sudo mkfs.ext4 -L data /dev/sda1
+ mke2fs 1.42.13 (17-May-2015)
/dev/sda1 contains a ext4 file system labelled ‘data’
last mounted on Sat Nov 18 08:38:49 2017
Proceed anyway? (y,n) y
Creating filesystem with 244182016 4k blocks and 61046784 inodes
Filesystem UUID: c03685e6-fc4d-4d69-b8cf-8b17b24f2e0a
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

3.To mount the partition we’re forced to rely on systemd since most of Ubuntu core system is read-only and editing /etc/fstab is not an option. Mount units need to be named after the mount point directories they control. So create the media-data.mount unit: sudo vi /writable/system-data/etc/systemd/system/media-data.mount and add in the following content:

[Unit]
Description=Mount unit for data
[Mount]
What=/dev/disk/by-label/data
Where=/media/data
Type=ext4
[Install]
WantedBy=multi-user.target

4.Reload systemd to reflect the changes,Start and enable the mount volume so it gets automatically mounted:

sudo systemctl daemon-reload
sudo systemctl start media-data.mount
sudo systemctl enable media-data.mount

5.Make sure Ubuntucore is up to date and refresh:

sudo snap refresh
sudo reboot

After the reboot make sure /media/data is mounted and functional: sudo systemctl status media-data.mount

Install and configure Nextcloud as a snap

1.Install Nextcloud: sudo snap install nextcloud
2.Access the nextcloud install from any browser in the network using the IP address: http://192.168.0.xx, create an admin account and complete the installation.
3.Enable the ‘External Storages’ app under ‘Apps’.
4.Associate the removable media with nextcloud: sudo snap connect nextcloud:removable-media core:removable-media
5.Map /media/data with nextcloud in the external storage with the following settings:

Folder name: data
External storage: Local
Authentication: None
Configuration: /media/data
Available for: All

6.Setup encryption certificates: sudo nextcloud.enable-https self-signed
7.To access the setup pi3 server from outside the local network, you’ll need to map the dynamic dns provided by your ISP to a global address. I used no-ip and my netgear router to facilitate this.
8. Do note that when you upload files, by default they’re saved to the microSD card!! + here: /var/snap/nextcloud/common/nextcloud/data/NC_user/files. Read this forum for details.
9. If more than one user would be using the external data mount either install the ‘File access control’ app and setup rules or create folders for each person and just mount those folders for each user in the Nextcloud admin panel.

Weeknote 02 – Snow mischief

A glimpse of the past week and the few articles, podcasts, tools, videos and music that captivated my attention:

Earlier this week I helped Sharath setup a nextcloud instance on the RaspberryPi 4 that we got him for Christmas. Installed the DietPi OS, moved the user data over to a 5TB WD disk and while at it also setup a pi-hole for the network.

Weather wise, this was one odd week. Had a good dusting of snow on Tuesday night and a balmy 60 degrees for most of the weekend. The kids had early school closures and we made sure we hit the trails.

Gone are the crawling days. Shasta has moved on to walking and she’s getting pretty good at it. Also her mischief quotient is raising by the day!

Meena found an interesting course in Tufts and has applied for the 2020 Fall deadline. Fingers crossed that she makes it! Some other exciting developments through this week might take us back to Boston this spring.

Interesting podcasts this week:

The Indicator from Planet Money: The Skyrocketing Cost Of Air Ambulances

Interesting reads this week:

Welcome to New Hollywood: Netflix has absolutely taken over the digital market. Oddly they rely on AWS!

Why parents are addicted to Calpol: So true! It struck me so starkly when we moved to the states several years back. It’s amazing how quickly my family pops in paracetamols without any second thoughts.

The Shadow Commander: Quite an interesting read on recent developments in Iran and it’s past.

Weeknote 51 – Clouds down south

A glimpse of the past week and the few articles, podcasts, tools, videos and music that captivated my attention:

Got a RaspberryPi 4 kit for my eldest brother. Can’t wait to set up a homeserver for him. On my nudging, the second eldest, setup a homeserver sometime back and we’re very impressed with the speed and crisp loading of the photos he’s currently hosting on a nextcloud setup. On a similar vein, I’m testing the cloud provider Hertzner. They’re super cheap and seem to be pretty good. Will probably port over my services from Digital Ocean over the next few months if I find them stable.

Was wonderful to see Nik perform in his year-end winter performance. The group sounded way professional! Also, Nancy had her track meet yesterday. She’s improved her pace a lot over the last year and it’s wonderful seeing her truly enjoy running.

We decided to have an early christmas gift exchange with the Baltimore family before we hit the road for Florida. Initial plan was to leave early on Saturday morning and reach Miss Bama’s home by the evening. As luck would have it, we noticed last night that we had to change the catalytic converter in the Sienna. Got that fixed first thing today at Firestone. Will now head down south, contingent on weather and traffic.

Interesting reads this week:

Network auto-latch

I realised the raspberry pi that hosts my nextcloud setup wasn’t quite latching back on to the network if the router was turned off or if the internet was sketchy. Was a pain to hard boot the device manually to reset it. Decided to write a short script to reset the network connection when it noticed something was off.


ping -c4 192.168.0.1 > /dev/null
if [ $? != 0 ] 
then
  echo "SOS..Restarting eth0 for network latch"
  /sbin/ifdown 'eth0'
  sleep 5
  /sbin/ifup --force 'eth0'
fi

A chron job runs every 10 minutes to take pulse of the network, runs the above code and picks up connectivity without manual intervention!

Weeknote 41 – Networks and Carnatic notes

State of the network: With better access to the router and some re-wiring in the house, I got around rejigging my server setup. This will change once I get my Odroid shipped over. For now though, here’s my current setup:

    1. NexcloudPi installed on a Raspberry pi 3B+ board
    2. Diet-Pi installed on another Raspberry pi 3B+ board running the pi-hole

The SBCs and the modem are now connected to the UPS inverter, so hopefully that gets rid of the hard shutdowns. Might consider getting a stabilizer at some point in time. I am also leaning towards a more robust homelab system. Yet to whet the core setup and will probably explore that a year down the lane.

Fitness: Yet another good week spending time outdoors! A 5k barefoot beach run on Tuesday, 5.5k lap runs at the YMCA on Wednesday, 25mins breaststroke swim at MBC and 30min MAS training at YMCA on Thursday, and a 2k barefoot beach run on Friday.

Music: Spent friday evening listening to a Veena instrumental performance at Narada Gana Sabha. A family friend was playing with 107 other artists and I also ran into a college friend with whom I was out of touch for about 10 years now! The performance was a tribute to his grand-father. Small, small world! Below is a shoddy recording of one of the pieces they performed. One of my favorites.

Interesting tools this week:

    • If you need to find what other devices are connected to the wifi network that your device is connected to, and a whole lot of other details, the Fing app is wonderful place to start. The free app is pretty slick! I use it to identify IP addresses (and use that to update my pi-hole hosts file for a more human-friendly ‘client listing’)

Interesting reads this week:

    • Google’s Sycamore quantum computer apparently achieved quantum supremacy. John Preskill had a good article on this on Quanta Magazine. The next few decades is arguably going to be about computing prowess and the results thereof, and quantum supremacy is a huge move in that direction. Exciting times ahead!
    • Just read this brilliant Nat-Geo piece on Netherland’s sustainable farming practices and how that’s setting them to success as the world’s second largest exporters despite being a really small country!
    • An intriguing post on the Palm oil. A cousin who was visiting us last month mentioned how he’d moved away from all packaged foods since they extensively use Palm oil. While I agree with the sentiment of not using packaged food, I wasn’t quite aware of the influence of Palm-oil and how deeply ingrained it was in the asian food manufacturing ecosystem till I read this piece from the Guardian.

Bringing the cloud home

I finally got my Shoebox server setup working! I now have three Single board Computer [SBC] working in tandem behind my home router to accomplish what I’ve been wanting to do for quite sometime now – Setting up an easy-to-maintain, in-house server for all my data and web hosting needs. Fixing this all together has been a tremendous learning experience. I still need to weed out some pesky issues but I believe I have the bearing right now.

Here’s my current setup:

  1. NexcloudPi installed on a Raspberry pi 3B+ board
  2. Yunohost installed on an Odroid XU4 board
  3. Diet-Pi installed on another Raspberry pi 3B+ board

I’ve been using Nextcloud as my data storage solution for more than a year now. It does what I expect it to do and much more. NextcloudPi handles the intricate details and takes out the hassles that come with hosting data on personal servers.

On the ODroid-XU4, I installed debian stretch as the base OS and then manually installed Yunohost as my web server. I use ServerPilot on my Digital ocean servers and was looking for a close match while self hosting. Love YHs web-ui and they did seem to support quite a few web apps. I also have my eyes on cozy and caprover. Might explore these at a later point in time if decide to switch to a different SBC.

Both NextcloudPi and Yunohost have letsencrypt tools to setup and manage certificates for the domains/sub domains. While super useful, I realised to benefit from that feature, I had to rely on haproxy. With some pointers from the Nextcloud forum, I decided to use another pi to front as the main server. Installed Diet-pi on it since it’s just something I really liked and configured haproxy on it to map to the corresponding server based on the hostname. While at it, I also added in a switch between the router and various servers.

I still need to work on making this more robust. One niggling issue is the speed is heavily compromised. I’m guessing it’s do with my haproxy config and I should be able to fix it pretty soon. Once I have this sorted out, I need to spend some time hardening the security of the server, further configure Yunohost, device my backup strategies and finally moving my websites over from Digital Ocean.

ODroid XU4 SBC

Meena and my family gifted me an Odroid XU4 SBC earlier last month as a Christmas/B-day gift. One of my projects during the year-end holidays was to setup a robust home server; Essentially getting my webservers home from Digital Ocean, where they are currently hosted. This would be a terrific companion to the nextcloud fileserver that I setup earlier using a raspberry pi.

Earlier this week, I chanced upon DietPi and decided to launch it on the eMMC chip. One of the first things I did was to install Pi-Hole. With uBlock addons’ that should be some good riddance to ads across my home network! Would be interesting to keep track of these network pings to see what devices are needlessly calling ‘home’.

I’ve ported my web applications to the Odroid board and am currently testing out the server internally before I ‘turn on’ the traffic switch. All looks super-promising so far! Over the next few months, I’ll have to tweak the settings and tune this mini-beast a bit for performance. For now though, I’m more than happy with what it’s delivering!

Fired up!

Finally got around procuring a pi3 and setup the Nextcloud Box! Getting this up and running was super fun and pretty straight forward.

The OS Image that was delivered with the box was built for the pi2. So I had to format the drive with Gparted and flashed the pi3 image with Etcher (One nifty piece of software!). Once the hardware was fired up, it just took care of itself. The web install was a 1-click setup.

Early this year as I initiated taking more control over my data, I also setup a Nextcloud server on the cloud. It’s been about eight months now and am thoroughly impressed with it. With the incredible iOS and android apps and the nifty client for linux I’m more than convinced the take this a step further and setup my personal home server.

Over the next few weeks as I tinker more with this, I need to make this a more robust setup and make full use of the snappy Ubuntu core.

Projects

A quick list of personal projects that I am currently working on or plan to work on:

Cloud Migration

In 2017, I consolidated all my shared servers onto the cloud. With robust backups and more reliability, I now see a huge uptick in server stability and performance. A huge learning experience. Besides, I also get to tinker with minor projects on the cloud not having to deal with cumbersome restrictions of shared servers!

100%

Publish Appa's Books

We’ve been wanting to publish appa’s articles and stories into a book for a few years now. The project never really gained traction for no concrete reason beyond the ‘false start’ issue. A few days back I heard about PressBooks and looks like this should address some of our main issues. The current target is to have at least one book published within the next three months.

2019 Update: Working on the second book

10%

2018 Update: Published the first book – Smell of the soil!

  • Amazon KDP is a rip-off! Doesn’t make much sense to sell on them unless producing en-mass.
  • Decided to self-publish. Works for e-books. Need to figure out on-demand printing!

100%

Build a home server

2019 Update:

  • Started using IP based sync in the home network. Way faster!
  • Working on setting up a background sync to a remote server – S3 / Backblaze / Glacier

40%

2018 Update:

Tinkered with Rpi’s and ODroids. Currently using a NextCloud setup on an Rpi for my file and photo sync. A 1TB drive hosts the files and is governed by NCP installed on an RPi3B+. Files synchronized to my main laptop and backed up to a secondary laptop via Syncthing. A section of the files are also backed up to Meena’s laptop using the NC windows app.

100%

I’ve been wanting to have a home server built for my personal files for a while now. Nothing too industrial, just something to have a local backup for my shared files and folders and to avoid reliance on other cloud services. NextCloud seems to be a great option and though I procured the hardware (besides the raspberry pi3) sometime back, I haven’t really had the chance to fire it up and configure it.

Setup a personal RSS reader

For a long time I’ve always wanted to setup a self hosted RSS reader. Was never really satisfied with the free readers available online. Fever was the one I was super keen on setting up. Looks like the project was orphaned earlier this year. Was using FreshRSS for sometime and decided to move on to TheOldReader till I find a self hosted solution. Would ideally like to implement an Indieweb friendly version sometime soon. Sticking to Instapaper for article archivings.

60%

Learn Spanish

I’ve been wanting to learn a foreign language for a while now. Dabbling between German and Spanish for a while now. Since I work with a team in Mexico on a regular basis, Spanish looks like a good target. Need to chalk out a game-plan for this.

1%