Caprover logo
I had heard a lot about Docker over the past few years. It is/was touted as an easy way to deploy node apps, so it called for some experimentation. First I had to install Docker on my Windows 10 system, and the best way to do that was by first installing WSL2, or the Windows Subsystem for Linux (basically Linux within Windows). That done, installing Docker was a breeze. Next I needed the project that I could Dockerize.
There is a WordPress/CiviCRM application that has been the bane of my existence since the client's hosting provider decided to force a PHP upgrade. (WordPress/CiviCRM are PHP-based.). If I could containerize that application--making it independent of the host system--then I could simply freeze it, i.e., no more upgrades. (The application is only used 6 or 8 times a year, the rest of the time it is offline, so security is not an issue.)
The first step was to Dockerize the application locally, and then to figure out how to push the container(s) out into the big wide world. ('Push' feels like a birthing metaphor.) One of the main principles behind Docker is that each container has only one function, so there needed to be a Wordpress container and a MySQL (database) container which communicate through a Docker network.
All of this worked as intended after I found the Docker images for the versions of WordPress and MySQL that the application depended upon. I simply drafted a docker-compose.yml file, with the appropriate ports and persistence volumes, and brought it up in detached mode. Then I could shell into the WordPress container and import the .sql database backup to restore the data. There were a couple of glitches, but it worked.
In the course of all of this, I discovered CapRover, a docker-based PaaS (Platform as a Service) that could be easily and cheaply installed on an AWS LightSail instance. I had already used an AWS S3 bucket with CloudFront (Amazon's CDN [Content Delivery Network]) to host my personal site (this blog), so spinning up a LightSail instance seemed like a no-brainer.
It was (a no-brainer). And installing CapRover couldn't have been simpler. I became a bit distracted by setting up my DNS to point a subdomain to CapRover and then publishing various projects, or apps, as they are called. This let me consolidate my various projects on one server whether they be plain HTML/CSS/JS, or node apps, and I was pleased.
In the course of all this, I discovered that CapRover cannot handle docker-compose files, but uses the lower-level dockerfile format. So I now have to reformulate the code to generate two separate images that I can then push to CapRover. CapRover will handle the inter-container networking. But that's a project for another day.
Send me your thoughts