In a previous post I mentioned I had recently picked up a HiLetgo ESP8266 NodeMCU module along with a DHT22 temperature and humidity sensor. In this post, I’ll describe how I combined the board, the sensor, hass.io and MQTT using the mosquito add-on for hass.io to create a temperature sensor for my home office.

I’m not going to go into detail about how to setup hass.io on a Raspberry PI, their site does an excellent job of describing how to get it installed, but I do highly recommend using that installation method if you’re on the fence. Raspberry PIs are inexpensive and Home Assistant runs quite well on the platform.

Instead, I’m going to concentrate on what it takes to get this working while going over what you need to enable in hass.io to support a small, WiFi enabled board sending temperature and humidity readings.

Continue reading

I recently picked up a HiLetgo brand ESP8266 “NodeMCU” device (version 1.0 specifically) from Amazon along with a DHT22 temperature and humidity sensor with the intention of creating a simple temperature sensor. After getting the little thing out of the packaging, connecting it to my Mac and opening Arduino IDE I quickly realized I couldn’t actually connect to the device. Turns out I hadn’t paid attention and needed to install a driver first. Even with the driver installed the process of connecting to the board isn’t quite as straight forward as it could be. Hopefully I can get everything a person needs right in here in this post.

I assume that you already have the Arduino IDE installed. If not, head over to https://www.arduino.cc/en/Main/Software and follow their directions for getting the IDE installed.

Continue reading

Wanted to quickly share some thoughts and links of software I’ve found recently and what I’ve been up to.

If you’re into home automation at all you have to check out Home Assistant. There is a bit of a learning curve initially but once you get an understanding of how to configure it you’ll find there is a lot of potential with it. I recently replaced my HomeBridge installation on my Raspberry Pi 3 with the prebuilt RPi3 image.

If you manage servers big or small take a look at Ansible. It isn’t new technology but it is something I’ve grown quite fond of recently. It’s easy to install on Linux, Mac and even Windows 10 if you have that oddly named Linux add-on. Even if you don’t use Ansible to manage servers you should use something.

If you enjoy Destiny or Destiny 2, checkout Guardian Theater. This is a project spearheaded by a friend of mine after collaborating with me on a Xbox GameDVR clip site (https://xboxrecord.us) and deciding it’d be way cooler if you could look up clips related to yours. Guardian Theater promises to show game clips recorded by other guardians while in the same activity as you. Lots of fun!

Does your WordPress site load in under a second? This one can despite running, for years, on one of the lower VPS tiers available at DigitalOcean thanks to Cloudflare. DigitalOcean’s server offerings are excellent for the price and I’ve always found the performance perfectly acceptable given what I’m paying each month. That said, Cloudflare offers a free CDN tier with just the right mix of features to be appealing and useful. No matter how good your server is you will always benefit from a CDN’s ability to cache content and get it physically closer to your audience. This post goes into detail about how to get the best possible performance from Cloudflare and WordPress by tweaking a few settings and installing a single plugin.

I have no association with Cloudflare and I’m not hear to sell it to you but for this post to make any sense you’ll need to have a WordPress site running through at least Cloudflare’s free CDN offering. If this sounds like you then lets continue.

Continue reading

 

Although I’m more than comfortable using command line tools to manage things there are times where a GUI is just more convenient. Pruning old containers, images and volumes in Docker are all things that are easier much to manage under a new tool I saw via twitter the other day. Portainer promises to make the task of managing Docker a bit easier and they’ve made good progress on delivering on that promise.  Getting up and running with it is incredibly simple because, as you’d expect, it’s available as a Docker image.  Simply issue the following this slightly Mac specific command:

docker run -d -p 9000:9000 -v "/var/run/docker.sock:/var/run/docker.sock" -v portainer:/data --name portainer portainer/portainer

This will get Portainer up and running on your system. If you’re on a Linux system you can skip mapping docker.sock. The other mapping just gives a persistent store for the little bit of data Portainer generates.  For full documentation visit their documentation site.

Recently I found myself needing to setup Elasticsearch for a project and thought it’d be the perfect opportunity to utilize Docker. This article discusses a portion of how I setup a set of three VMs to quickly get Elasticsearch up and running with minimal fuss. Hopefully you find it useful and can adapt the information provided here into your own setup.

I chose to use Docker for this project for a few reasons. For one, it allowed me to avoid iterating over and over to create a puppet module/configuration when the work of installing Elasticsearch as already done for me and nothing more than a command away. It allowed me to concentrate on configuration Elasticsearch itself rather than how to express how it should be configured in a different environment. Another reason I went with Docker is that you end up naturally documenting how the service runs on that system because the configuration is actually part of the command line arguments. It’s visible in both the script I use to create the container as well as if you issue docker inspect. Everything you need to know is more centrally located rather than poking around at system files and possibly missing something on one system. In the end, I have a setup that easier to understand, easier to debug and ultimately more portable.

For my setup I started with three Ubuntu 16.04 VMs configured using puppet to have the latest version of Docker installed and ready to go. These machines were configured with 16GB of memory and were each given an IP address (192.168.0.51, 192.168.0.52 and 192.168.0.53). From there I created a simple script called start_elasticsearch.sh to create the container on each server:

#!/bin/bash

docker rm -f elasticsearch
docker run --restart always \
 --ulimit memlock=-1:-1 \
 --ulimit nofile=65536:65536 \
 --cap-add=IPC_LOCK \
 -d \
 -e ES_JAVA_OPTS="-Xms7g -Xmx7g" \
 -v /var/lib/elasticsearch/:/usr/share/elasticsearch/data \
 -v /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime \
 -p 9300:9300 -p 9200:9200 \
 --name elasticsearch \
 elasticsearch:5.2 \
 -Ediscovery.zen.ping.unicast.hosts=192.168.0.51,192.168.0.52,192.168.0.53 \
 -Ebootstrap.memory_lock=true \
 -Enetwork.host=0.0.0.0 \
 -Enode.name=${HOSTNAME} \
 -Enetwork.publish_host=`ip addr | grep inet | grep ens160 | awk '{print $2}' | cut -d '/' -f 1` \
 -Ediscovery.zen.minimum_master_nodes=2

Be sure to change the IP addresses listed in the -Ediscovery.zen.ping.unicast.hosts line as well as the interface name in -Enetwork.publish_host line (grep ens160) to match the values of your systems. You can adjust other values as well to match your setup such as ES_JAVA_OPT to set heap size (use about 50% of total system memory). Save the script out and the mark it executable with chmod +x start_elasticsearch.sh. Tuck it away wherever you want, you only need to run it again if these parameters are updated.

Next, create a directory at /var/lib/elasticsearch. This is where the actual files will be stored. Repeat these steps on each server in your cluster. You can now run the script which will download the Elasticsearch version specified and start it with the parameters you provided. Once all instances are started they’ll discover each other and will just work.

From here you can access any of the servers at its IP address on port 9200. For production use, it’s wise to put some kind of load balancer in front of the cluster. I used nginx to get the job done.

In a future post, I’ll detail how to achieve this same setup using docker-compose and possibly docker swarm.

Found myself with an odd situation when running Jenkins using Docker. The time displayed was correct but claimed it was UTC which lead to some odd behavior. The best way to resolve this is to force the Docker container to use the correct timezone from the host system.

To do so, add the following to your run command:

-v /etc/timezone:/etc/timezone -v /etc/localtime:/etc/localtime

screen-shot-2016-10-24-at-11-22-05-pm

Not too long ago a Raspberry Pi 3 found its way into my home and after looking around on the Internet for Raspberry Pi based projects I decided to turn it into a HomeKit hub using Homebridge. While installing Homebridge isn’t terribly difficult I decided I could make it even easier by utilizing puppet.

Using puppet to install Homebridge as well as any additional modules you want is beneficial because you can backup the puppet files and if you need to rebuild your Raspberry Pi for any reason you can quickly get back up and running by applying your existing puppet config. If you’re feeling adventurous you can manage all of your software and configs using puppet.

This post details how to get Homebridge installed on a Raspberry Pi running Raspbian Jessie and assumes you have already Raspbian installed, have gained access to it using ssh or are using the terminal application in PIXELS.

To install Homebridge, do the following (prefix all commands with sudo if you are not already logged in as root):

  1. apt-get update
  2. apt-get install puppet
  3. puppet module install puppetlabs-apt
  4. puppet module install puppet-nodejs
  5. puppet module install dustinrue-homebridgepi

With that out of the way you can create the puppet file that defines what software is installed on your system. To get started, all you need is the following:

include homebridgepi

Into a file called homebridge.pp using your favorite editor. You can now tell puppet to apply this to your system.

puppet apply homebridge.pp

This will install Homebridge and set it to start on system boot using systemd. Homebridge will be installed to run as root but you can change this behavior by editing /etc/systemd/system/homebridge.service and changing the User value. I choose to run it as root as some modules require root privileges to run helper programs. Know that if you do so you’ll need to manually move your .homebridge directory from /root to whatever user you choose.

You can view the logs of Homebridge by issuing:

journalctl -uf homebridge

You will find your config.json file located at /root/.homebridge/config.json. In it will be the default config that you can expand on. You can configure any additional modules you want to install (described below) in this file as well.

From here you can define additional Homebridge modules you want to install by editing your homebridge.pp file. As an example, here are some of the modules I install on my system to support what I’m using Homebridge for:

 

include homebridgepi

package {
  'vim':
    ensure => 'installed',
    provider => 'apt';

  'homebridge-wol':
    ensure => 'latest',
    install_options => '--unsafe-perms',
    provider => 'npm';

  'homebridge-xbox-one':
    ensure => 'latest',
    source => 'https://github.com/dustinrue/homebridge-xbox-one.git',
    install_options => '--unsafe-perms',
    provider => 'npm';
}

 

Valve recently released SteamOS into the wild in beta form and as soon as I could I downloaded it and got it installed on my low to mid range gaming PC.  My motherboard, CPU and RAM are newer but the GPU is a bit on the older and inexpensive side.  That said, it is very capable of running SteamOS and I imagine anyone who has built a gaming rig in the last few years will be able to run it.

Step One: Have a PC

Step One: Have a PC

Actual hardware requirements for SteamOS aren’t outlandish requiring any 64bit capable Intel/AMD CPU, 4GB memory and at least a 500GB HD.   The harder requirement is that the motherboard must support UEFI booting.  There are work arounds to this requirement but it’s beyond the scope of this post. 

Lets get started with the installation. I’m looking at this from the perspective of a Mac user to many of the tools to get things prepared are Mac based.  Here’s what you need:

  • PC meeting the above requirements
  • Flash drive larger than 1GB that can get partitioned/formatted
  • An empty hard drive or a really good backup of your current system
  • A machine to download and prepare the installer with, I’m using a Mac with OS X
  • The SteamOS installation files (http://store.steampowered.com/steamos/download/?ver=custom)

Preparing the flash drive

Insert the flash drive into an available USB port and start up Disk Utility.  Click once on your flash drive (it’ll be listed on the left side) and then click the Partition button.  From the partition layout menu choose  1 Partition.  Name the drive if you wish and ensure that the Format is set to MS-DOS (FAT).  Last, double check that the partition type is Master Boot Record by clicking on the Options… button.  Use the following screenshots as a reference:

Create 1 partition formatted in MS-DOS (FAT)

Create 1 partition formatted in MS-DOS (FAT)

 

Ensure the partition type is Master Boot Record

Ensure the partition type is Master Boot Record

 

When you are satisfied with the parameters click the Apply button and finally the Partition button.  Your flash drive is now ready to copy the SteamOS installation files to.

Copying files to the flash drive

Download the installer files and extract them if they aren’t already. I’m going to assume that the files were extracted into your Downloads directory.  If not, then you’ll need to adjust the paths used in the next command.  To copy the files to the flash drive I used rsync in terminal.  This ensures the files are copied including any hidden files. Use the following command:

rsync -av ~/Downloads/SteamOSInstaller/ /Volumes/UNTITLED\ 1/

Remember to adjust any paths depending on how you named your flash drive or if you didn’t extract the SteamOS Installer files in your Downloads directory. Also note that there IS a trailing slash on the SteamOSInstaller directory.  This is important!

Copying files to the flash drive can take some time

Copying files to the flash drive can take some time

Press enter and allow the rsync operation to finish.  Once done, eject the flash drive using Finder.

Prepare the target PC

To prepare my PC for SteamOS I unplugged all of my internal drives.  This absolutely vital if you don’t want to risk having your existing hard drives wiped clean! I happen to have an extra 500GB drive sitting around for this project and if you don’t or don’t have your PC backed up, then stop here because you’re about to lose everything.

If I haven’t scared you off, then we can continue.

In my BIOS I ensured that all of the UEFI boot options were either enabled or would occur first.  This step is going to be different on each motherboard so you’ll need to play around to make sure things are right.  Basically:

  • Ensure the system will boot using UEFI at all
  • Ensure that UEFI booting is enabled for USB ports and USB flash drives
  • Ensure the UEFI is used before any legacy option

Insert the flash drive into a USB port on your computer and boot it.  Enter your motherboards boot menu if you have one or set your system to boot from USB first.  My system allows me to bring up a boot menu and I pick the EUFI USB Hard Drive option:

Boot menu

Boot menu

You should then see the following:

I picked Express Install

I picked Automated Install

Pick Automated Install and the first phase of the SteamOS installation will get started.  You’ll be looking at a lot of these for awhile:

Progress bars

Progress bars

Allow this phase to complete.  Eventually you’ll be told the system is going to reboot. When it does, remove the flash drive. SteamOS will then reboot to a standard login screen.

Initial Configuration

At this point you are faced with a standard login screen.  Do the following:

  1. Enter steam for the username, press enter
  2. Enter steam for the password, press enter
  3. Click Activities in the upper left
  4. Click Applications
  5. Click Terminal
  6. Type in steam and press enter
  7. Accept the EULA
  8. When finished, log out
    1. Click steam in the upper right
    2. Click logout
    3. Click the logout button

Here are some screenshots for reference:

The login screen

The login screen

Starting terminal

Starting terminal

 

You must now login as the desktop user by doing the following:

  1. Enter desktop for the username, press enter
  2. Enter desktop for the password, press enter
  3. Click Activities in the upper left
  4. Click Applications
  5. Click Terminal
  6. Type ./post_logon.sh, press enter
  7. Enter in desktop as the password, press enter

The system will now perform a number of post phase 1 install routines and then reboot.  After rebooting the system will create the system restore partition. You simply answer yes to a question and the rest is automated.

Just say yes

Just say yes

Pick reboot and press enter

Pick reboot and press enter

Once completed the system will reboot again into SteamOS and finally into Big Picture Mode where you can create or log into your Steam account. The initial boot up can take some time so be patient.  You are now ready to go!

Just picked up Tomb Raider (2013) for PC and I thought I’d post the settings I’m using for others to try.  I don’t have the best card around so I attempted to dial in something the card was able to do while maintaining 30fps.  I’m running the latest Nvidia drivers as of 3/5/2013 and Nvidia has already stated that they were caught off guard so hopefully the framerate will improve with updated drivers and/or settings can be increased.

2GB 550 Ti Tomb Raider settings
 resolution: 1920x1080
 refresh: 60hz
 v-sync: double buffer
 fullscreen: on
 exclusive full: on
 display: 1
 monitor aspect auto
 quality custom,
 texture quality: ultra
 texture filter: anisotropic 4x
 hair quality: normal
 anti-aliasing: fxaa
 shadows: normal
 shadow resolution: high
 level of detail high: high
 reflections: high
 depth of field: normal
 ssao: normal
 post processing: on
 tessellation: off
 high precision: on
min: 30, max: 44.0, avg 33.2