TFM IOT Home automation Part 2 – How smart a lamp can be ?

A simple lamp. How much intelligence can we add to a simple lamp  ? Well that depends …

What we can control?

  • We can power on and power off the lamp.

What we can measure?

  • Power consumption
  • Check if the light bulb needs to be replaced

On first iteration we will power on and power off.

The results:

To put things one step forward we need to be have all the controls from all the devices across the house in one single place ( a central hub for the house and be able to control it from anywhere )


Setup and run a standalone private docker registry v2


This document will describe the process to setup / run an private docker registry v2. This come handy when you need to have a private image repository. Why you might need this ? Imagine that you need a fast local registry or if you feel uncomfortable pushing you private work to docker hub.

If you search the docker documentation they recommend to use it as a container. That will work in most of the cases. In our case we wanted to have it running on a standalone server, to store the data on a shared storage and several other reasons (speed is one of the reasons).


What we need is epel repo installed and we need to install docker-distribution

root@tfm-swrm01: yum search docker-distribution
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel:
======================= N/S matched: docker-distribution =======================
docker-distribution.x86_64 : Docker toolset to pack, ship, store, and deliver
                           : content
  Name and summary matches only, use "search all" for everything.

at the time of writing this article the version available is 2.4.1:

[root@tfm-swrm01 registry]# yum info docker-distribution
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * epel:
Installed Packages
Name        : docker-distribution
Arch        : x86_64
Version     : 2.4.1
Release     : 2.el7
Size        : 15 M
Repo        : installed
From repo   : extras
Summary     : Docker toolset to pack, ship, store, and deliver content
URL         :
License     : ASL 2.0
Description : Docker toolset to pack, ship, store, and deliver content


Installing it is pretty forward:

yum install -y docker-distribution


To enable docker registry to run at boot

systemctl enable docker-distribution.service

and to start it:

systemctl start docker-distribution.service


Configuration is done via /etc/docker-distribution/registry/config.yml . We decided to start with a minimal configuration file and add additional setting later.  Below is a configuration file that works :

version: 0.1
    service: registry
        layerinfo: inmemory
        rootdirectory: /data/docker-registry
    addr: :5000

Our shared storage is mounted in /data so keeping images in /data/docker-registry makes sense.

Remember that docker registry supports a lot of storage backend drivers (Local file system,Microsoft’s Azure Blob Storage,Google Cloud Storage, Amazon’s Simple Storage Service (S3) , Openstack Swift object storage, Aliyun OSS for object storage) but we will use local filesystem for now.

Docker has comprehensive documentation regarding parameters supported in config.yml, you can find it at Registry Configuration Reference and we recommend to check it in order to understand what are all the options you can configure.

Using it

1) Build a container and tag it to use the custom repository

docker build /tmp/grafana -t

2) Push the image to repository:

docker push


Create a maintainable Centos 7 box for web hosting

Goal: Create Centos 7 box for web hosting  ( LAMP stack / monitoring software code versioning software ) that will be easy to install , maintainable in time , easy to add functionality .


First things first: install the centos 7 minimal.

After instalation:

update OS

yum update
yum upgrade

generic tools

yum install perl perl-core ntpl nmap sudo libidn gmp libaio libstdc++ unzip sysstat sqlite net-tools mc bind-utils telnet

Remove iptables wrapper and install plain iptables service

yum remove firewalld

yum install iptables-services

Adding more useful software repositories

yum install
yum install
yum install

Installing php 5.6

yum –enablerepo=remi-php56 install php php-gd php-mysql php-mcrypt

Installing mysql DB and backup tools

yum install Percona-Server-server-57 percona-xtrabackup


For Centos 7 we didn’t find (yet) a decent software repository for GIT 2.7 . Most probably we will make one and try to maintain it.  ( will be covered in another article )


yum install collectd collectd-apache



Installing Ricoh Aficio SG3100SNw in linux

So , you have decided to purchase a Ricoh Aficio SG3100SNw printer. Good. It’s a good choice for small / medium companies. What we like about it is that it comes with wireless interface and that is quite nice . Less cables more fun. I’m not going to get into details on how to unbox it and make the initial setup. I leave that as an exercise for the reader ( it’s not easy but up to a point it’s fun ) .   Continue reading Installing Ricoh Aficio SG3100SNw in linux

Resize VM images in proxmox

When you really need to resize a VM disk image ( and free space to be allocated into partitions inside the vm) you might want to read this:

Step-by-step guide

  1. Poweroff you VM from proxmox
  2. Grow the disk allocation from proxmox GUIresize-proxmox
  3. Open a shell to proxmox and use parted to resize the partitions ( for qcow you might need to mount it first on nbd )
    root@proxmox:~# qemu-nbd -c /dev/nbd0 /mnt/pve/gogu/images/108/vm-108-disk-1.qcow2
    root@proxmox:~# parted /dev/nbd0
    (parted) p
    Model: Unknown (unknown)
    Disk /dev/nbd0: 82.9GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos
    Disk Flags:
    Number  Start   End     Size    Type     File system  Flags
     1      1049kB  525MB   524MB   primary  ext4         boot
     2      525MB   42.9GB  42.4GB  primary               lvm
    (parted) resizepart 2 82.8G
    root@proxmox:~# nbd-client -d /dev/nbd0
  4. Power on the VM and login to it. Time to put the free space to good use.
    pvresize /dev/vda2
    lvextend -l +100%FREE /dev/mapper/vg_webtest01-lv_root
    resize2fs /dev/mapper/vg_webtest01-lv_root
    # In case of xfs use:
    # xfs_growfs /dev/mapper/centos_template-root
  5. Job done . Enjoy