what is docker for? How to start with Docker? An example of a web hosting provider.

Duh!

This is not meant to be the thousandth “How To use Docker”. I’m going to write down my experience I’m making with Docker here. Basically, Docker is only one of many container solutions that exist at the moment, the special thing about Docker is its large user base. Similar to the Raspberry Pi, it is by no means the most powerful device, but the large community makes up for it. There are hundreds of explanations and how to’s for every problem, but copy’ n paste is not the right solution for every problem. I write here in the hope that you want to understand what you are doing and not just throw everything into the terminal without thinking about it.

Continue reading

Ufw is for managing a Linux firewall and aims to provide an easy interface to iptables for the user. Install and configure ufw do this as root user or use sudo:

apt install ufw

Set default rules

ufw default deny incoming
ufw default allow outgoing

Allow connections

These commands both allow a connection on port 22 using the TCP protocol. Use one they end up in the same IPtables:

ufw allow ssh
ufw allow 22/tcp

Continue reading

We want to transfer a complete database to another server. All we need is ssh access on both servers. On the old server we start a dump of our database:

mysqldump --single-transaction -h HOSTNAME -u USERNAME -pPASSWORD DATABSE_NAME sqlbkp_`date+"%Y%m%d"`.bak\

Be careful, your password is readable in your bash history. The database is saved as ‘sqlbkp_’ with current date. Now we send the file to the new server into the database:

mysql -h NEW_HOSTNAME -u USERNAME -pPASSWORD DATABASE_NAME < FILE_NAME.bak

Safe all databases in a file per db and gzip that file:

for db in $(mysql -e 'show databases' -s --skip-column-names); do mysqldump $db | gzip > "/backups/mysqldump-$(hostname)-$db-$(date +%Y%m%d).gz"; done

That’s it.