Thu, 2 Sep 2021

Character Encoding

— SjG @ 4:25 pm

Hm. Looks like the server upgrade from Ubuntu 18.04.5 LTS to Ubuntu 20.04.3 LTS changed some character encoding defaults somewhere. I’ll have to track down if it’s in the database (most likely), the database connection (possible), PHP, or somewhere else.

In the mean time, please forgive the occasional bad unicode character.

Filed in:

Tue, 31 Aug 2021

Short-wave antennas

— SjG @ 11:00 am

English is a weird language. Insects, have two things called “antenna” sticking out of their heads and the plural is “antennae.” A radio tower, which is an antenna, is pluralized “antennas.”

Anyway, according to Los Angeles County, California – Code of Ordinances Title 22 – Planning and Zoning Division 7, section 22.140.040 – Amateur Radio Antennas, pending a Ministerial Site Plan Review, we could set up our antenna for 75 ft tower/mast, just so long as it is lowered to 35 ft total height when not in use. There are also rules preventing towers from being on the “street side” of the house, or in the front 40% of the lot. Some of these rules have carve-outs for civil defense or emergency responder applications, as well as for proximity to power lines, which could be relevant with the poles along the back of our lot.

Companies like HyGain make a great “crank-up” towers that are suitable for residential like this example setup for 14 MHz, 21 MHz, and 28 MHz HF operation. Likewise, the Aluma T-75HN extends to 75 feet but cranks down to 25 ft when not in use.

In the event of major disasters, having short-wave communication capability could be vital in helping coordinate rescue and incident operations (obviously, having backup power for the system is going to be an important component too).

A wide-angle lens adds distortion that makes it hard to pre-visualize, but here’s a possible perspective view. Specific antenna details would vary depending on the bands we opt to use.

Perspective view
Filed in:

Fri, 9 Jul 2021

Virtual Apache SSL Hosts in a Docker Container

— SjG @ 1:40 pm

You might want to “containerize” your development hosting environment so you can easily migrate it from machine to machine. As a Docker noob, I had a bunch of issues getting this set up the first time, and wanted to share a working configuration. This example assumes you have Docker installed and operating. You can also skip reading this, and just download the files at GitHub.

First, we’ll need to create some directories. I create one for the Apache configurations, and one for the code projects I’ll be working on.
mkdir apache-php
mkdir project

Within project, you can check out the code for your various projects into subdirectories. For simplicity, I’ve created project1 and project2 in the sample code. The Apache web server within the container will serve content from these directories.

We’re going to use a fictional top-level domain (TLD) for our development environment. This way, the URL you use to access your sites will be the same every time you spin up a new dev environment, without having to worry about name servers. You do, however, have to worry about your /etc/hosts file (or your platform’s equivalent). Choose a TLD that will be easy to remember. For my example, I’m using “mylocal”. One thing to avoid: start the TLD with a letter rather than a number. Don’t include characters like hyphens. Please learn from my mistakes.

Edit your /etc/hosts, and add the lines: project1.mylocal project2.mylocal

Next, we’ll want to create an SSL certificate for use in development. The easiest way to do this is with mkcert. Once you have mkcert installed and working, you’ll create a wildcard certificate for your TLD:
cd php-apache
mkcert -install mylocal "*.mylocal"

Next, we create a compose.yaml file:

version: "3.9"
container_name: ApachePHPVirtual
- apache
context: .
dockerfile: PhpApacheDockerfile
- "./project:/var/www"
- 80:80
- 443:443
- "project1.mylocal:" # remember to add " project1.mylocal" to your /etc/hosts file or equivalent
- "project2.mylocal:" # remember to add " project2.mylocal" to your /etc/hosts file or equivalent
hostname: project1.mylocal # default
domainname: mylocal
tty: true # if you want to debug

This is pretty straightforward. We’re creating a container which we’ll call “ApachePHPVirtual,” it will have a network we call “apache” if we want to connect using other containers, and it links our top level project directory to /var/www in the container. We map ports 80 and 443 on our host machine to those same ports in the container. The extra_hosts directive adds our project names to the container’s /etc/hosts. We set up the container’s hostname to match our first project, and set the default domain to our “mylocal” TLD.

We then want to create configurations for each of the Apache virtual hosts. In the php-apache directory, we create config files for each project. These are just standard virtual host declarations, e.g.:

<VirtualHost *:80>
    ServerName project1.mylocal
    Redirect permanent / https://project1.mylocal/
<VirtualHost *:443>
    ServerName project1.mylocal
    DocumentRoot /var/www/project1
    ErrorLog ${APACHE_LOG_DIR}/project1-error.log
    CustomLog ${APACHE_LOG_DIR}/project1-access.log combined
    DirectoryIndex index.php

    <Directory "/var/www/project1">
        Options -Indexes +FollowSymLinks
        AllowOverride all
        Order allow,deny
        Allow from all

    SSLEngine On
    SSLCertificateFile    /etc/apache2/ssl/cert.pem
    SSLCertificateKeyFile /etc/apache2/ssl/cert-key.pem

You’ll need to create a similar configuration for each project. Note that the Document Root points at the mapped host directory. That means you won’t need to rebuild the container to see project changes.

The actual image for the Apache/PHP container is created and configured in our next file, “PhpApacheDockerfile”. So we create that:

FROM php:8.0.8-apache-buster

# add some packages
RUN docker-php-ext-install curl gd iconv pdo pdo_mysql soap zip

# Apache Config
COPY php-apache/project1.conf /etc/apache2/sites-available/project1.conf
COPY php-apache/project2.conf /etc/apache2/sites-available/project2.conf
COPY php-apache/mylocal+1-key.pem /etc/apache2/ssl/cert-key.pem
COPY php-apache/mylocal+1.pem /etc/apache2/ssl/cert.pem

# mod rewrite! SSL!
RUN a2enmod rewrite
RUN a2enmod ssl

# enable sites
RUN a2ensite project1.conf
RUN a2ensite project2.conf
RUN service apache2 restart

This pulls the php-8.0.8 image from DockerHub, adds in some PHP extensions, copies over our SSL certificate and key, copies our virtual host configuration files over, enables the projects, and restarts the Apache server.

Now, all that remains to do is build it and power it up:

docker-compose build && docker-compose up -d

You can now visit the project URls in your browser, e.g., https://project1.mylocal/

Fri, 18 Jun 2021


— SjG @ 11:54 am

Plumbing progress has been made, with the water heater and toilets installed. Cabinets arrived yesterday and installation has begun.

Filed in:

Tue, 1 Jun 2021

Bimonthly Update

— SjG @ 2:22 pm

Still waiting on the cabinets, but that doesn’t mean nothing’s going on. There’s a lot going on behind the scenes. For now, I’ll just post pictures of the exterior light fixtures, the staircase railing, and some pictures of the happy springtime front garden (to compare, for example, to this view from February).

Filed in: