ispmanager 6

/
/
Portainer integration in ispmanager 6

Portainer integration in ispmanager 6

Please note!

At the moment of configuring Portainer, Docker should already be installed in the panel.

For correct work of the application, issue a self-signed SSL certificate by running the following two commands:

mkdir -p /etc/ssl/portainer

openssl req -x509 -nodes -days 365 \
 -newkey rsa:2048 \
 -keyout /etc/ssl/portainer/portainer.key \
 -out /etc/ssl/portainer/portainer.crt \
 -subj "/CN=localhost"

Next, create a docker container for Portainer:

docker run -d \
 --name portainer \
 -p 9443:9443 \
 -v /var/run/docker.sock:/var/run/docker.sock \
 -v portainer_data:/data \
 -v /etc/ssl/portainer:/certs \
 portainer/portainer-ce:latest \
 --ssl \
 --sslcert /certs/portainer.crt \
 --sslkey /certs/portainer.key

Now create a menu item for Portainer.

First, prepare an icon for the menu item and place it at /usr/local/mgr5/skins/icons/portainer.svg. The icon must meet the following requirements:

  • an image with a transparent background in SVG format;
  • no animations;
  • the image size is 15x15 pixels.

Next, create a Portainer menu item in the Docker management subsection by creating a file at /usr/local/mgr5/etc/xml/ispmgr_mod_portainer.xml with the following contents:

<?xml version="1.0" encoding="UTF-8"?>
<mgrdata>
 <mainmenu level="admin+">
   <modernmenu>
     <node name="docker_mgmt" customicon="/manimg/icons/portainer.svg">
       <node name="open_portainer" favorite="yes" customicon="/manimg/icons/portainer.svg" />
     </node>
   </modernmenu>
 </mainmenu>
 <handler name="myaddon.sh" type="xml">
   <func name="open_portainer" />
 </handler>
 <lang name="ru">
   <messages name="desktop">
     <msg name="modernmenu_docker_mgmt">Docker Management</msg>
     <msg name="modernmenu_open_portainer">Portainer</msg>
   </messages>
 </lang>
</mgrdata>

Finally, create an addon with the application for the panel. To do this, create a file at /usr/local/mgr5/addon/myaddon.xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<doc lang="ru" func="myfunc" binary="/ispmgr">
   <metadata name="myfunc" type="form" mgr="ispmgr">
       <form>
           <field name="frame" fullwidth="yes">
               <frame name="portainerframe" forcetheme="yes" fullpage="yes" keepalive="yes" />
           </field>
       </form>
   </metadata>
   <messages name="myfunc" checked="6b49a92f5cc5153c76b78446d0d74eb4">
       <msg name="title">Portainer</msg>
       <msg name="frame">Frame</msg>
   </messages>
   <portainerframe>https://URL_PANEL_ADDRESS:9443</portainerframe>
</doc>
Please note!

Make sure to specify the panel's IP address or domain name instead of the PANEL_URL_ADDRESS variable.

It's also required to create a script for the addon at /usr/local/mgr5/addon/myaddon.sh with the following content:

#!/bin/bash 
cat /usr/local/mgr5/addon/myaddon.xml

Run the following command to set 750 permissions for the script:

chmod 750 /usr/local/mgr5/addon/myaddon.sh

Restart the panel to apply the changes:

/usr/local/mgr5/sbin/mgrctl -m ispmgr -R