summaryrefslogtreecommitdiff
path: root/content/blog/2022
diff options
context:
space:
mode:
Diffstat (limited to 'content/blog/2022')
-rw-r--r--content/blog/2022/ddns.md160
-rw-r--r--content/blog/2022/gnu-stow.md132
-rw-r--r--content/blog/2022/music-server.md159
3 files changed, 451 insertions, 0 deletions
diff --git a/content/blog/2022/ddns.md b/content/blog/2022/ddns.md
new file mode 100644
index 0000000..73d9aad
--- /dev/null
+++ b/content/blog/2022/ddns.md
@@ -0,0 +1,160 @@
++++
+title = "Dynamic DNS"
+author = ["Michał Sapka"]
+date = 2022-05-13T22:26:00+02:00
+categories = ["blog"]
+draft = false
+weight = 3001
+abstract = "DDNS is a DNS for folks with non-static IP. Here I try to choose the best for me."
+aliases = ["/2022/ddns/", "/articles/ddns/"]
++++
+
+I am one of the unlucky ones without static IP address.
+I would get one from my ISP, but this would require me to upgrade to a business contract.
+And to do such upgrade, I would need a company - which I do not own nor have I any plans to own in the near future.
+Luckily, I can still have a domain.
+There is a group of services under the umbrella term Dynamic DNS.
+
+[DDNS on Arch Wiki](https://wiki.archlinux.org/title/Dynamic_DNS)
+
+Basically, I need to point my domain to their name server and keep them up to date with changes of my IP.
+The DDNS server acts as a middle-man when using a normal domain.
+In most cases, I just need to fetch a given URL periodically ad the service will treat this as current IP set.
+
+
+## Self hosting vs 3rd party {#self-hosting-vs-3rd-party}
+
+There are ready-made packages I could install on any VPS, but debugging DNS is not something I would like to do.
+Therefore, I will go with 3rd party.
+
+I looked through the interwebs for providers and found lots of them.
+Unfortunately, most of them are dead, so the choice is much less difficult.
+
+
+## Requirements {#requirements}
+
+After a short analysis, I came up with few requirements:
+
+| Max number of domains | 3 |
+|-------------------------------------|------------|
+| Max number of subdomains per domain | 20 |
+| Expected uptime | 95.5 |
+| Location | Europe/USA |
+| MX Records | YES |
+| TTL | 10min |
+
+
+## Instant rejects {#instant-rejects}
+
+I instantly rejected some providers, since they will now work for my use case:
+
+| Service | Reason? |
+|----------------------|--------------------------------------|
+| activedns.co.za | South Africa only |
+| bcu.cc | Site does not open |
+| ddns.nu | Site does not open |
+| dhcp.io | Domain for sale |
+| dhs.org | Site does not open |
+| dns.widge.net | Site does not open |
+| dnsdynamic.org | Some random site under the address |
+| dnsmadeeasy.com | It's namecheap now |
+| dnspark.com | It's namecheap now |
+| dtdns.com | Broken site |
+| dyn.ee | Domain for sale |
+| dyn.ro | Domain for sale (I think) |
+| dynamicdomain.net | Site reads like poor phising attempt |
+| dyndsl.com | Domain for sale |
+| domain-dns.com | Not accepting new zones |
+| dyndnsservices.com | Offers self-host only |
+| dynfree.com | Broken site |
+| dynup.net | Broken site |
+| hldns.com | No longer offers DDNS |
+| hn.org | Site does not work |
+| homepc.org | Site does not work |
+| hub.turnkeylinux.org | Site does not work |
+| microtech.co.gg | Site does not work |
+| minidns.net | Site does not work |
+| myonlineportal.net | Only 10 domains per account |
+| myserver.org | Broken site |
+| nettica.com | Domain for sale |
+| nicolas.cx | No sign-up via web |
+| nubem.com | Site does not work |
+| ods.org | Domain for sale |
+| powerdns.com | Self hosted solution |
+| prout.be | Self hosted solution |
+| spdns.de | No english site |
+| system-ns.com | No longer offers DDNS |
+| tzo.com | Site does not work |
+| whyi.org | Site does not work |
+| worldwidedns.net | Does not support enough zones |
+| xname.org | Site does not work |
+| yi.org | Site does not work |
+
+\## The potential ones
+
+After removing most positions from list, I dig a big deeper:
+
+| Service | Price | Uptime | Location |
+|--------------------|--------------|-----------|-------------|
+| | per year | | |
+| changeip.com | $6 | 99.9% (1) | USA |
+| dhis.org | Donation | ? | ? |
+| dns2go.com | lots$ | ? | ? |
+| dnsexit.com | FREE for TLD | 100% | Distributed |
+| duckdns.org | FREE | ? | ? |
+| duiadns.net | $11 | ? | ? |
+| dynaccess.de | 22EUR | ? | Germany |
+| dynamip.com | $48 | ? | ? |
+| dyndns.berlin | FREE | ? | Germany |
+| dyndns.com | $55 | ? | ? |
+| dyndns.dk | FREE | ? | ? |
+| dynip.com | lots$ | ? | ? |
+| dyns.cx | Donation | ? | ? |
+| dynu.com | FREE | 100% (2) | Distributed |
+| easydns.com | FREE | 100% | ? |
+| freedns.afraid.org | $60 | ~99.3%(3) | ? |
+| noip.com | $24.99 | 100% (2) | ? |
+| planetdns.net | $299.95 | ? | ? |
+| staticcling.org | FREE | ? | ? |
+| thatip.com | $48 | ? | ? |
+| thebbs.org | FREE | ? | ? |
+| totaluptime.com | $1188(SIC!) | ? | ? |
+| zonomi.com | lots$ | ? | ? |
+
+- [(1) whtop.com](<https://www.whtop.com/review/changeip.com>)
+- [(2) comparingtech.com](<https://www.comparitech.com/net-admin/dynamic-dns-providers/>)
+- [(3) dnsperf.com](<https://www.dnsperf.com/dns-provider/afraid-org>)
+
+Notes:
+
+- "?" - I couldn't find data, but also I wasn't looking very hard
+- "lots$" - some providers have a complicated pricing and at first glance it was obvious, that it will be expensive.
+
+ As we see, some working providers are crazy expensive. They add extra features, but still - crazy expensive.
+
+
+## Conclusion {#conclusion}
+
+DDNS is a strange market. It's mostly dead. But when the service is still available, it seems to be run from someone's basement. There are companies in the space, don't get me wrong - but most of it looks like hacker culture byproduct. And this makes sense, since the primary use case for DDNS is someone without static IP - ergo, an individual and not a company.
+
+The sad aspect of this is lack of any SLAs in most cases.
+
+The happy aspect of this is that you can get a lot for very little.
+
+
+## Decision {#decision}
+
+Looking at the data, I have decided to go with dynu.com as it has 100% uptime, and it's free.
+
+
+## Setting up dynu.com on Synology {#setting-up-dynu-dot-com-on-synology}
+
+First, create a dedicated IP update password on dynu.com. It's optional, but highly recommended.
+
+Then, in Synology Control Panel open External Access, then click on "DDNS" tab. Click "Customize Provider" and set query URL to
+
+```nil
+https://api.dynu.com/nic/update?myip=__MYIP__&username=__USERNAME__&password=__PASSWORD__&hostname__HOSTNAME__&myipv6=no
+```
+
+Now, add a subdomain. Note, that it would be best to MD5 the password.
diff --git a/content/blog/2022/gnu-stow.md b/content/blog/2022/gnu-stow.md
new file mode 100644
index 0000000..5d06dee
--- /dev/null
+++ b/content/blog/2022/gnu-stow.md
@@ -0,0 +1,132 @@
++++
+title = "GNU Stow"
+author = ["Michał Sapka"]
+date = 2022-06-09T22:26:00+02:00
+categories = ["blog", "update"]
+draft = false
+weight = 3002
+abstract = "GNU Stow is a tool for managing symlink farms, used primarily for dotfiles. Here you can find a short guide on how to use it."
+aliases = ["/articles/gnu-stow"]
++++
+
+If you are working with Linux/BSD based system, you are most likely accustomed to managing your configs with dotfiles.
+And you most likely have them stored with Git.
+But there is the never ending problem of how to actually use them.
+I have moved management of this under GNU Stow.
+
+Let's take a very typical dotfiles repository.
+
+```shell
+./nvim/init.lua
+./tmux/tmux.conf
+```
+
+You want to have those files available as
+
+```shell
+~/.config/nvim/init.lua
+~/.tmux.conf
+```
+
+The most popular approach would be to symlink the files under the expected location.
+We could also copy the files every time something changes, but that would be crazy.
+Are we the stuck with having to do those symlinks manually every time we install a new machine or create a virtual one? And what if we have dozens of such configs stored under git?
+
+
+## Symlink farm {#symlink-farm}
+
+GNU Stow is a symlink farm.
+This means, that it's a system aimed at automating creating of those symlinks.
+
+[GNU Stow website](https://www.gnu.org/software/stow/manual/stow.html)
+
+For Stow, the dotfiles directory is called "Stowed" directory.
+Now comes the cool part.
+Each folder in the Stowed directory (called "Package directory") stores a separate directory tree.
+GNU Stow will join all those separate trees and create a proper structure under Target Directory, which by default is the parent of Stowed directory.
+Let's look at example.
+
+```shell
+~/target/stow/one/config/one.conf
+~/target/stow/two/config/two.conf
+~/target/stow/three/config/three.conf
+```
+
+So, our home director now has a "Target" directory, which has a "Stow" directory.
+The Stow directory stores three configs which we want to symlink as
+
+```shell
+~/target/config/one.conf
+~/target/config/two.conf
+~/target/config/three.conf
+```
+
+Let's stow the first one
+
+```shell
+cd ~/target/stow
+stow one
+```
+
+And see what happened
+
+```shell
+cd ~/target
+ls -lA
+```
+
+We get something like
+
+```shell
+lrwxrwxrwx 1 msapka wheel 15 Jun 9 23:01 config -> stow/one/config
+drwxr-xr-x 5 msapka wheel 4096 Jun 9 22:55 stow
+```
+
+Stow created a config symlink in the target directory.
+Very cool, but it gets cooler! Let' stow the second one
+
+```shell
+cd ~/target/stow
+stow two
+```
+
+and what we get
+
+```shell
+drwxr-xr-x 2 msapka wheel 4096 Jun 9 23:03 config
+drwxr-xr-x 5 msapka wheel 4096 Jun 9 22:55 stow
+```
+
+Our config is no longer a symlink, but a real folder.
+Let's see what's inside here.
+
+```shell
+cd config
+ls -lA
+```
+
+```shell
+lrwxrwxrwx 1 msapka wheel 27 Jun 9 23:03 one.conf -> ../stow/two/config/one.conf
+lrwxrwxrwx 1 msapka wheel 26 Jun 9 23:03 two.conf -> ../stow/one/config/two.conf
+```
+
+We have our two configs, but what has happened?
+Stow looked at both subtrees for "one" and "two" and joined them in a way, that is possible.
+The only way for one.conf and two.conf to exist in config is if config is a normal directory. Extremely cool!
+
+Let's image that our target is actually homedir, so we have a ~/dotfiles directory.
+Then each package directory can mimic the tree structure of the actual config! Coming back to our example, we can have a
+
+```shell
+~/dotfiles/tmux/.tmux.conf
+~/dotfiles/nvim/.config/nvim/init.lua
+```
+
+Then, after stowing both packages we have symlinks under our desired
+
+```shell
+~/.config/nvim/init.lua
+~/.tmux.conf
+```
+
+GNU Stow is a very simple tool. All we need to understand what will happen with each subtree.
diff --git a/content/blog/2022/music-server.md b/content/blog/2022/music-server.md
new file mode 100644
index 0000000..ce79ebb
--- /dev/null
+++ b/content/blog/2022/music-server.md
@@ -0,0 +1,159 @@
++++
+title = "Adding simple music server to my network"
+author = ["Michał Sapka"]
+date = 2022-05-25T22:26:00+02:00
+categories = ["blog"]
+draft = false
+weight = 3003
+abstract = "As part of my partitioning with streaming services, I have created a small music server on my home network. This article touches on how to get music, how to store and how to actually listen to it."
+aliases = ["/articles/music-server", "/2022/music-server"]
++++
+
+_This is an old article, and even though it is still valid, I no longer use Linux_
+
+One of my goals for 2022 is to not pay for music subscriptions anymore.
+Nowadays, it's really easy and cheap to actually own my music.
+
+
+## Getting music {#getting-music}
+
+Internet is full of cheap, used CDs and new music is ready for purchase on sites like Bandcamp.
+Since I mostly listen to dead people, CDs are my primary source.
+
+The first problem is having something to put a disc in.
+I've gotten myself a cheap USB-CD/DVD drive.
+It's very loud, but since I use it only for getting the data to my computer, it's not a problem.
+
+I rip (a word that I have not seen in a long time) on MacBook using XLD app.
+I plan to move this step to Linux soon.
+
+[XLD homepage](https://tmkk.undo.jp/xld/index_e.html)
+
+I rip the music to FLAC, which seems to be standard.
+It's lossless and most file-based players have no problems with it.
+Of course, not everywhere.
+iOS is always problematic, but I don't listen to music on the go very often, so it's a problem for future me.
+
+A single album in FLAC takes about 200-300 MB.
+I still remember MP3 days, where it would go down to 60 MB or less, but back then storage and transfer were actually expensive.
+I don't hear any noticeable difference between FLAC and good compressed file, but again - storage and transfer is cheap, Furthermore I have a single high-res album where half an hour takes 750 MBMB and there is zero difference.
+Well, now I know, and I won't buy-high res ever again :)
+
+
+## Storing and serving music {#storing-and-serving-music}
+
+The music will be accessed by multiple devices on local network, so putting it on the Home Server makes perfect sense.
+I now have a dedicated share "music" which is shared via Samba and NFS.
+
+Samba seems better than NFS, but then NFS on Linux is simpler to set up.
+
+For Samba, I need to add read+write access to Music share for each user from Synology web UI.
+
+NFS on the other hand doesn't support users, but devices instead.
+The first step is to set static IP for my devices (which is always a good idea).
+How exactly this should be approached depends on the setup, but I use UniFi Dream Machine and forcing IP for a device is very straight forward.
+After I have static IPs, I can add read/write access for those addresses, also via Synology web UI.
+
+Served music is so small, that this does not add any noticeable overhead for the server.
+
+
+## Accessing the music on Linux {#accessing-the-music-on-linux}
+
+First, I needed to install NFS support. I use Arch, so:
+
+```shell
+pacman -S nfs-utils
+```
+
+Then I checked if the share actually exists. My server's address is 10.0.1.200.
+
+```shell
+showmount -e 10.0.1.200
+------------------
+Export list for 10.0.1.200:
+/volume2/music 10.0.1.10
+```
+
+Voilà! Next step: check if it works
+
+```shell
+mkdir /mnt/music
+mount 10.0.1.200:/volume2/music /mnt/music/
+cd /mnt/music
+ls
+```
+
+And listing worked.
+Noice.
+To automate it for future, and to allow non-root users to actually mount the drive I added a new mount to /etc/fstab:
+
+```shell
+10.0.1.200:/volume2/music /mnt/music nfs _netdev,noauto,x-systemd.automount,x-systemd.mount-timeout=10,timeo=14,users,x-systemd.idle-timeout=1min 0 0
+```
+
+After the first user accesses /mnt/music, the drive will be mounted.
+
+
+## Playing the music using CMUS {#playing-the-music-using-cmus}
+
+We have access to the files, let's play it.
+Every modern music player for Linux should work with Flac, but I've chosen CMUS.
+It's fast, it's terminal based, and it supports VIM keybindings.
+
+[CMUS on Github](https://cmus.github.io/)
+
+```shell
+pacman -S cmus
+```
+
+After we open cmus, we need to add music.
+It's done similarly to VIM, via an ex command.
+
+```shell
+:add /mnt/music/
+```
+
+And a few seconds later, the music is visible in the player.
+Using CMUS requires reading the manual
+
+```shell
+man cmus-tutorial
+```
+
+but the basics I needed to play something from Artist/Album view were:
+
+| key | descrition |
+|-------|---------------------------------------|
+| j | go up |
+| k | go down |
+| tab | change active window (artists/tracks) |
+| space | expand artist to album list |
+| c | play track / pause track |
+| e | add track to queue |
+| q | exit |
+
+Extra bonus: after first configuring system I had some problems with audio not working from time to time.
+Moving from Pulse to Pipewire solved them all.
+
+[Pipewire webpage](https://pipewire.org/)
+
+
+## Listening on Mac via CMUS {#listening-on-mac-via-cmus}
+
+I have no idea how to auto mount a server on MacOS, so after every reboot or network change, I need access the Samba share via Finder.
+After it's mounted, I can access it under /Volumes/music.
+
+On Mac I also use CMUS, so all of the above apply as well.
+One difference is adding the files due to different location
+
+```shelll
+:add /Volumes/music
+```
+
+
+## Next up {#next-up}
+
+This doesn't solve all my needs. In the future I need to find out how to:
+
+- Access The Music Outside My Home Network
+- how to marry this setup with my multiroom system (Sonos + Homepods)