WordPress site using the latest WordPress Version. This will be a LEMP (Linux, Nginx, Mysql, PHP) stack running inside Docker containers. Created a Bash shell script to run the LEMP stack with just one command, and your WordPress site will start running on a local machine or browser. This bash script will contain the following features-
- Check if docker and docker-compose is installed on the system. If not present, install the missing packages.
- The script should be able to create a WordPress site using the latest WordPress Version. Provided a way for the user to provide the site name as a command-line argument.
- It must be a LEMP stack running inside containers (Docker) and a docker-compose file is a must.
- Created a /etc/hosts entry for example.com pointing to localhost. Here we are assuming the user has provided example.com as the site name.
- Prompt the user to open example.com in a browser if all goes well and the site is up and healthy.
- Added another subcommand to enable/disable the site (stopping/starting the containers)
- Added one more subcommand to delete the site (deleting containers and local files).
chmod +wx <file_name.sh>
./<file_name.sh> <sitename.com>
Here is some snapshots as a result: