📜 ⬆️ ⬇️

Recipes. How to install software on servers using VMmanager and DCImanager



Agree, it's nice to get the server ready for the tasks. Installed ISPmanager will allow you to immediately begin placing the site. Teamspeak - organize WoT training without spending time on installation.
Providers through this increase revenue. Today they offer not just machines with a clean OS, but accounting, trading, and game servers. "Pre-sales training" increases customer loyalty and reduces the burden on technical support.

Initially this was implemented in our products by installing the necessary packages through the OS Template. The problem is that templates require significant costs to create, support and update. Everything gets worse when a client asks to preinstall an unpopular set of packages. For example, BigBlueButton, a platform for conducting webinars. The user orders a VDS and conducts video conferences, but only once every 3 months. He does not want to spend 30 minutes to install the software with each order of a dedicated server. Provider such requests are not always interesting. A highly specialized template sometimes incurs unjustified costs.
Under the cut, we will talk about how to solve such problems with the help of recipes - scripts that perform automatic software installation in VMmanager and DCImanager.

First, we dwell on OS Templates. With the advent of recipes, their popularity is reduced, and here's why.
  1. If the installed software supports multiple operating systems, each will have to make its own template. The recipe can be one on several OS.
  2. If we are talking about KVM or a dedicated server, then to install additional packages you need to make changes to install.cfg (answer file). If about OpenVZ, then you need to rebuild the entire container, adding the necessary files to it. And in the case of a recipe, simply open the browser menu in VMmanager or DCImanager and insert the code in the input field.

Thus, it turns out that additional software can now be installed with templates and recipes, but the latter are easier to use. At the moment we are using templates to add new operating systems, and recipes for installing additional packages.
')
You can write a recipe in any language, you just need the OS to have the necessary interpreter. After the installation of the operating system is completed and the server is rebooted, this file is copied over SSH to the temporary directory and runs as root.
The recipe must have a block of metadata at the beginning of the body.
It looks like this
#!/bin/sh # # metadata_begin /*  */ # recipe: Hello! /*  .   */ # tags: centos7,debian8,ubuntu1404,ubuntu1604 /* .        .     ,            */ # revision: 1 /*  */ # description_ru:  .  ,        shell. # description_en: Example of recipe. Greetings to world, that will be shown after every login to shell. # /* —    .             */ # metadata_end /*  */ # echo "Hello World!" > /etc/motd 

The recipe menu is available from admin level:

BILLmanager, in turn, receives a list of recipes from these panels and displays it when a customer orders a service.
You can also make different tariffs for servers: with and without recipes. The necessary settings are made when creating the handler, see the spoiler.
If you need to close for all clients access to the installation of a particular software, for example, to correct errors in the recipe, it is also possible. Process description on the example of VMmanager - under another spoiler.
Configuring the service handler
To create a handler, go to the “Integration” → “Service Processors” menu under the administrator and click the “Create” button.



Then, at the integration setup stage, check or uncheck the box.



And when creating a tariff, select the desired handler.


How to close access to the recipe
We perform authorization in the panel under a user with administrator rights. Go to the menu "Cluster Settings" → "Recipes", select the desired recipe and click "Properties".



Select the desired access level from the drop-down list and click “Ok”.


In case the client often installs software that is not very popular and wants to automate the process, our products have the ability to give end users the right to create their own, local, recipes. To do this, go to / usr / local / mgr5 / etc and add the line Option UserRecipes to the file vmmgr.conf or dcimgr.conf , then restart the panel with the command / usr / local / mgr5 / sbin / mgrctl -m vmmgr exit or / usr / local / mgr5 / sbin / mgrctl -m dcimgr exit, respectively.
At the user level, the menu item “Management” → “Recipes” will appear in the panel, which means that you can create your own recipes and use them when reinstalling the OS of a virtual or dedicated server.

Manual


Now let's try to write a recipe in practice and give it access to end users. For example, let's take a VB product deployment of BigBlueButton 1.0, a platform for conducting webinars. Under the spoiler, a description of the process with screenshots.
Recipe creation
We perform authorization in the VMmanager panel as a user with administrator rights, go to “Cluster settings” → ”Recipes”.



Click the "Create" button.



Specify the name of the file in which the recipe will be located, write / paste the script into the input field, fill in the metadata block and click “OK”.



The created recipe appears in the list.



The result - when ordering a service, the client hosting provider sees another version of the pre-installed software.


Those interested in the source code invite another under one spoiler.
Recipe Source Code
 #!/bin/bash # # metadata_begin # recipe: BigBlueButton # tags: ubuntu1404 # revision: 1 # description_ru: BigBlueButton,    . # description_en: BigBlueButton, webinar platform. # metadata_end # #  . RNAME=BigBlueButton set -x LOG_PIPE=/tmp/log.pipe.$$ mkfifo ${LOG_PIPE} LOG_FILE=/root/${RNAME}.log touch ${LOG_FILE} chmod 600 ${LOG_FILE} tee < ${LOG_PIPE} ${LOG_FILE} & exec > ${LOG_PIPE} exec 2> ${LOG_PIPE} killjobs() { jops="$(jobs -p)" test -n "${jops}" && kill ${jops} || : } trap killjobs INT TERM EXIT echo echo "=== Recipe ${RNAME} started at $(date) ===" echo # ,    . apt-get update apt-get -y dist-upgrade #  LibreOffice 4.4. LibreOffice       PDF. apt-get -y install software-properties-common add-apt-repository -y ppa:libreoffice/libreoffice-4-4 add-apt-repository -y ppa:ondrej/php #      BigBlueButton   . wget http://ubuntu.bigbluebutton.org/bigbluebutton.asc -O- | apt-key add - echo "deb http://ubuntu.bigbluebutton.org/trusty-1-0/ bigbluebutton-trusty main" | tee /etc/apt/sources.list.d/bigbluebutton.list #   . apt-get update #   ffmpeg. apt-get -y install build-essential git-core checkinstall yasm texi2html libvorbis-dev libx11-dev libvpx-dev libxfixes-dev zlib1g-dev pkg-config netcat libncurses5-dev FFMPEG_VERSION=2.3.3 cd /usr/local/src if [ ! -d "/usr/local/src/ffmpeg-${FFMPEG_VERSION}" ]; then wget "http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.bz2" tar -xjf "ffmpeg-${FFMPEG_VERSION}.tar.bz2" fi cd "ffmpeg-${FFMPEG_VERSION}" ./configure --enable-version3 --enable-postproc --enable-libvorbis --enable-libvpx make checkinstall --pkgname=ffmpeg --pkgversion="5:${FFMPEG_VERSION}" --backup=no --deldoc=yes --default #       ttf-mscorefonts-installer     BigBlueButton        . echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | debconf-set-selections #   BigBlueButton. apt-get -y install bigbluebutton #   (   BBB, )    . apt-get -y install bbb-demo #         BBB. apt-get -y install bbb-check #     BigBlueButton. bbb-conf --clean 

So, a new recipe is available for customers. Now, if someone needs, for example, to hold an urgent webinar or a meeting, he can in a short time arrange a platform for a meeting. As you can see, nothing complicated.

Those who wish to use our products and recipes in particular, we recall references to VMmanager and DCImanager , as well as to the documentation for recipes .

Satisfied customers!

PS The article uses the illustration of Anton Kuryatnikov.
Source link

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


All Articles