Disable blue blinking light on Odroid C2

I recently purchases an Odroid C2 unit which I used for hosting some sites. This site, amongst others, runs on it. The unit sits in my livingroom behind the couch. The case is transparent and there was an annoying blue light which blinks ever second. At day time this is not a problem, but during the evening and nights this became a problem. Lucky I found an easy solution on the Odroid forum:

sudo -Hi
echo none >/sys/class/leds/blue\:heartbeat/trigger

By executing these commands on the terminal of the device the blinking will stop. It is removed at reboot however, so you should add the 2nd line to your /etc/rc.local file to have it set at boot time.

Source

Leave a Comment

Enabling swap on raspberry pi

Yesterday I was building something from source on my Raspberry Pi B model. It was a text to speech project with some large source files, for the models. Compilation would keep failing because of an out of memory error (which is not surprising, since this model only has 512 MB of memory). Using swap on a raspberry pi is not something you should do normally, but when running into problems like this, I feel it is ok to temporarily enable swap, until compilation is complete.

I decided to grab an old usb stick and use that as the swap partition. You should never use the SD or Flash card of the device itself, since the constant writes will wear it out pretty fast. On stackexchange I found a simple guide to enable swap (raspberrypi.stackexchange):

mkswap /dev/sda
swapon /dev/sda

WARNING: all data will be cleared from the usb drive! This assumes that the usbstick is mapped as device sda after insertion. After you can run the memory-intensive task. Be aware that it will probably very slow, because of the swapping. My build task ran for 1,5 day. When the job is completed, you can run the command below and remove the usb drive.

swapoff /dev/sda

Leave a Comment

Article on deploying PHP applications with minimal downtime

On murze.be an article is published that explains how to perform deployments minimal with downtime. The article uses envoy, a taskrunner of the Laravel framework, but the described mechanism can also be used without.

The steps basically boil down to:

  • Place the code in a folder below the htdocs root
  • Copy configuration and other files if necessary from the previous deployment to this folder
  • Unlink the current document root
  • Create a link from the new deployment folder to the document root

Read https://murze.be/2015/11/zero-downtime-deployments-with-envoy/

Leave a Comment

Free space on /boot path in Linux

When executing apt-get upgrade on my Linux machine I got the error that it could not execute because the /boot folder was full. And indeed, when executing du -h there was only 3% of space left on /boot.

As it turns out, there are old kernels stored in /boot, limiting me from updating. Since I only use the latest one the older versions can be removed.

This link explains in simple steps how to find and remove the older kernel versions.

The summary of the page above is to execute the command below (at your own risk!). First execute the dry-run to check what is removed:

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get --dry-run remove

If everything checks out run:

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | grep -E "(image|headers)" | xargs sudo apt-get -y purge

Leave a Comment

Jenkins Swarm and Docker article

This article explains how to set up a Dockerfile that will allow you to set up a Jenkins environment with slaves that allow for unit tests on multiple environments, with different PHP versions. Using Jenkins’ Swarm plugin allows for automatic detection of new slaves. So even developers can temporarily ‘lend’ their laptops for build jobs. The advantage of using Docker is that this will not interfere with their current installation because it is running inside an image.

Every PHP developer recognizes this problem: How do we make sure that all software remains working after a PHP upgrade. With the PHP 7 release on the horizon we were looking for solutions to run our unit tests on both PHP 5.x and 7.

http://devblog.simgroep.nl/blog/2015/11/12/jenkins-swarm-docker/

Leave a Comment

Repeating script execution on Linux

When running a PHP script on a Linux server I needed a way to have it start again after ‘crashing’. For example because of an error. It turns out that this is relatively easy using a while loop in bash.

In the file below the command string can be replaced by one or more commands you want to execute.

Simply create the file and execute a chmod +x to make it executable.

The script will run the command and when it terminates, simply loops and run it again. The date command is there so you can see when the script loops during its execution.

#!/bin/sh

while [ 1 ]
do
    date
    command
done

Leave a Comment

Setting path parameter when uploading cloudfront ssl certificate

When you want to use your own SSL certificate on Cloudfront, you must upload your certificate to IAM. In order for the certificate to be usable at cloudfront, its path must be prefixed with /cloudfront/, else it will not show up in the list.

The information below is distilled from a forum post at the AWS forum. The explanation is for when you are use the aws cli to upload the certificate (which is the only possible way at the moment of writing this post).

aws iam upload-server-certificate --server-certificate-name my_cert --certificate-body file://my_cert.crt --private-key file://my_key.pem --certificate-chain file://intermediate_and_root.crt --path /cloudfront/

It is possible to differentiate further in the path, it can be --path /cloudfront/whateveryouwanthere/, for exaample.

Leave a Comment

Post mentioned on stackoverflow

This weekend I found a referrer in this blog’s analytics from stackoverflow. In this question a solution was given referencing one of the posts on this blog. It gave me great joy to see that a post on this blog helped someone.

In general, if anyone has any questions related to a post, you can always contact me on Twitter via @daangemist.

The referenced post was Jenkins reports sslv3 error on svn update. The link in the stackoverflow comment seems to be incorrect, I added the correct one via a comment.

Jenkins not able to use SVN credentials or download new plugins/new versions

Leave a Comment