📜 ⬆️ ⬇️

Let's talk about Plesk with the Docker extension

Let's speak about Docker

Recently, the article Iron_Butterfly was published , where, among other things, it tells how you can run the most powerful search engine ElasticSearch inside the Docker container. I want to continue this vector and tell you what other tasks can be solved with the help of Docker containers using Plesk and the Docker extension.

Short plan


In this article, we will look at how using the Docker extension can solve tasks that are hard or even impossible to solve with Plesk without Docker containers. This list of tasks is based on the popular questions of our users; as users, we will consider hosting owners, web application developers, WordPress admins.
')

Tasks:


- Simultaneous use of different versions of databases;
- Expanding Memcached for WordPress;
- Using your own cloud storage Nextcloud;
- Run your own application on Go. Running your own git repository;
- Testing new versions of Plesk without interfering with the combat server.

I want to clarify that all the examples in the article are made using the free version of the Docker extension; The paid version allows you to manage Docker service on remote servers.

Instead of introducing


Short glossary of terms used
  • Docker is an automation software for deploying and managing applications in a virtualization environment at the operating system level.
  • Docker extension (Docker extension) is an extension that is installed inside the Plesk control panel to extend the functionality of the panel itself.


Before we go over to specific examples, let's take a quick look at the limitations in the current version and prepare Plesk to work with containers.

Known issues and limitations



Deploy environment. Installing Docker Extensions


0. Obtain a valid certificate using Let's Encrypt (this is an optional step, I will remove the self-signed certificate warning);
1. Select Extensions in the left menu;
2. Find a Docker;
3. Click “Install”;
4. Wait until the installation process is complete;
5. Go to the extension. Is done.

Get a valid certificate using Let's Encrypt (optional)

Select Extensions in the left menu.
Select Extensions in the left menu.

Find a Docker
Find a Docker

Click “Install”
Click Install

Wait for the installation process to complete.
Wait for the installation process to complete.

Go to the extension. Is done
Go to the extension. Is done


Tasks


Hosting provider



Soon we will look at how to solve the listed tasks, but before that we will see what tasks the web developer can face.

Web developer


Let's imagine that you are a web application developer. Today you are starting to develop a new web application that will save all the data in a SQL database. What SQL database will you use? Perhaps you would prefer to write a web application so that it works with all popular databases, since This will help to attract more customers. So which databases do you know?


Well, your application is ready, but now you need to test it with all these databases. Let's look at how this task can be solved with the help of Plesk, Docker and Docker extensions.

Install containers with all necessary databases


We will use the official Docker Hub containers:


Consider the installation of one of the containers, let's say MariaDB 10.0:

  1. Find the available containers with MariaDB, select the required version;
  2. Wait until the installation is complete;
  3. Configure the necessary parameters:

    • Turn on autoload;
    • Specify static port mapping;
    • Add volume mapping so that data is stored outside the container;
    • Set the environment variable with the password for root.
  4. Create a container and wait for it to start.

Repeat the steps to create containers for MariaDB 10.1 / 10.2, MySQL 5.5 / 5.6 / 5.7 / 8.0, PostgreSQL 9.5 / 9.6.

Find the available containers with MariaDB, select the version you want.
Find the available containers with MariaDB, select the version you want.

Wait for the installation to complete.
Wait for the installation to complete.

Set the necessary parameters
Set the necessary parameters

Create a container and wait for it to start.
Create a container and wait for it to start.

Repeat container creation steps
Repeat container creation steps

Using Created Databases in Plesk


Below are two options for the possible use of the created databases:


A few screenshots that show how the result looks like on the configured system.

Add DB to Plesk
Add DB to Plesk

The resulting resulting DB list in Plesk
The resulting resulting DB list in Plesk

How it all looks inside the OS
How it all looks inside the OS

WordPress Admin


Another task that may be relevant for site owners with Wordpress, and the solution of which I would like to consider in this article.


Steps:

  1. Check your firewall settings; you should block external connections to memcached;
  2. Find and install the container with Memcached;
  3. Enable autorun and configure port mapping;
  4. Run the container;
  5. Check that everything works.

Check your firewall settings, you must block external connections to memcached (individually)

Find and install a container with memcached
Find and install a container with memcached

Enable autorun and configure port mapping
Enable autorun and configure port mapping

Run the container
Run the container

Check that everything works.
Check that everything works.

Organization


A task that may be relevant for small organizations: you want to have your own resource for file sharing based on Nextcloud. This problem can also be easily solved.

Own Nextcloud in Plesk with Docker?



Steps:

  1. Find and install the container with Nextcloud;

    • Please note that the volume mapping is not configured; This is done deliberately, because inside Dockerfile for Nextcloud, use unnamed docker volume.
  2. Wait until it starts;
  3. Configure proxy rules for Docker in “Websites & Domains”;
  4. Open the Nextcloud web interface and set the name and password for the administrator;
  5. Is done. You can use Nextcloud.

Find and install the container with Nextcloud
Find and install the container with Nextcloud

Wait until it starts.
Wait until it starts.

Configure proxy rules for Docker in “Websites & Domains”
Configure proxy rules for Docker in Websites & Domains

Open the web interface of Nextcloud, set the name and password for the administrator
Open the Nextcloud web interface and set the name and password for the administrator.

Is done. You can use Nextcloud
Is done. You can use Nextcloud

Go developer


Currently, Plesk does not have extensions that allow you to work with Go, but you can write an application on Go and run it under Plesk in a Docker container. I do not know how to write on Go, so for clarity, I will take the finished product written on Go and show you how to run your own git-service in Plesk.

Find a container with Gogs
Find a container with Gogs

Set up a container with Gogs
Set up a container with Gogs

Run the container with Gogs
Run the container with Gogs

Specify the initial settings for the Gogs itself
Specify the initial settings for the Gogs itself

Is done. Own git service is up and running
Is done. Own git service is up and running

Create the first repository. Let's call it ... HelloWorld
Create the first repository. Call it ... HelloWorld

Testing new versions of Plesk!


Let's install Plesk as a Docker container in Plesk with the Docker extension! Immediately answer the question "Why?":


Find a Plesk Container
Find a Plesk Container

Customize Plesk Container
Customize Plesk Container

Launch the Plesk container. Is done. Can check
Launch the Plesk container. Is done. Can check

Conclusion


Instead of a conclusion, I propose to discuss in the comments which public containers with Docker Hub you regularly use in your daily work, or vice versa, why did you refuse to use public containers in your tasks.

Source: https://habr.com/ru/post/342440/


All Articles