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!

Continue Reading >>

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.

Continue Reading >>

Prime prove con Microsoft Band 2 integrato con “Alfred” di Smart Domotik.

Continue Reading >>

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:

Continue Reading >>

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.

Create wordpress blog with docker and rancher

A few time ago, I wrote a post about move wordpress to dokku.

What changed from that? Why another article? Well, I found better tools 🙂

First of all, I moved from dokku to standard docker, less problems, more scalable.

After that, I found a great orchestration tool for multiple docker servers: Rancher .

This great tool allow with few click to create a container that simple “works”.

Continue Reading >>

Remove untagged images from docker

by jimhoskins.com

In the process of running docker I had 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.

Continue Reading >>

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.

Gitlab with Docker and Dokku

Gitlab is a fantastic git repository manager, it’s essentially github but with no limit on private repositories and most important, it’s absolutely open source.

You know, configure a new platform or service can often be a pain, but the good thing of docker is that with a single command we can have any service online in few seconds!

Continue Reading >>

Move WordPress Site to Dokku Server

If you have a dedicated server and you have done all your testing with docker and dokku, you are ready to move all your sites on your new server.
Most common CMS is of course wordpress, so here I’ll explain how you can safely move a hosted wordpress site to a docker container with dokku.
(PS: This tutorial supposes that you have a base knowledge about docker and dokku).

N.B: I wrote this tutorial with specific idea of how wordpress should be installed in a container.
If you search with google something like “docker wordpress” you will found lots of resources and “dockerfile ready” container with all in one (wordpress + mysql).

For me it’s very important that wordpress and mysql stay on different containers (and dokku helps us with this).
Also important data of wordpress should stay in a safe place, because keep wp-content directory inside the container expose it to the risk of loss important files if you delete the container or something goes wrong with your dokku/docker installation.

Let’s start!

Continue Reading >>