Skip to content

shubhamch71/WordPress-Site-on-Dockerized-LEMP-Stack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 

Repository files navigation

WordPress Site on Dockerized LEMP Stack

The project provides a command-line script written in bash to easily create, manage, enable, disable, and delete WordPress sites using Docker Compose with LEMP Stack setup. It provides a simple and automated way to set up and manage WordPress site on your server.

Prerequisites

Before running this project , you need to setup an EC2 Instance on Amazon Web Services(AWS) using Amazon Linux AMI. During setting up of EC2 Instance make sure to keep port 80 and port 3306 open in security group of the instance.

After setting up the instance and logging into the instance , you need to run the following commands as a prerequisite for the project to run successfully.

Install git using yum package manager

  sudo yum install git -y

After installing git you need to install lynx which is a terminal-based web browser for all Linux distributions. It shows the result as plain text on the terminal

  sudo yum install lynx -y

Steps To Run the Project

Clone the project

  git clone https://github.com/shubhamch71/WordPress-Site-on-Dockerized-LEMP-Stack.git

Go to the project directory

  cd WordPress-Site-on-Dockerized-LEMP-Stack

Give permissions to the script

  chmod a+x wp_lemp.sh

Usage

To successfully launch the wordpress website , navigate to the directory where the wordpress_manager.sh script is located.

Command Syntax

The command syntax for using the script is as follows:

  ./wp_lemp.sh <command> <site_name>

Where:

  1. is one of the following: create, enable, disable, or delete.
  2. <site_name> is the desired name for your WordPress site (e.g., example.com).

Sub-Commands

Create Command :-

The create command allows you to create a new WordPress site using Docker Compose with the LEMP stack.

  ./wp_lemp.sh create <site_name>

<site_name>: Specify the name for your WordPress site. The create command will perform the following tasks:

  1. Set up a new directory with the provided <site_name>.
  2. Create the necessary Nginx configuration file and Dockerfile for PHP customization.
  3. Generate a Docker Compose file to set up the Nginx, PHP, and MySQL containers for the WordPress site.
  4. Prompt you to open the site in your browser once it's up and healthy.  

Enable/Disable Commands :-

The enable and disable commands allow you to start or stop the containers for a specific WordPress site.

  1. The enable command will start the containers for the specified site, making it accessible.
  ./wp_lemp.sh enable <site_name>
  1. The disable command will stop the containers for the specified site, making it inaccessible.
  ./wp_lemp.sh disable <site_name>

<site_name>: Specify the name of the WordPress site you want to enable or disable.

Delete Command :-

The delete command allows you to delete a WordPress site, including stopping the containers and removing local files.

  ./wp_lemp.sh delete <site_name>

The delete command will perform the following tasks:

  1. Stop and remove the containers associated with the site.
  2. Remove the local directory for the site.

Demo

After doing the prerequisites, following is the demo output of the project

Create Subcommand

  1. After running the create subcommand , the script checks for docker and docker-compose and installs them if it is not installed .  

image

image

image  

  1. After docker-compose is installed it creates the docker containers and launches the Wordpress site after a health check is done successfully.  

image

 

  1. You are prompted to open the Wordpress site in using lynx in the command line itself. Please type Y to open it in lynx.  

image  

  1. After opening it in lynx you can see the installation page of Wordpress site which indicates the successful setup of Wordpress site using lemp stack . (Note this installation setup is required only for the first time). To exit lynx you can traverse to the bottom of page using down arrow key and then press q to quit and press y .   image

image  

  1. You can also open the site on external browser by copy pasting the ec2 instance public ip address. (Optional - You can directly open the website by typing the website name in external browser if you have the domain for the same.)

 

image

Disable Subcommand

  1. After running the disable subcommand the conatiners are stopped .   image

Enable Subcommand

  1. After running the enable subcommand the conatiners are started again and now you can access the wordpress site .   image

Delete Subcommand

  1. After running the delete subcommand the conatiners are stopped and removed and the directory of wordpress site si deleted .   image

Authors

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages