My requirement for the local environment is to be set up a WordPress/Php sites so I needed PHP, MySQL, Apache/Nginx services. 👷
I was using easyengine on my ubuntu system and it was easy to set up with few commands only.
But I kinda always messing around with my machine and end up being formatting my system 😂 sometimes just because I wanted to try diff OS so in all of this times I’ve to backup my all the sites data from my user to diff dir and had to dump all the databases and again set up everything and put all the things back to gather. Always make me sick.
In meantime, I heard about the VVV/Vagrant and tried that but never liked that just because of the performance and my machine get too slow, and I’m using chrome 😛 so nahh… never went with that. But yeah on few projects I had to use this because of the requirements of the same system environment.
Ok and then I heard about Docker and try to use that and seem like this is what I wanted for long. ( I took some help from my friends who are good with server-side things and learn what it is. ) I can say its a standalone environment ( kinda like VVV but better ) now I can able to setup everything wherever I want with all shared required directory of easyengine. I build my first image with easyengine setup and then I was using the share volumes and used it for a while. In doing so I got to know more about the Nginx, MySQL configurations where I needed the files to be located.
docker run -it –name=ee -p 80:80 -p 22222:22222 -p 3306:3306 -p 443:443 -v ./www:/var/www -v ./lib/mysql:/var/lib/mysql -v ./lib/ee:/var/lib/ee -v ./etc/nginx:/etc/nginx -v ./etc/hosts:/etc/hosts -v ./etc/ee:/etc/ee rahulprajapati/ee-ubuntu
So, at first I started with this and this solves my problem now when I format my machine or change my system all I need is this dir, setup docker and run the command, And I got all my sites with the same data. I don’t need to backup any sql dump and reimport it, or take a backup of my sites I can just keep my working dir where ever I want.
And this helps me when I moved from Linux to Mac I just needed my local environment dir where I put all the things. That’s how I went into Docker.
But that wasn’t it, it never will be 😂 we got docker-composer and learn about it also learn that we should use the different container for each service which is good for performance and we can share services between other containers/services.
Then I tried some of the opensource development environment of WordPress environments and see what and how they are using it. I came up with these two environment setups.
And I liked to go with the second one, 10up’s wp-local-docker and used it for a while. Because of the following reasons ( this might be silly reasons but was checking my requirements ).
- I can able to access WordPress root dir easily.
- Easily run the commands in containers using docker-compose. Helps in WP-CLI commands mostly.
- It has mailcatcher, memcached, elasticsearch services.
Now, this setup is for the single site so I always have to set up this for each new projects and then I missed easyengine. And now I thought that I can make it happen just needed to do some tweaks and tricks in my setup. So, I went around for Nginx config file requirements and how to handle multiple site domains with diff sites.
And finally got it working fine, now I’m using my own customized docker-compose setup on my Mac.