What to do when your Internet is too slow for composer?

Like the problems I was having with Docker timeouts, I recently had problems on my slow home Internet getting PHP’s composer to build the assets for a project.

The error message contained “exceeded the timeout of 300 seconds” so it was easy to identify.

The fix, run from the terminal was:

export COMPOSER_PROCESS_TIMEOUT=1500

Where the number is the number of seconds before a composer operation timesout.  This fix is temporary, for a permanent solution have a look at how to make environment variables persist.

What to do when your rural high speed Internet is too slow to use Docker?

On my mid-2010 MacBook Pro I was trying to get Docker running to experiment with. It isn’t quite modern enough to run Docker for Mac because of an incompatible CPU.

I was able to get things running though by installing Docker Toolbox which puts the Docker daemon inside a VirtualBox VM. While trying to pull down an image to build a container via docker pull the command would fail and I would get the error message:

unauthorized: authentication required

This seemed weird, I’ve never had that problem on my work machines. These are public images, why would I need to be authorized? What could be the difference? The fact that the failure happened after some of the larger files were downloading made me think that something was timing out. It seems that there is token authorization happening during the download process and they are expiring. And these downloads were much, much slower on my home 2Mbps connection compared to 100Mbps at the office.

Some Googling pointed to an option for the Docker daemon that may help:

–max-concurrent-downloads

So in the case of having the Docker daemon on a vm, I used the docker-machine command to SSH to the daemon to put this extra config into a daemon.json file that is parsed when the daemon starts.

First, from your OS terminal:

docker-machine ssh

Then when you are logged into Docker VM:

echo ‘{“max-concurrent-downloads”:25}’ | sudo tee /etc/docker/daemon.json

This ensures that all of the files are downloaded concurrently, starting to download before what I assume is the token expiring. You will need to restart the daemon, I did it from directly inside the vm with

sudo /etc/init.d/docker restart

While our slow “high speed ultra” Internet has been an annoyance with poor quality audio and video and slow downloads, it has never caused something to absolutely not work without modification. This is a demonstrable example of how the poor quality of PEI’s rural Internet can impact employment and innovation.

Stormiest Winter Periods on Prince Edward Island

Talk to a few Islanders about the weather during the winter and you’ll usually hear that there are certain times of the year like St. Patrick’s Day when a winter storm is more likely.

Let’s look at the frequency of 10+ cm during five day periods from 1944-2016. For the days below we show the percentage of years that had at least 10cm of snow fall on a single day during the 5 day time period focused on that day (that day, 2 days before, and 2 days after).

So on December 17, 10cm+ of snow has fallen in the 2 days before, the day of, and 2 days after on average 57.3% of the time. With this calculation I’m trying to find periods of time that tend to get moderate/heavy snowfall.

December 16, 17 & 18 tend to get a moderate/heavy snowfall the most often followed by the time period of February 15, 16 & 17 and their surrounding days. In a followup post, I will show that the mid-February storms pack a greater punch though. November and March seem to ease us in and out of the winter season when it comes to snow.

It also looks like a heavy snowfall around Boxing Day is more frequent than around St. Patrick’s Day!

Continue reading “Stormiest Winter Periods on Prince Edward Island”

WordPress as a static website generator?

WordPress is a great blogging platform. It’s easy to create content and has a good ecosystem of plugins and themes to extend your website. But it has a few problems that have kept me from using it for personal projects:

  • security – WordPress security has improved a good deal over the past few years but there are still core security issues being exploited yearly. With auto-updates, the risk is minimized but it’s still there. Plugins exist to better secure WordPress, but core issues can never be completely protected via plugins. WordPress installations can’t be neglected for this reason.
  • performance – WordPress out of the box isn’t very fast and chews up memory. Again, there are plugins of various quality with cumbersome installation steps that may mitigate these issues. There are server side caching solutions as well, but for a personal website why bother?

When it comes down to it, most personal blogs are just serving HTML content with little need for the dynamic abilities that PHP gives to WordPress.

What about WordPress.com? The cost is certainly reasonable, but the arbitrary limitations on what can be customized and enabled just doesn’t seem right.

But what if we think about WordPress as a static website generator? When WordPress is first installed, the only dynamic functionality that is enabled besides the admin dashboard is commenting and search (and XML-RPC and REST…). If you don’t need that functionality or can find alternative services, using WordPress as a static website generator is relatively straightforward.

Continue reading “WordPress as a static website generator?”