Reverse Proxy (with Nginx)

I did a little write-up on how I achieved reverse proxy nirvana with IIS quite a while ago now. It made things a lot nicer for me. Like, a lot. Then I took it further, and moved to Apache (with certbot, for that sweet SSL).

Now I have a few friends/colleagues/acquaintances who run Nginx (I run Apache in my homelab environment nowadays, which is why I migrated from IIS to Apache), so I figured I’d look into how I can help them achieve a reverse proxy with Nginx instead.

Continue reading

Permanent link to this article: https://www.berserkir.net/wordpress/reverse-proxy-with-nginx/

Kapowarr

This one is a nifty little comic collection management tool.

I’ve started getting into comics lately, and with that comes (of course) the issue of sorting it all. After a bit of digging (and some frustrations with the tool known as ‘Mylar’), I came across ‘Kapowarr’. I compiled it from source, had a play, and thought “yeah, I like where this is going”. It is… very new. Features are being added at a rapid pace, and bugs are being fixed similarly quickly. It’s made by ‘mrcas’ – a dev over on github who writes some very nice Python (which I’m okay-ish at, not great).

It runs in Docker, gives you a web UI to add/manage content, and generally makes managing it a bit easier. I found it, thought it was awesome, reached out, and now help build the documentation.

You can find the Kapowarr project on github in the Casvt/Kapowarr repository, with the docs hosted on Github pages.

It’s intended to fit alongside the ‘*arr’ suite of apps – Sonarr, Radarr, Lidarr, etc. If you’re familiar with those, then the UI is pretty familiar. Simply add a comic volume after you’ve set it up, and let it pull the content in.

Once I had Kapowarr running, I needed to set up a nice way to consume the comics (well, not necessarily needed, but it’s definitely a quality-of-life improvement). For this, I settled on Komga – a nice browser-accessible comic library tool. Again, runs in docker – and can be set to periodically scan folders so that things just get auto-added once Kapowarr has done it’s thing. Super clean.

Permanent link to this article: https://www.berserkir.net/wordpress/kapowarr/

Komga

A web-UI for reading comic books.

Having got Kapowarr up and running (and jumped into the support/dev/testing of it), I needed a way to actually view my digital comic books. I looked at a couple e-reader apps, and after testing a couple (including Calibre and uBooquity) I settled on Komga. It gives me a clean UI, accessible via web interface, that scales nicely for mobile and desktop, and works well with both mouse and touch input. Perfect.

I got it deployed with docker, after mounting my comics folder on my docker host machine via fstab (it’s on a network share, on a different machine – that was it’s own set of shenanigans). I passed in the new mount point (read only) and it started identifying series.

Now I had the next step – putting it behind my reverse proxy (because screw having to remember what port it’s on, screw having yet another port forward, and… well, the proxy adds SSL, which is also a must for any web-exposed UI in my view).

I set up a periodic scan of the folder of comics, so that it would identify when new ones were added, and bingo – up and running. It even tracks how far through I am (both at the individual volume and at the series level), so I can pick up across multiple devices without losing track. Beautiful.

Permanent link to this article: https://www.berserkir.net/wordpress/komga/

Home Assistant… you git.

See what I did there? #dadjoke (I know, I’ll show myself out).

Seriously though, with the amount of time and effort I have put in so far (and will continue to put in), I thought it was time to give myself a little bit of a backup of my HomeAssistant config. Looking around, github seemed the best option.

Sure, there are issues with this option. I can’t backup passwords to it, or API keys – but I have a few systems for those, that are also passworded.
I have to manually update it when I make changes.

Why’s that crossed out? Because yes, I do – but that’s not an issue. In fact, version control is the whole point of this.
If I make a change that breaks something, I simply revert to the previous commit. I can make a branch to test something, risk free – and remove it later on, safely.

So where is it? Well, here. It’s running.
I created the repo on github, initialised the repo in the config folder, added a ‘remote’ url, and pushed my existing config up to my repo.
Yes, I had to specify a .gitignore file – so that any text-to-speech snippets didn’t upload, no passwords, device histories, geolocations, etc – but that’s fine. Those are all things that I can recreate from my secure storage, with my notes. And I’m working on keeping better code notes, because it’s getting ridiculous.

Best part? I can use a nice editor on any machine I like, make the changes, and push them to the repo. Then, I can run my update-hass script via ssh, which does a git pull and a hass restart. Awesome.

Eventually, maybe, I’ll automate that part – maybe a button inside hass to run a shell command for git pull? We will have to see.

Permanent link to this article: https://www.berserkir.net/wordpress/home-assistant-you-git/

Home Assistant

Hass.IO

Of all things, not something I expected I’d do. But, as it turns out – automation is definitely nice. I’ve got Wake-on-LAN working, and my lights etc – so I can turn on the lights in my office and boot up my workstation, with one button, on my phone. Everything is ready to use by the time I’ve made a coffee and walked from the kettle to the computer in the office.

Setup was surprisingly easy. I followed the official instructions, but I added some extra steps along with them (because I liked the look and function better).
Rather than everything being in configuration.yaml, I now have sensors in their own folder, with a yaml file per sensor (radarr, sonarr etc each have their own). Switches, themes, device trackers, zones… all separate files.

To be honest – it’s for my convenience. Being able to add a sensor and test around with it without risking damaging my existing config file is a godsend. YAML is space-sensitive, so one thing in the wrong place screws you.

curl -sL "https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh" | bash -s

That’s the command to install it on Ubuntu with docker already running. You need it for this method. After running it, open the web ui and create a user etc. Don’t bother going further than being able to log in – we’re going to change a lot.
mkdir /usr/share/hassio/homeassistant/custom_components
mkdir /usr/share/hassio/homeassistant/www
mkdir /usr/share/hassio/homeassistant/device_trackers
mkdir /usr/share/hassio/homeassistant/sensors
mkdir /usr/share/hassio/homeassistant/switches
mkdir /usr/share/hassio/homeassistant/themes
mkdir /usr/share/hassio/homeassistant/zones

The above commands will create the folders for HACS, and separate sensor configs. They help immensely. Next, we’re going to replace the default configuration file.

mv /usr/share/hassio/homeassistant/configuration.yaml /usr/share/hassio/homeassistant/configuration_default.yaml

That renames the default. It’s only there as a backup, for if this next bit royally f***s itself.

# Configure a default setup of Home Assistant (frontend, api, etc)
default_config:

# Uncomment this if you are using SSL/TLS, running in Docker container, behind a reverse proxy and exposed to the web etc.
#  http:
#    base_url: *YOUR HASS WEB ADDRESS*
#    use_x_forwarded_for: true

###########################################
# Simple Components
###########################################
map:
sun:

# Wake-on-LAN
# https://home-assistant.io/components/switch.wake_on_lan/
wake_on_lan:

###########################################
# Text to speech
###########################################
tts:
  - platform: google_translate
    service_name: google_say

###########################################
# Frontend
###########################################
frontend:
  themes: !include_dir_merge_named themes

###########################################
# Includes
###########################################
# Single Files
automation: !include automations.yaml
script: !include scripts.yaml
scene: !include scenes.yaml

# All Files in Folder
device_tracker: !include_dir_merge_list device_trackers
group: !include_dir_merge_list groups
sensor: !include_dir_merge_list sensors
switch: !include_dir_merge_list switches
zone: !include_dir_merge_list zones

That needs to go into /usr/share/hassio/homeassistant/configuration.yaml
To achieve this, nano /usr/share/hassio/homeassistant/configuration.yaml, followed by CTRL+O and CTRL+X (Overwrite and eXit).

Open your Web UI and go to Configuration -> Server Controls -> Restart. HASS will restart and reload the new config. Now any valid config file you place in the relevant folder will be loaded when restarting HASS. I’ve got a few Wake-on-LAN switches in the switches folder, some sensors for sonarr and radarr in the sensors folder, and hacs in the custom_components folder.
More on that in posts to follow.

Permanent link to this article: https://www.berserkir.net/wordpress/home-assistant/