Categories
Cloud Sotfware & Developers & DevOps Tools & How-Tos

How to Host WordPress Using Docker-Compose?

WordPress (WP) is a free-open-source website creation platform. It is the most popular Content Management System due to its simplicity and effectiveness. Check out our article on how to host WordPress from scratch. However, setting up a new environment every time is a bit tedious and time taking if you need to do it often. In this article, we’ll showWordPress Using Docker-Compose in a container. WP is made using PHP, MySQL and of course JavaScript and HTML.

Why WordPress Using Docker-Compose in a Container?

 A container is a standard unit of software that bundles up code and all the dependencies so the application can run in the intended setup. Some of the benefits are, reusability, flexibility, less resource consumption, robustness, isolation. Container tools like Docker, Podman, Rocket are in huge demand and exponentially increasing day by day. Checkout our interesting article on hosting Jitsi on Docker.

So we got an approach to run the same workloads with more efficiency. But the question of setting up the system again and again from scratch remains unsolved.

Docker-compose seems a good option. Basically, Docker compose is a tool for defining and running containers in a unified manner. Specifically, with compose, we can use the YAML file to configure the application service. Use the declarative approach and mirror user-defined requirements and deploy containers with a single simple command.

WordPress Using Docker Compose.
WordPress (WP) on Docker

Demonstration:

Here, we’ve taken Ubuntu Linux as a Docker host and it is running on AWS cloud with root powers. On this host OS, we can run multiple different containers with different OS and packages. Containers are isolated yet use the resources from the host system.

Step 1: Installation of Docker on host system:

We have to install the Docker package to run the Docker daemon and run compose files. Use the below command for installation:

To update package manage: apt-get update
To install Docker:  curl -fsSL https://get.docker.com/ | sh
To start services: systemctl start docker
Docker installation
Docker installation

There are multiple ways to install Docker.
The systemctl command will start the Docker service, allowing us to utilize container operations such as creating, deleting containers, managing container networks, attaching volume, and many more.
Verify the running service with the systemctl status docker command.

Step:2 : Installation of Docker-compose

After installing and configuring the Docker service, now is the time to set up docker-compose and enable its capabilities. Using compose, we can simply declare the container blueprint and provision containers with the same program file. It gives the benefit of reusability with a simple way of use.
Note: Install curl command-line utility in the system if not present: apt-get install curl) Check out our article on curl for more information.

Install compose using this command: curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

Alter the execution permissions: chmod +x /usr/local/bin/docker-compose

Verify the compose installation using: docker-compose –v command
Docker-compose installation
Docker-Compose installation

Finally, done with the one-time setup of the server. Now we’ve docker service and composer running in the server and are ready to start. Although, we can launch containers without compose. But for large-scale infrastructure, it is recommended to use such an “IaC” approach.

There is a concept of Docker image. Basically, an image is kind of a blueprint or base of a container. It is the essential unit to launch a container. We store and maintain these images in repositories. Docker hub is a public repository for docker images. We can find frequently used and custom-created docker images here.

Here, we’ve taken readily available images for WordPress (WP) and MariaDB. We’ve used MariaDB as a database to persistently store the content of the website. Using composer, we’ll link both the front-end and backend and create a working website.

Step 3: Creating composer file for WP
mkdir wordpress 
cd wordpress
vim docker-compose.yml 

Naming the composer file as above is a standard convention. Alternatively, we can explicitly pass the compose filename with the -f flag. Good practice to implement compose files in separate directories. Indentation is compulsory in YAML

wordpress:
  image: wordpress
  links:
    - mariadb:mysql
  environment:
    - WORDPRESS_DB_PASSWORD = your password
    - WORDPRESS_DB_USER= root
    - WORDPRESS_DB_NAME= db name
  ports: '-8081:80'
mariadb:
  image: mariadb
  environment:
    - MYSQL_ROOT_PASSWORD = your password
    - MYSQL_DATABASE = db name

Here, we have declared two containers named WordPress and MySQL in the flavor of MariaDB respectively. The image tag refers to the base image for containers. WordPress and MariaDB are the image names. The links tag implicitly represents the link of the mentioned container. The environment keyword is used to pass environmental variables (also known as env vars in OS development jargon) while launching the container to fulfil the dependencies. The ports keyword is used to expose the container to the outer world. Here we’ve taken post 8081 of host os and bind to port 80 of the WordPress Using Docker Compose. So any client coming to port 8081 will be redirected to container port 80. In addition, make sure the password in the environmental variable is correct in both containers.

Now the composer file is ready. Create the whole setup with the command below:

Docker-compose up –d
docker compose command execution
docker-compose command execution

The process is successful if the above command doesn’t return any error. Cross-check the same by hitting the site at public_ip:8081. Complete the installation process and the end page would look like this:

wordpress dashboard
WP dashboard

Hence, the installation is done and linked with the backend database. This is how containers help to provision lightweight os. And compose makes it even more feasible by bundling multiple tasks in a file. That is WordPress Using Docker Compose. Thanks for reading.!



Hits: 23

Categories
Entrepreneurship Management and Projects Sotfware & Developers & DevOps Tools & How-Tos

What is Agile Automation Framework?

Agile Automation Testing is a methodology for implementing automated tests in agile software development. The aim of agile, automated testing is to increase the effectiveness and efficiency of the software development lifecycle while preserving quality, timeliness, and resource utilization. As a result, implementing such a procedure needs extensive coordination and cooperation across teams.

In the past few years, ever since the agile approach was introduced with its creators demanding an end to the tedious and complex reality of the old waterfall model, the effect of the same can also be seen regarding Automation Testing.

A real example of a financial service organization that developed a large-scale agile capacity to meet its aspirational automation goals. The firm began implementing agile methods in phases, beginning with its software development teams. It then implemented agile across teams to facilitate collaboration and the sharing of best practices. Finally, the firm convinced the program’s leadership to make the method the default for all automation initiatives. Since the transformation, the firm has seen project delivery times decrease by about 30% and expenses decrease by 15% to 20% across six distinct business lines.

Agile Automation
Automation in Agile

Automation in Waterfall

Within the context of the waterfall, automation testing is typically feasible when the application is consistent and reliable. The requirement requires a significant amount of time and a team of highly skilled automation expert resources, and a significant amount of set-up costs in most instances. Automation Testing’s primary goal is to decrease expenses over time and maximizes. Moreover, it guarantees that no new problems occur due to current test cases.

How to do Agile Automation as a Methodology

By definition, the agile approach emphasizes eliminating time-consuming and tedious documentation to facilitate the implementation of unique and innovative ideas and for people to communicate freely to reduce the implementation of more exploratory ideas.

As a result, we may see a conflict between the core principles of agile methods and automated testing.

Why is Agile Automation Necessary for Testing?

Automation results in improved production and cost savings. Automation has grown so embedded in agile software development so that it’s impossible to imagine one without the other.

We discussed the primary reasons why automation is necessary for agile testing methodology:

Incremental Development: 

The shortest development cycle is the primary reason that requires automation in agile testing. Agile Scrum teams have few weeks to understand the requirements, modify the code, and test the revised code. If we perform all the testing manually, the time needed would force scrum masters to exceed the time spent on development. As a result, we will have to rush the testing process hence results in reducing the overall quality.

Continual Modifications: 

Agile projects do not operate under a complete set of criteria. The requirements evolve over time and often alter in response to changing client requirements, market developments, and end-user needs. While the agile method’s most advantageous characteristic is its rapid flexibility to change, this also means that testing must be flexible enough to keep up with the changes. Moreover, Automation provides testing with the required agility and enables it to react more quickly and adaptable to changes.

Continuous assessment: 

Agility demands frequent testing. The newly introduced code is covered by the tests and the code from earlier versions. This is to verify that no previously implemented functionality is damaged due to the newly introduced feature. This puts a great deal of strain on the testers and may harm the product’s quality. By automating specific tests, testers get more time for exploratory testing.

Gain immediate insight into the quality of your code: 

Automation testing enables you to rapidly test your code using a standard set of test scripts. This provides the software tester and developer with an early indication of the code’s reliability and allows them more time to respond if the code falls short of expectations.

Testing support functions: 

Automation in testing may be used to automate test script execution against code and data setup, test result validation, and test reporting. Agile development needs continuous code releases, which can be automated. This relieves testers of tedious, repeated duties, allowing them to concentrate on testing.

Regression testing: 

Automation enables testing to be performed indefinitely, allowing for a thorough study of the code. This is very beneficial when dealing with a restricted testing window and guaranteeing code quality.

Agile Automation Tools

As discussed, not all the tests should be automated in Agile. However, the automated testing tool used by Agile teams should cover as much of the testing scope as feasible.

To do this, the team must examine the following factors while choosing an automation tool, keeping in mind the Agile methodology’s nature:

  • The tool must be compatible with all operating systems on which the program expects to operate; it must also support various devices and browsers for parallel testing.
  • The technology’s learning curve should be minimal, allowing all QA teams to involve rapidly; the solution has comprehensive reporting and integration features.
  • Apart from these criteria, the team must consider other factors while determining the most suitable automation tool for their projects.

Some important tools that cover all the above-listed requirements are:

  • Selenium
  • Kobiton
  • TestProject
  • Ranorex
  • Eggplant
  • Subject7
  • LambdaTest
  • IBM Rational Functional Tester
  • Katalon Studio

Conclusion

The growing need for Agile applications by virtually every software development team highlights automation’s competitive advantage. Although the long-term benefits of automation are unknown, QA teams must design their automation methods from the beginning.

On an individual basis, each team and company must consider additional considerations while developing an Agile automated testing plan that maximizes the methodology’s advantages.

Hits: 15