Empowering you with the knowledge to master Linux web hosting, DevOps and Cloud

 Linux Web Hosting, DevOps, and Cloud Solutions

Tag: Docker

Deploy WordPress with Docker & SSL - No Headaches!


Setting up WordPress with SSL can be a real headache. I’ve simplified the process using Docker, making it much easier to deploy a secure and scalable WordPress site. My latest Medium article walks you through the steps, eliminating the usual frustrations. Read the full guide here: Deploy WordPress with Docker & SSL (No Headaches!)

Multiple database server versions on Plesk server using Docker






Adding Multiple Database Servers in Plesk Using Docker


Adding Multiple Database Servers in Plesk Using Docker

By default, you can only install a single version of MySQL/MariaDB on your server. However, if some of your customer require a different MySQL version, you can use docker. Plesk allows you to add multiple database servers using its Docker extension. This is particularly useful when hosting multiple applications requiring different database versions. In this guide, we will walk through installing and configuring a MariaDB 10.11 Docker container, mapping its ports, and adding it to Plesk as an external database server.

Step 1: Prepare the Server

  1. Log into your server via SSH.
  2. Create a directory for the Docker container’s data storage to ensure persistence:
    mkdir -p /var/docker/mysql/

Step 2: Install and Configure Docker in Plesk

  1. Log in to Plesk.
  2. Navigate to Extensions and ensure the Docker extension is installed. If not, install it.
  3. Go to Docker in Plesk.
  4. In the search box, type mariadb and press Enter.
  5. Select the MariaDB image and choose version 10.11.
  6. Click Next.
  7. Configure the container:
    • Check Automatic start after system reboot.
    • Uncheck Automatic port mapping and manually map:
      • Internal port 3306 to external port 3307.
    • Ensure firewall rules allow traffic on ports 3307 and 33070.
    • Set Volume mapping:
      • Container: /var/lib/mysql
      • Host: /var/docker/mysql
      • Warning: Not mapping this can result in data loss when the container is recreated.
    • Add an environment variable MYSQL_ROOT_PASSWORD and specify a secure root password.
    • Click Run to start the container.

Step 3: Add the MySQL Docker Container as an External Database in Plesk

Once the container is running, we need to add it to Plesk as an external database server:

  1. Log in to Plesk.
  2. Navigate to Tools & Settings > Database Servers (under Applications & Databases).
  3. Click Add Database Server.
  4. Configure the database server:
    • Database server type: Select MariaDB.
    • Hostname or IP Address: Use 127.0.0.1.
    • Port: Enter 3307 (as mapped earlier).
    • Set as Default (Optional): Check Use this server as default for MySQL if you want clients to use this server by default.
    • Credentials: Enter the root user and password specified during container setup.
    • Click OK to save the configuration.

Step 4: Using the New Database Server

Now that the new database server is added, clients can choose it when creating a new database in Plesk:

  1. Go to Databases in Plesk.
  2. Click Add Database.
  3. Under Database server, select the newly added MariaDB 10.11 instance.

This setup allows clients to choose different database servers for their applications while ensuring database persistence and security.

Conclusion

By leveraging Docker, you can efficiently manage multiple database versions on a Plesk server. This method ensures better isolation, easier upgrades, and avoids conflicts between database versions, providing a flexible and robust hosting environment.


Demystifying Containers and Orchestration: A Beginner’s Guide

In today’s fast-paced world of software development, speed and efficiency are crucial. Containerization and container orchestration technologies are revolutionizing how we build, deploy, and manage applications. This blog post will break down these concepts for beginners, starting with the fundamentals of containers and then exploring container orchestration with a focus on Kubernetes, the industry leader.

1. What are Containers?

Imagine a shipping container. It’s a standardized unit that can hold various cargo and be easily transported across different modes of transportation (ships, trucks, trains). Similarly, a software container is a standardized unit of software that packages code and all its dependencies (libraries, runtime environment) into a lightweight, portable package.


Benefits of Containers:

  • Portability: Containers run consistently across different environments (physical machines, virtual machines, cloud platforms) due to their standardized nature.
  • Isolation: Each container runs in isolation, sharing resources with the operating system but not with other containers, promoting security and stability.
  • Lightweight: Containers are much smaller than virtual machines, allowing for faster startup times and efficient resource utilization.

    2. What is Docker?

    Docker is a free and open-source platform that provides developers with the tools to build, ship, and run applications in standardized units called containers. Think of Docker as a giant toolbox containing everything you need to construct and manage these containers.

    Here’s how Docker is involved in containerization:

  • Building Images: Docker allows you to create instructions (Dockerfile) defining the environment and dependencies needed for your application. These instructions are used to build lightweight, portable container images that encapsulate your code.
  • Running Containers: Once you have an image, Docker can run it as a container instance. This instance includes the application code, libraries, and runtime environment, all packaged together.
  • Sharing Images: Docker Hub, a public registry, allows you to share and discover container images built by others. This promotes code reuse and simplifies development.



    Benefits of Using Docker:

  • Faster Development: Docker simplifies the development process by ensuring a consistent environment across development, testing, and production.
  • Portability: Containerized applications run consistently on any system with Docker installed, regardless of the underlying operating system.
  • Efficiency: Containers are lightweight and share the host operating system kernel, leading to efficient resource utilization.

    3. What is Container Orchestration?
    As the number of containers in an application grows, managing them individually becomes cumbersome. Container orchestration tools automate the deployment, scaling, and management of containerized applications. They act as a conductor for your containerized orchestra.

    Key Features of Container Orchestration:

  • Scheduling: Orchestrators like Kubernetes determine where to run containers across available resources.
  • Scaling: They can automatically scale applications up or down based on demand.
  • Load Balancing: Orchestrators distribute incoming traffic across multiple container instances for an application, ensuring stability and high availability.
  • Health Monitoring: They monitor the health of containers and can restart them if they fail.

    4. What is Kubernetes?

    Kubernetes, often shortened to K8s, is an open-source system for automating container deployment, scaling, and management. It’s the most popular container orchestration platform globally due to its scalability, flexibility, and vibrant community.

    Thinking of Kubernetes as a City (Continued):

    Imagine Kubernetes as a city that manages tiny houses (containers) where different microservices reside. Kubernetes takes care of:

  • Zoning: Deciding where to place each tiny house (container) based on resource needs.
  • Traffic Management: Routing requests to the appropriate houses (containers).
  • Utilities: Providing shared resources (like storage) for the houses (containers).
  • Maintenance: Ensuring the houses (containers) are healthy and restarting them if needed.

    Example with a Simple Web App:

    Let’s say you have a simple web application with a front-end written in Node.js and a back-end written in Python (commonly used for web development). You can containerize each component (front-end and back-end) and deploy them on Kubernetes. Kubernetes will manage the deployment, scaling, and communication between these containers.

    Benefits of Kubernetes:

  • Scalability: Easily scale applications up or down to meet changing demands.
  • Portability: Deploy applications across different environments (on-premise, cloud) with minimal changes.
  • High Availability: Kubernetes ensures your application remains available even if individual containers fail.
  • Rich Ecosystem: A vast ecosystem of tools and integrations exists for Kubernetes.

    5. How Docker Relates to Container Orchestration and Kubernetes
    Docker focuses on building, sharing, and running individual containers. While Docker can be used to manage a small number of containers, container orchestration tools like Kubernetes become essential when you have a complex application with many containers that need to be deployed, scaled, and managed efficiently.

    Think of Docker as the tool that builds the tiny houses (containers), and Kubernetes as the city planner and manager that oversees their placement, operations, and overall well-being.

    Getting Started with Docker and Kubernetes:
    There are several resources available to get started with Docker and Kubernetes:

    Docker: https://docs.docker.com/guides/getting-started/ offers tutorials and documentation for beginners.
    Kubernetes: https://kubernetes.io/docs/home/ provides comprehensive documentation and getting started guides.
    Online Courses: Many platforms like Udemy and Coursera offer beginner-friendly courses on Docker and Kubernetes.

    Conclusion

    Containers and container orchestration offer a powerful approach to building, deploying, and managing applications. By understanding Docker, containers, and orchestration tools like Kubernetes,

  • Powered by WordPress & Theme by Anders Norén