Database management

I’m very familiar with databases as I started developing websites years ago which back then were connected to Microsoft Access databases using ASP service side code. Nowadays, I utilise tools like PHPMyAdmin or even in some cases use bash scripting to export whole MySQL databases to textfiles so that it is easier to run find and replace commands to replace all instances of an old domain name in favour of a new one. Migrating WordPress can be a hassle and I’ve learnt that plugins which claim to do this are slow, inefficient and sometimes unreliable if the server doesn’t have enough resources to cope with the demand of really large databases.

As I’ve stopped relying on hosting my websites on hosting plans with cPanels, I tend to have one instance of PHPMyAdmin on a secure internal network that allows me to connect and manage any MySQL databases running in their own docker containers.

phpmyadmin.koke.estate

 

				
					mkdir -p ${DB_BACKUP_PATH}/${TODAY}
echo "Backup started for database - ${DATABASE_NAME}"
 
 
mysqldump -h ${MYSQL_HOST} \
   -P ${MYSQL_PORT} \
   -u ${MYSQL_USER} \
   -p${MYSQL_PASSWORD} \
   ${DATABASE_NAME} | gzip > ${DB_BACKUP_PATH}/${TODAY}/${DATABASE_NAME}-${TODAY}.sql.gz
 
if [ $? -eq 0 ]; then
  echo "Database backup successfully completed"
else
  echo "Error found during backup"
  exit 1
fi
 
 
##### Remove backups older than {BACKUP_RETAIN_DAYS} days  #####
 
DBDELDATE=`date +"%d%b%Y" --date="${BACKUP_RETAIN_DAYS} days ago"`
 
if [ ! -z ${DB_BACKUP_PATH} ]; then
      cd ${DB_BACKUP_PATH}
      if [ ! -z ${DBDELDATE} ] && [ -d ${DBDELDATE} ]; then
            rm -rf ${DBDELDATE}
      fi
fi
 
### End of script ####
				
			

Git

johan.koke.estate > Git
While I may not use GIT on a daily basis as I’ve never really had any real need to place a whole WordPress site in a git repository, I’m familiar enough with the technology and occasionally use it for personal projects like bash scripts and docker-compose files to make deploying new sites easy and fast.

VPN

johan.koke.estate > VPN
Virtual Private Networks is an essential tool to keep your work network private and only allow certain users access. It’s also a fantastic tool to lock a firewall by only allowing traffic through a dedicated VPN.
johan.koke.estate > Hypervisors & Virtual Machines
I’m very competent at setting up enterprise servers that run an Hypervisor as their Main operating system. My own server is configured with XCP-ng which is widely used in the industry because of it’s robust performance vs hardware load.
johan.koke.estate > DNS and hosting
I fully understand DNS and hosting and host all my own websites by pointing domains via A or CNAME records to various servers depending on circumstances
johan.koke.estate > Docker & Docker-compose
Linux docker and docker compose is an amazing way to host microservices on a Linux server.
johan.koke.estate > WordPress
Since 2010 – Wordpress has been my CMS of choice for a number of years now and I’ve learnt many lessons along the way.

MySQL

Database management

I’m very familiar with databases as I started developing websites years ago which back then were connected to Microsoft Access databases using ASP service side code. Nowadays, I utilise tools like PHPMyAdmin or even in some cases use bash scripting to export whole MySQL databases to textfiles so that it is easier to run find and replace commands to replace all instances of an old domain name in favour of a new one. Migrating WordPress can be a hassle and I’ve learnt that plugins which claim to do this are slow, inefficient and sometimes unreliable if the server doesn’t have enough resources to cope with the demand of really large databases.

As I’ve stopped relying on hosting my websites on hosting plans with cPanels, I tend to have one instance of PHPMyAdmin on a secure internal network that allows me to connect and manage any MySQL databases running in their own docker containers.

phpmyadmin.koke.estate

 

				
					mkdir -p ${DB_BACKUP_PATH}/${TODAY}
echo "Backup started for database - ${DATABASE_NAME}"
mysqldump -h ${MYSQL_HOST} 
   -P ${MYSQL_PORT} 
   -u ${MYSQL_USER} 
   -p${MYSQL_PASSWORD} 
   ${DATABASE_NAME} | gzip > ${DB_BACKUP_PATH}/${TODAY}/${DATABASE_NAME}-${TODAY}.sql.gz
if [ $? -eq 0 ]; then
  echo "Database backup successfully completed"
else
  echo "Error found during backup"
  exit 1
fi
##### Remove backups older than {BACKUP_RETAIN_DAYS} days  #####
DBDELDATE=`date +"%d%b%Y" --date="${BACKUP_RETAIN_DAYS} days ago"`
if [ ! -z ${DB_BACKUP_PATH} ]; then
      cd ${DB_BACKUP_PATH}
      if [ ! -z ${DBDELDATE} ] && [ -d ${DBDELDATE} ]; then
            rm -rf ${DBDELDATE}
      fi
fi
### End of script ####