CategoryLinux

Switched!

So far I had all the micro-servers in the home network connected either to a LAN port or to an Orbi Satellite. This week I implemented a simple 8 port un-managed TP-Link switch into my ‘homelab’. Costed just about 18 bucks with a price-match from amazon and it has tremendously improved upload/download speeds! Also it’s pretty cool to visually see that the RPi3B+ boards are being throttled at 10/100Mbps while the RPi4 is rummaging at 1000Mbps.

While at it, I re-purposed a few card-board boxes and built a bare bones stack. Ain’t pretty does absolutely does the job!

Optimizing images

My Samsung phone by default generates pretty high resolution pictures. Even with the most basic setting, captured images turn out to be ~3MB! I’m not a huge photo buff and don’t necessarily need such high clarity pictures which consume a lot of space. I recently came across two amazing utilities that help optimize images in Linux: jpegoptim and optipng

Install them via terminal:

sudo apt-get install jpegoptim
sudo apt-get install optipng 

And optimize away!

jpegoptim --size=1024k <file-name>.jpg

Be sure note to go minimalist ( ~ 125k – Like I did in a few of my recent posts), since that doesn’t quite do a lossless compression.

The utility can also be used to bulk optimize images which can be super useful!

Weeknote 19 – feeds and sessions

A glimpse of the past week and the few things that captivated my attention:

Weather’s been pretty erratic this week. We also had a mild dusting yesterday out of the blue! Might consider heading out for a hike later today.

I nudged Meena to write more. We’ve had some interesting discussions on Yoga and other things over the past week and I do think she has a ton to share! She’s also planning to train for a 50miler which I am super excited about! Oh and beyond all that marketing ploy, Happy Mothers’ day.

Shasta’s talking a lot more now. Pretty sure her verbal diarrhea is soon going to start soon too!  The other day, while sitting with Appa she said something to the effect of ‘i-pae’ pointing to the ipad. Grandfather and daughter are totally connecting on these gadgets!

Git: I agree on many levels with what Kev posted recently about Github. I enjoy working on and deploying software tools. What I do not enjoy is the whole git pull, push, fork thing!

Sessions: I am running a session later this week for the Khat-pat folks on self hosting. Planning to keep it mostly hands-on and crisp. The idea is to get them started on taking better control of their presence on the interwebs! I’d also love to join the Indieweb folks one of these days. They have one coming up on the 20th!

Tools: Earlier this week, I came across e-mail cloaking services – Simplelogin and Anondaddy. Love the idea and I might give them a shot the next time I subscribe or sign-up for a service.

Feed Readers: Over the past few years, I’ve used multiple feed readers – Netvibes, TheOldReader, FreshRSS and Fever. They were all good in specific aspects but I didn’t really find them to be that one tool which I could use to consume the inter-webs my way. Earlier this week I decided to self-host one and narrowed down to FreshRSS, miniflux and selfoss. After a few iterations of deploying and testing, I stuck with selfoss. It’s super light-weight and has all the specific features I was looking for.  To deploy it on docker, I used the boiler-plate template that I created earlier when setting up my known instance.  The gist file for the docker-compose is here. The install should take you at most 10 minutes assuming you have the base framework setup. What I do love about selfoss is the ability to push articles over to my wallabag instance.

Trilium: I’ve moved most of my notes over to Trilium and I am absolutely loving it! While it’s hierarchical, it is also setup not to be one.

Interesting reads this week:

Time-restricted eating: Philip referenced this article recently and I think it’s brilliant! Also went ahead and signed up for Rhonda’s podcast.

Tracking using ultrasound frequencies: Whoa! This totally blew my mind! If google uses it to connect your devices with chrome cast, what’s really stopping them from using it to track what you are watching? And now how do you block that invasion?

Workplaces in the era: Firms will have additional pressure from (or will be incentivised by) their insurance companies to have monitoring in place. Over the span of few months, this will be the new normal. Looking back, haven’t we all got used to keying-in and out at our workplaces?

We kill people based on metadata: Quite a lot is changed since 2014. What hasn’t though is how fragmented and withdrawn several government and private entities are even in times of crisis.

The mystic veil of End-to-End encryption: Interesting read on the data sharing between these apps.  The other day I was wondering how Bark‘s able to access messages from these apps. Likely they have something on these lines drifting underneath? While I love the concept of the app and the benefits it provides, I did cringe and walk away because I just wasn’t sure how they’d be handling the data.

Migrating over to Trilium notes

I’ve had my eyes on Trilium notes since last year. Having setup a robust docker framework earlier this year, I decided to test Trilium out. Gave it a test run this morning and am way impressed with its’ functionalities! With docker, installation was super easy and I am strongly leaning towards using Trilium as my primary note application.

The yml file to get this running on docker (swarm) is in my github gist. You’d obviously need to have docker installed, docker swarm running with the traefik container and the domain mapped as needed. My Jitsi post has this outlined further.

Trilium Web app

While I haven’t spent a fair amount of time diving deep into the setup, here’s a quick first impression:

Pros:

  • Beautiful interface that can be as sparse or as detailed as you’d like it to be
  • Encrypted by default and further protected sessions for sensitive notes
  • A note-info section that details attributes and link-maps
  • Notes can be ‘cloned’ under multiple places in a tree
  • Code scripting, tables, markdown, images, files – It’s got it all!
  • Web clipper for quick screen and context grabs
  • Export and Import functionalities

Cons:

  • No mobile apps yet! However, it does have a mobile front-end which should be a good alternative
  • No multi-user support yet

I was exploring Joplin as an alternative initially but decided to stick with Trilium since the Joplin app currently has limited functionality (Creating nested trees in the mobile app). Meena’s been looking at switching over from her current Evernote setup and I think this might be a terrific replacement for her. Was never really a fan of Evernote and that dislike strengthened further when I had to install the app either on a Mac or PC to export my content! I am so glad we have the strength of open-source to weigh against these silo’ist setups!

Deploying Known on a docker stack

To migrate my php applications that did not have a handy docker-compose available, I needed a vanilla setup for my stack-based docker environment. Known is one of those apps and so the first step was to build that PHP environment.

Setting up a Dockerhub repository and building a custom PHP image

[If you decide to use my image, you would not have to build this yourself. Skip ahead to the Deploying Known section]

Most php based apps also need specific extensions built-in. While I am sure they’re out there on the Docker hub repository, I was not able to easily find any images that met my specific needs . So I went ahead and setup my own repository on Docker Hub.

Something I learnt today was that a docker stack only accepts pre-built images. Which essentially means you cannot use the regular build command on the fly in your docker-compose file. A quick work-around to that is to build the image locally and then publish it to a public repository from where the stack can easily access it.

  • Create a dockerfile: sudo nano dockerfile
  • Copy over contents from my dockerfile gist. Edit or update if you need any additional extensions. Do note that I am pulling a debian buster image here. An alpine image would be optimal but lets’ run with this for now.
  • Build the image locally:
    docker build -t sriperinkulam/php-7.4.3-apache-buster-plus:latest .

Edit the image and tag name as needed. If your gist file is defined correctly, the image should be ready in a few minutes. It took me a few iterations to get this working with all the extensions I needed and shouldn’t give you any errors during the build process.

  • Login to your Dockerhub repo: docker login
  • Push your image over to your repository:
    docker push sriperinkulam/php-7.4.3-apache-buster-plus:latest
  • Within a few minutes, your image should be available for easy fetch whenever needed!

 

Setting up and deploying the Known install

  • Create a folder for the known installation:

sudo mkdir known && cd known

  • Copy over my ‘known.yml’ gist from here and paste into a known.yml file.

sudo nano known.yml

This is where we use the image we built earlier! Make sure you update the passwords there-in.

  • Create an ‘app’ folder. This is where we will copy in the core known package.

sudo mkdir app && cd app

Marcus Povey does the heavy lifting of packaging the known install ‘unofficially’. Download his latest pre-packaged release from his portal.

wget https://withknown.marcus-povey.co.uk/<package>

Finally unzip/untar the package.

  • Step back into the main ‘known’ directory and deploy the stack that we defined in the known.yml file.

cd ..

DOMAIN=known.domain.org SCHEME=https docker stack deploy -c known.yml known

  • Assuming you’ve already setup the traefik container, as mentioned in my Jitsi post, you should now have Known up and running. Navigate to the domain and you should see the warmup page.

  • Key in the db credentials that you setup in the known.yml file. The database would need to be set as mariadb, since that’s how we’ve defined it in the known.yml file. Also make sure you have the Uploads folder writable by www-data:

sudo chown -R www-data /var/www/html/Uploads/

Setup your user account and proceed with the regular administration controls!