Today I will show you how you can create a manually backup remotely of your database using a docker container of PHPMyAdmin.
- Docker installed on your environment (Local).
- Docker Compose installed on your environment (Local).
- A Linux SO. (Windows Powershell also). (Local)
- A Ghost Site (Remote) I will use my own Ghost Blog (https://danfercf.info/).
- Access to server (Ghost Site) port 3306 (Remote).
- User and password for your Mysql Server (Remote).
The remote environment:
- AWS Ec2 instance (Micro) Free tier.
- 1 GB RAM
- Security access enabled for incoming requests (port 3306).
- Ghost Site: 5.12.0-alpine
- MySQL server: 8.0
- Ngnix: 1.15.12-alpine
- SSL: enabled
After that we can start, we will use a repository with a PHPMyAdmin configured using Docker Compose you can fork the repository and then you can clone it or just copy the configuration in your machine. We'll follow the 2nd option. If you choose the 1st option you can find the repository here https://github.com/danfercf1/docker-examples
The configuration that you need is:
You need to create a file called docker-compose.yml using the above configuration.
For example I'm using a folder called Projects in my home folder:
I will use that folder to create the file, you can use this command to create the file
Then you can put the configuration into the file you can use vim or nano
After you saved the file you can create the .env, it is for save the environment variables for the docker image
This is the configuration explanation:
- PMA_HOST: It is the host where is the Mysql server it should be the same that your ghost site on this case it will be danfercf.info, PHPMyadmin will make the connection to this host automatically.
After saved the .env file we can run our PHPMyadmin container we use:
After the command execution we can see something like this:
That's mean that your container is up and ready to use
Regarding the configuration we can access to our PHPMyadmin dashboard accessing the URL: http://localhost:8090
If everything is well you can see the login screen of the manager
There you need to fill the inputs with the MySQL user and password to access to your MySQL server for your Ghost Site.
After a successful sign in you can see the PHPMyAdmin dashboard
You will continue selecting the database and doing click in the export link
You can choose the Quick export method and the click to go
And that it's all, you can save the file and you will have a backup for your Ghost blog.