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: 56

Categories
General Topics and tips Products Storage

SaaS Cloud Storage

An increasing number of businesses are choosing cloud services and adopting the cloud ecosystem day by day. In simple terms, cloud services mean using someone else’s hardware devices and paying only the amount you use. Compared to on-premises, cloud storage as service solutions like IaaS, PaaS, and SaaS offer major benefits in productivity and cost.

As you begin to consider the advantages of the cloud and approach towards switching your business to the cloud, it is more important to understand the key differences and advantages of cloud services.

Infrastructure as a Service IaaS

Basically, infrastructure as service products are made of highly scalable and automated resources and the hardware is fully managed by the provider. This allows the user to use resources and build on-demand solutions.

IaaS delivers computing infrastructure such as servers, network, storage, and bundles up with a unified dashboard and users can access and provision resources using the APIs of those providers. IaaS clients are responsible for managing the resources and data. The service provider just gives the physical hardware setups. Use IaaS if you want to build your solution from scratch and manage throughout on a long-term sustainable scale.

AWS, DigitalOcean, Rackspace, Azure are some of the examples of IaaS providers.

Platform as a Service PaaS

Here the providers will give more components than IaaS. PaaS delivers standard frameworks for general use cases. Then the maintainer can customize it as per requirement.

PaaS provides a platform where users can come and deploy their use cases on managed resources. With these services, you don’t need to worry about the underlying setup. PaaS can streamline workflows when multiple team members work together on the same project. So use PaaS if your requirement starts from some standard layer and add more layers to it.

AWS Elastic Beanstalk, Heroku, Google App engine are some of the examples of PaaS providers.

Software as a Service SaaS

SaaS refers to cloud application services. This represents the most commonly used business option in the cloud world. SaaS utilizes the power of the internet and delivers fully managed services. Most SaaS products run directly on the browser and do not require any installation on the client-side.

SaaS eliminates the need for a separate service management team. As it abstracts all the layers, the service providers manage all potential technical glitches and servers, maintenance, and storage issues. Just plan and push user data into those services and leverage the power.

SaaS provides n number of advantages to employees and companies by reducing time and money spend on time taking tasks like provisioning and maintaining the resources. These services are hosted on centralized servers and accessible via the internet. Short-term projects that require easy and flexible resources use these services.

Google Drive, Dropbox, slack are some of the examples of cloud storage as a service.

Let’s understand these terms with a real-world example:

SaaS Cloud storage vs Iaas vs PaaS
Real-world example

In an on-premises setup, the user has to manage everything. For IaaS, take the readymade incidents and bake on your own. PaaS stands for delivery of customized orders on demand. Furthermore, SaaS refers to restaurants where the person only goes and orders the pizza.

Sesame Disk: A SaaS cloud storage provider:

Sesame Disk is cloud storage as a service and team collaboration product where the clients can purchase storage services in a customized manner and increase team productivity. This service works all over the world including to send files and collaborate with Mainland China, APAC, Europe, USA, etc. In other words the specialty is file sharing nd collaboration.

The products and pricing model are constantly been improving to give better facilities for different workloads and client requirements. The primary focus of the product is to enhance file sharing capabilities including the cloud abstraction layer. The user-friendly dashboard says it all. Whatever your needs may be, we catch it cover.!

Pricing in a Nutshell for our Saas Cloud Storage:

Whether you’re a single person or you run a bigger enterprise, the common goal of collaboration with the team is fulfilled. The pricing model starts with a personal trial plan where you can test your requirements and find alignment to your use case for free. Then you can proceed with the upfront commitment plan where you get fixed storage and other services as per the plan. We have the business service plan available for larger workloads. Any of the fixed price and storage plans are so flexible that one can seamlessly top up the services. At last, the most demanded pricing model “pay-as-you-go” comes into play. Yes.! Only pay for the number of services you provision without any upfront commitment. Also find a general description of all of our products in this link

Some specifications like the number of users, cloud storage, transfer traffic, web and API access, internal shares are common across all plans. And services like backup, API development, history management come with the additional plans.

The key benefits of using cloud storage as a service product are enhanced team collaboration, global file sharing, faster and secured data transfer, and managing large workloads with a unified dashboard with a highly resilient pricing model.

On a closure note

The best suggestion is to consider your use case and choose the best service and pricing that can benefit you over and out. Do checkout team productivity, file sharing articles for more info. Contact our support team if you need assistance in understanding which service best fits your use case.

Hits: 27