Using a CDN at home for free!

Cloudflare are nice enough to provide a free tier to their CDN service which is perfect for those of us that still host websites at home. The free teir provides some basic benefits - DDOS protection and caching. Check out the details here - https://www.cloudflare.com/plans/#overview

If you utilize their tunneling solution, you’ll also be able to host websites behind a dynamic IP. You’ll no longer need a static IP. This means the traffic goes like so;

Solar v2 - choosing the components

Since my first attempt at solar, I have learnt a few things and several new bits of tech have been introduced into the market. Some of the new tech include; all-in-one inverters, bigger “better” batteries, shingled solar panels and micro-inverters…

Time to take the learnings from my first solar project and scale-out

New Parts

An all-in-one solar inverters can include the following functions in a single device;

  • Solar Controller - MPPT (2x string inputs)
  • Inverter - Converts DC (48v) to AC (pure sine wave @230v, 50 hertz)
  • Battery Charger -
    • from Grid (AC -> DC)
    • from Solar Panels (DC -> DC)
  • ATS / Line mode - Flicks over to Grid if solar or batteries are low
  • BMS, Timers and Controls - Can program battery types, priorities and timers depending on how you want to power your loads and utilize your batteries.
  • Stats / Alerts - WIFI enabled

Visual Studio Code - Adding GitLab repository

How do you setup a GitLab repo on Microsoft Visual Code?

There are two main scenarios -

  1. You have the code on your workstation and you want to push into a clean / new repository
  2. You want to pull code from an existing gitlab repository onto your workstation

First go to your local folder on your workstation (either empty or full of code)

git init 
git add .
git remote add origin https://<username>:<usertoken>@gitlaburl.com/project/repo.git

The above commands tell git to run initial setup, add current folder as content then add associated remote gitlab repository.

emergency reboot a hung Linux host

Sometimes you need something that can kick a host a bit harder than the standard reboot command. Even if you include the -f switch to force, a hung task can prevent your host from rebooting.

Try this - first enable the sysrq setting, then trigger. Your host should reboot immediately.

sudo echo 1 > /proc/sys/kernel/sysrq
sudo echo b > /proc/sysrq-trigger

Note : This is effectively a hard reset which does not cleanly shut services or tasks down. You may need to check your disk on some operating systems.

HEVC media optimization

Do you have a large collection of video media files not using HEVC (H265) yet? There is a massive amount of disk space coming your way if you flick over to the new video codec format.

HEVC definitely lives up to its name, for most media you can expect a 70% or more disk savings from transcoding from an old codec. There are some catches though… If you want your TV to play it direct (i.e. straight off the file) the codec will need to be supported by it. You can of course get around this by using a media server such as Plex or Emby which will transcode from HEVC back to a compatible format.

Solar - In Summer

Power generation is up in summer :)

The last stat “Total Power (1M-7d)” gives me a view of how much power was generated over a 30 day period 7 days ago (so i can tell if power generation as an average is going up or down). Right now it power generation this on a downward trend.

(see previous post for winter generation)

Solar - modifications complete

Two recent modifications to my solar system have changed the daily generated power considerably.

First section highlighted above - i added the ATS and 24/7 load (this server)

Second section highlighted above - moving the 6 panels from east and west to north facing roof. (only reason i didn’t do this initially is north facing roof is a lot higher and i hate heights!)

Copper wire gauge and max amps

Do not skimp on your wiring across your solar installation. Pushing too many amps across a wire that is too small can cause fires and short your installation - this is dangerous!

A rightly sized wire reduces resistance and can assist with reducing voltage drop.

For example, in my system i have a 1000W inverter attached to my 24v battery. If i’m pulling 1000W, then amps 1000W / 24V = 41.67A. Meaning i should be using a 6 gauge wire (see below) between my battery and inverter.

ATS - 24/7 power loads on solar!

By hooking up my ATS in my solar system, I’m nearing the end of my solar experiment. I cannot recommend the ATS (automatic transfer system) more, such a brillient device.

By installing the ATS i am keeping my solar power generated off grid, but with on grid backup for any loads i attach to it. Also keeps me away from any danger introduced by back filling the grid

So i can run a 24/7 load which will automatically flick over to main power when the batteries are low. At the moment i am powering my attached server (the load) approx 33% of the day. I could power my server for longer if i had a larger battery attached to solar. Its currently winter, so sunlight hours are also limited.

lead acid battery "state of charge" chart

Lead acid batteries do not like being completely discharged. I have used the following chart for reference, in most cases i only discharge my battery to 50% DOD (depth of discharge).

Even deep cycle lead acids life (max charge cycles) will be extended if it is not completely discharged. It is also generally recommend to completely charge your battery after use - i.e. take the battery back to full charge in a single cycle.

Home Solar Experiment

So I’ve been busy building a new solar array, mostly as a hobby and its been crazy fun. Electrocuted my self twice, but luckily nothing too bad.

I’ll write up some more detail round the build, the metric collection and the things i have learnt over my time.

Keep in mind that NZ is in the southern hemisphere, so its winter as i’m writing this. Low sun hours! Stats publicly available via grafana here - https://grafana.sigtar.com

M365 Electric Scooter - must have mods

I’ve been riding my m365 xiaomi scooter for quite some time now… over its time i have made a few mods to make it a better and more reliable ride…

First - The tyres.

Sticking with pneumatic are best, they are lighter and generally have better grip when they are in good shape (i.e. not plastic). The only downside is the tube puncturing every now and again. The slime you can inject into your trye also is pretty average, it increases weight slowing you down.

Mi / Xiaomi Scooter Error codes

Scooter beeping? - check out these codes for a hint at what might be wrong…

Error code Description Malfunction part
10 Dashboard and control board communication abnormal,check connected cable Dashboard、control board
11 Motor A phase current abnormal ,check control board control board
12 Motor B phase current abnormal ,check control board control board
13 Motor C phase current abnormal ,check control board control board
14 Throttle hall abnormal,check electric throttle、dashboard and connected cable dashboard 、electric throttle
15 Brake hall abnormal,check electric barke、dashboard and connected cable dashboard、electric brake
16 Battery change MOS abnormal,check control board control board
17 External battery change MOS abnormal,check control board control board
18 motor hall abnormal,check motor、control board、connected cable. control board、motor
19 Battery voltage abnormal,check battery、control board、connected cable. control board、battery
20 External battery voltage abnormal,check battery、control board、connected cable. control board、battery
21 Battery communication failed,check battery、control board、connected cable battery
22 Battery code failed,change battery battery
23 Battery default serial number,change battery battery
24 System voltage test abnormal,check control board control board、battery、external battery
25 Undefined  
26 Flash saving error,check control board control board
27 Control code error,change control board control board
28 Motor driver mos up-bridge short circuit control board
29 Motor driver mos down-bridge short circuit control board
30 Undefined  
31 Program skip error,check control board control board
32 Undefined  
33 Undefined  
34 Undefined  
35 Unit has default serial number,change control board control board
36 Undefined  
37 Undefined  
38 Undefined  
39 Battery temperature sensor abnormal,change battery battery
40 Control board temperature abnormal,check control board control board、battery
41 Exteral battery temperature abnormal,change external battery external battery
42 Exteral battery communication error,check external battery、control board、connected cabel control board、external battery
43 Exteral battery code error,change external battery external battery
44 External has default serial number,change external battery external battery

Brave Browser - another non-ad web alternative?

 Brave is a web browser that has been about for while, but i only happened across it when it made its way onto the android platform.

It presents another concept which supports web content creators without subjecting viewers to horrendous ads, both in their content and in their speed detriment.

Check their site out here - https://brave.com

Crypto mining failed me (see coin hive here), ads are annoying and more and more likely to be blocked via various plugins and tools. The Brave browser blocks all ads by default and builds up a profile on where you are spending your time on the web. Contributions are then made to the various sites if they are registered to the “BAT” system, which is a way of rewarding the content providers.

time to disable coinhive - hysteria ensues

See my previous post here - /2017/10/13/coinhive-alternative

So the trial of coinhive and associated monero browser mining has come to an end. It seems most corporate firewalls and security appliances detect and block access to my domain just being associated with the coinhive java-script.

Even though i was being a polite net citizen and disclosing it on the site - firewalls with strict polices dont give it a chance. Several public DNS servers have also block listed the site - hopefully this will be undone soon.

moving wordpress to http2 (via https)

    

I just moved my wordpress site to http2 (via https). Some advice on steps to moving your site ;

  • Run it behind nginx + lets encrypt - offload ssl certs and get http2 performance
  • Setup nginx default to redirect all http -> https
  • update your WordPress site to correct URL (via admin / settings / general)  i.e.
  • Run WP plug-in to change all media / links to new https links. Else you get mixed secuirty (some http, some https)

SSL caching and redirects in chrome

While setting up SSL reverse proxy using lets encrypt and nginx i  had a few troubles with testing via googles Chrome browser.

  • Chrome caches some SSL responses which can be cleared by deleting your browsing data via settings or Ctrl+Shift+Del.
  • Chrome also caches http -> https redirects, you can see these by going to chrome://net-internals and select “HSTS” from the drop down. Enter the domain name under “Delete domain” and press the Delete button

The easiest thing to do during testing is use incognito mode. You will not need to clear the cache every time you change config or re-issue certificates.

bye bye http - hello letsencrypt

I’ve been a fan of HTTP and caching since my dial-up modem.

Skip to today where google returns HTTPS sites higher in its search results. Its could also be possible that you cannot trust a man in the middle HTTP cache any longer either right? :)

SSL certs have traditionally been expensive, but say welcome to lets encrypt which provides a free way of securing all of your websites. If you haven’t heard of it check it out here - https://letsencrypt.org/

steamcache for gaming

Assuming you have docker running at home, check out these two docker projects - one is the cache (powered by nginx), the other is the dns servcie (which intercepts steam calls)

  1. https://hub.docker.com/r/steamcache/steamcache
  2. https://hub.docker.com/r/steamcache/steamcache-dns
  3. https://hub.docker.com/r/steamcache/sniproxy

When you have all three up and running you can confirm HITS to the cache by running the following against the steamcache container;

docker exec -it steamcache tail -f /data/logs/access.log

This is great if you have a gaming cafe or LAN over at your house on occasion, all steam games will be cached to local disk so that your internet pipe gets a break. ;)

Ubuntu - Disable Firewall

if your working with Ubuntu in lab or test env, you may want to disable firewall…. two simple commands;

sudo ufw disable 

sudo apt-get remove ufw 

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
ufw
0 upgraded, 0 newly installed, 1 to remove and 3 not upgraded.
After this operation, 838 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 64052 files and directories currently installed.)
Removing ufw (0.35-0ubuntu2) ...
Skip stopping firewall: ufw (not enabled)
Processing triggers for man-db (2.7.5-1) ...