Menu Close

Migrating from Rancher 1 to Rancher 2 and K8S, our story – Part 1

Part 1 – From the beginning to Rancher 1

In Uala we always try to use last tecnologies in every part of our platform, from the Backend to the Frontend, and of course also on our Infrastructure.

About 5 years ago, when Docker started to be stable enough for create services able to be deployed everywhere we immediately wanted to try it.
We started with Dokku, a simple tool that do a basic work for put online a container, and after some weeks we was online with the first dockerized version of our Frontend.

From there, about 1 year later, we decided to create a dockerized version of our Backend and move it from Heroku to dedicated servers.

Move WordPress to a subdirectory with Rancher

About one year ago, I wrote about Create wordpress blog with docker and rancher and was a great thing have a blog full dockerized in our rancher infrastructure.

Today, I’ve another challenge: put a wordpress blog to a subdirectory of a domain, keeping the main site separated from the blog in different docker containers, well.. not so easy.

What we should have, is something like:

https://www.example.com -> docker container with our main site
https://www.example.com/blog -> different docker container with only the blog

I spent lots of time for understand the right way to do this, and finally, I got it!

Invalid datetime value in mysql 5.7

Mysql 5.7 added a validation on datetime so blank value or ‘0000-00-00 00:00:00’ are no more valid dates and it will give you an error if you try to edit/alter a column with this value from console, phpmyadmin or from your applications.
For avoid this issue, you should set every datatime column as NULLABLE, but if you have existing databases and existing applications it’s lots of work.
A workaround for this problem is edit “sql_mode” option in your code, like prestashop:
https://github.com/PrestaShop/PrestaShop/pull/4507/files

But, if you want that phpmyadmin continues to work fine, you have to edit mysql conf file and set sql_mode persistently.

Fix github Permission errors in Jenkins

Sometimes could happen that jenkins cannot work good with github repos in our project dependencies.

Errors could be something like:

git@github.com:zendframework/zend-uri.git
   Cloning into '/var/www/vendor/zendframework/zend-uri'...
   Host key verification failed.
   fatal: Could not read from remote repository.
   
   Please make sure you have the correct access rights
   and the repository exists.

or:

Cloning into 'zend-uri'...
   Permission denied (publickey).
   fatal: Could not read from remote repository.

For avoid these type of errors, you can add a public ssh key to your jenkins user:

Save psql query output to csv file

by stackoverflow.com

In terminal (while connected to the db) set output to the csv file

1) set field seperator to “;” by:

\f ';'

2) set output format unaligned:

\a

3) show only tuples

\t

4) set output

\o '/tmp/yourOutputFile.csv'

5) execute your query

select * from YOUR_TABLE

6) output

\o

you will be able to find your cvs file in this location

cd //tmp
copy it using scp command 

or edit using nano:

nano //tmp/yourOutputFile.csv

You can also print to console with \o again.

Remove untagged images from docker

by jimhoskins.com

In the process of running docker I accumulated several images that are not tagged. To remove these I use this command:

docker rmi $(docker images -a | grep "^" | awk '{print $3}')

This works by using rmi with a list of image ids. To get the image ids we call docker images then pipe it to grep “^”. The grep will filter it down to only lines with the value “” in the repository column. Then to extract the id out of the third column we pipe it to awk “{print $3}” which will print the third column of each line passed to it.

PowerWasp – PCB per NodeMCU

In questo video potete vedere come la powerwasp riesce in modo incredibile a realizzare da una lastra di rame un pcb pronto per l’utilizzo.
Nel mio caso ho realizzato un circuito in grado di rilevare in ingresso l’accensione di una luce 220V e di comandare a sua volta un uscita luci sempre a 220V.
Il tutto comandato da remoto tramite NodeMCU, basato su piattaforma ESP8266.

Presto nuovi aggiornamenti sulla piattaforma che gestisce questa nuova domotica.