Eenos Apps / Plugins

Build and install external apps into Eenos. Develop plugins in Python or PHP and integrate with your Eenos control panel easily.

Getting Started With Eenos Apps

An introduction to Eenos app structure and configuration files. This helps to understand how the Eenos apps work.

Getting Started With Eenos Apps

Introduction

About Eenos Apps

Eenos apps are third-party plugins for the Eenos control panel.  This feature will help you to develop and manage custom apps for Eenos.

Eenos currently supports two types of apps.

You can develop the apps in Python or PHP as you wish. 

Directory Structure of Eenos Apps

Eenos apps have the following directory structure.

sampleapp/
├── app.conf
├── hooks
│   └── createacct
│       ├── post
│       │   └── sampleapp_post.sh
│       └── pre
│           └── sampleapp_pre.sh
├── LICENSE
├── post
│   └── 02-post.sh
├── pre
│   └── 01-ps.sh
├── rapp
│   └── sampleapp
│       ├── admin.py
│       ├── apps.py
│       ├── __init__.py
│       ├── migrations
│       │   └── __init__.py
│       ├── models.py
│       ├── templates
│       │   └── sampleapp_index.html
│       ├── tests.py
│       ├── urls.py
│       └── views.py
├── README
├── requirements.txt
├── scripts
│   ├── sampleapp_scripts1
│   ├── sampleapp_scripts.py
│   └── sampleapp_scripts.sh
├── static
│   └── sampleapp
│       ├── sampleapp.js
│       └── style.css
├── uapp
│   └── sampleapp
│       ├── admin.py
│       ├── apps.py
│       ├── __init__.py
│       ├── migrations
│       │   └── __init__.py
│       ├── models.py
│       ├── templates
│       │   └── sampleapp_index.html
│       ├── tests.py
│       ├── urls.py
│       └── views.py
├── vhosts
│   ├── rapp.sampleapp.conf
│   ├── uapp.sampleapp.conf
│   └── wap.sampleapp.conf
└── wap
    └── sampleapp
        ├── admin.py
        ├── apps.py
        ├── __init__.py
        ├── migrations
        │   └── __init__.py
        ├── models.py
        ├── templates
        │   └── sampleapp_index.html
        ├── tests.py
        ├── urls.py
        └── views.py

A detailed explanation of the directories and files is given below

app.conf

This file contains the configuration settings of the app. It is a generic INI format file. Every  Eenos app needs this file.  An Example configuration is given below:

[settings]
# All the settings fields are mandatory 
# The Name of the parent folder of the app.
# The name may contain letters, digits, hyphen and underscore
# The name always starts with a letter and a length of 20 characters.
name = sampleapp

# The menu name that will be showing inside the control panel pages
#  Maximum menu name length is 24 characters.
menu = A Sample App

# A description about the app. What is the use of this app ?
# Maximum length of description is 6o characters. 
description = This is a sample python app for testing purpose

# The programming language , currently support python or php only
# If this is a Python Django app use python
# if this is a  PHP app chose , php
# Accepted values [ python , php]
language = python

# This app version number
version = 1.0.0

# The version_check_url is a remote url shows the available current version of the app
# This url must give the version number as plain text output
# This version should ensure if the app is up-to-date
version_check_url =  https://download.eenos.com/apps/sample-python-app/version.txt

# The auto update script path used to update the scripts
# You can place this in ,/scripts/ folder so that will be installed 
auto_update = /usr/local/eenos/scripts/sampleapp_update

[wap]
# The general settings for WAP admin app
# To enable or disable this app in admin panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = off

[rapp]
# The general settings for RAPP - Reseller control panel app
# To enable or disable this app in reseller  panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values, [ off,  on] , default off
open_new_window = off

[uapp]
# The general settings for UAPP - User control panel app
# To enable or disable this app in user  panel 
# Supported values, [ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = off

This file has the following four sections:

Settings

This section contains the basic settings of the app. All fields are mandatory. The settings block has the following

wap

This section contains the app settings for the admin panel. This block has the following fields:

rapp

This section contains the app settings for the reseller panel. This block has the following fields:

uapp

This section contains the app settings for the user panel. This block has the following fields:

hooks

This folder contains the action hooks associated with the plugin. The contents of the hook folder will be copied to the Eenos hooks directory.

To know more about  Eenos hooks please read from here

pre and post scripts

These scripts will be called during the app installation time.

The pre-scripts need to be placed inside the folder pre/ which will be called before starting the app installation

The postscripts need to be placed inside the folder post/ which will be called after the app installation.

You can use any type of scripts or binaries,  these scripts simply need execute permission.

scripts

This folder contains any custom scripts associated with your plugin. These scripts will be copied to  the  Eenos scripts folder  /usr/local/eenos/scripts/

The scripts must start with your plugin name followed by an underscore.

vhosts

This folder contains the nginx vhost configuration for your app. This is only required for PHP apps.  You can place three types of vhosts in this folder. There are wap,rapp, and uapp configuration.

The file name format for the vhost is  PANEL.APP_NAME.conf, where  PANEL is wap,uapp, or rapp and  APP_NAME is the name of the app.

An  Example of  vhost for sampleapp is as follows,

├── vhosts
│   ├── rapp.sampleapp.conf
│   ├── uapp.sampleapp.conf
│   └── wap.sampleapp.conf

static

This folder contains the static files of the app including images, css and js scripts, and other static files. The static files must be inside the folder with the name of the plugin inside the static/sampleapp folder.

For example, place the static file for sampleapp in the static/sampleapp folder.

requirements.txt

This file is a standard requirement file of the Django Python apps or scripts. These are python modules that are needed for the app.

These required python modules will be installed on the Eenosd Python

wap,uapp,rapp

This folder contains the app source files.  You need to place the app files inside this folder for the respective control panel interface. Please make sure you place the app inside a subfolder with your app name.

For example, if we have an app named sampleapp, the app files will be as follows,

These folders contain either python scripts or php scripts as per your app project.

To start developing apps  try to start with the sample app setup from the coming sections.

Create Python APP for Eenos

Create an app or plugin using python and django framework and integrate it into Eenos.

Create Python APP for Eenos

sample python app

Getting started with a sample python app on Eenos

This guide will help you to create a sample python app for the Eenos hosting control panel.

The python apps are generic Django apps.  We recommend reading the Django developer documentation to know how to create an app using Django.

Download an Example Python App

You can download an example Eenos Python App from  here sampleapp.tar.gz

app.conf

The first step is to create the app.conf. An example of a sampleapp is given below :

[settings]
# All the settings fields are mandatory 
# The Name of the parent folder of the app.
# The name may contain letters, digits, hyphen and underscore
# The name always starts with a letter and a length of 20 characters.
name = sampleapp

# The menu name that will be showing inside the control panel pages
#  Maximum menu name length is 24 characters.
menu = A Sample App

# A description about the app. What is the use of this app ?
# Maximum length of description is 6o characters. 
description = This is a sample python app for testing purpose

# The programming language , currently support python or php only
# If this is a Python Django app use python
# if this is a  PHP app chose , php
# Accepted values [ python , php]
language = python

# This app version number
version = 1.0.0

# The version_check_url is a remote url shows the available current version of the app
# This url must give the version number as plain text output
# This version should ensure if the app is up-to-date
version_check_url =  https://download.eenos.com/apps/sample-python-app/version.txt

# The auto update script path used to update the scripts
# You can place this in ,/scripts/ folder so that will be installed 
auto_update = /usr/local/eenos/scripts/sampleapp_update

[wap]
# The general settings for WAP admin app
# To enable or disable this app in admin panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = off

[rapp]
# The general settings for RAPP - Reseller control panel app
# To enable or disable this app in reseller  panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values, [ off,  on] , default off
open_new_window = off

[uapp]
# The general settings for UAPP - User control panel app
# To enable or disable this app in user  panel 
# Supported values, [ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = off

You should set the language with the value python for a python app.

Files and destination of python app  - sampleapp

The following table will let you know where the files will be placed during app installation time.

Sample App Item Location to place Description
./hooks/* /var/eenos/hooks/  All hook scripts of the app
./scripts/* /usr/local/eenos/scripts/ All scripts of the app
./wap/sampleapp /usr/local/eenos/wap/sampleapp The admin panel plugin files
./rapp/sampleapp /usr/local/eenos/rapp/sampleapp The reseller panel plugin file
./uapp/sampleapp /usr/local/eenos/uapp/sampleapp The user panel app files
./static/sampleapp /usr/local/eenos/wap/public/static/default/sampleapp Admin panel static files
./static/sampleapp /usr/local/eenos/rapp/public/static/default/sampleapp Reseller panel static files
./static/sampleapp /usr/local/eenos/uapp/public/static/default/sampleapp User panel static file

The static files are common files that will be copied into the three control panel interface static folders.

 App folder structure 

An example folder structure of  pythonapp, sampleapp is as follows,

root@u: ~ # tree sampleapp
sampleapp
├── app.conf
├── hooks
│   └── createacct
│       ├── post
│       │   └── sampleapp_post.sh
│       └── pre
│           └── sampleapp_pre.sh
├── LICENSE
├── post
│   └── 02-post.sh
├── pre
│   └── 01-ps.sh
├── rapp
│   └── sampleapp
│       ├── admin.py
│       ├── apps.py
│       ├── __init__.py
│       ├── migrations
│       │   └── __init__.py
│       ├── models.py
│       ├── templates
│       │   └── sampleapp_index.html
│       ├── tests.py
│       ├── urls.py
│       └── views.py
├── README
├── requirements.txt
├── scripts
│   ├── sampleapp_scripts1
│   ├── sampleapp_scripts.py
│   └── sampleapp_scripts.sh
├── static
│   └── sampleapp
│       ├── sampleapp.js
│       └── style.css
├── uapp
│   └── sampleapp
│       ├── admin.py
│       ├── apps.py
│       ├── __init__.py
│       ├── migrations
│       │   └── __init__.py
│       ├── models.py
│       ├── templates
│       │   └── sampleapp_index.html
│       ├── tests.py
│       ├── urls.py
│       └── views.py
├── vhosts
│   ├── rapp.sampleapp.conf
│   ├── uapp.sampleapp.conf
│   └── wap.sampleapp.conf
└── wap
    └── sampleapp
        ├── admin.py
        ├── apps.py
        ├── __init__.py
        ├── migrations
        │   └── __init__.py
        ├── models.py
        ├── templates
        │   └── sampleapp_index.html
        ├── tests.py
        ├── urls.py
        └── views.py

Python requirements

You can place all your pip requirements for your python app inside the file  requirements.txt

Pre-installation scripts

Put all your pre-installation scripts of the plugin inside the folder pre/

Post-installation scripts

Place all your post plugin installation scripts inside the folder post/

scripts

Place all scripts related to your plugin in the folder scripts/

hooks

Place all your hooks  for Eenos inside the folder hooks/

Packaging your app

To package an app create a gzipped tar file of the source folder. An example of sampleapp is as follows:

tar -czf sampleapp-1.0.0.tar.gz sampleapp/

Manage Authentication in Django Apps

You can use the django decorator function  login_required to ensure the actions are authenticated. An example django  view code is as follows,

from django.contrib.auth.decorators import login_required
# use the login decorator
@login_required
def sampleapp_home(request):
    return render(request, 'sampleapp_home.html', {})

Install, Remove, and Upgrade App

To install, remove, or upgrade the app,  please read the app operations from  Manage Apps  page.

Create PHP App for Eenos

How to create a php plugin for the Eenos hosting control panel and integrate with Eenos.

Create PHP App for Eenos

sample php app

Getting started with a sample php app on Eenos

This guide will help you to create a sample php app for the Eenos hosting control panel.

The PHP apps are generic php apps.  

Download an Example PHP App

You can download an example Eenos PHP App from  here:   samplephpapp.tar.gz

app.conf

The first step is to create the app.conf . An example of samplephpapp is given below :

[settings]
# All the settings fields are mandatory 
# The Name of the parent folder of the app.
# The name may contain letters, digits, hyphen and underscore
# The name always starts with a letter and a length of 20 characters.
name = samplephpapp

# The menu name that will be showing inside the control panel pages
#  Maximum menu name length is 24 characters.
menu = A Sample PHP App

# A description about the app. What is the use of this app ?
# Maximum length of description is 6o characters. 
description = This is a sample PHP app for testing purpose

# The programming language , currently support python or php only
# If this is a Python Django app use python
# if this is a  PHP app chose , php
# Accepted values [ python , php]
language = php

# This app version number
version = 1.0.0

# The version_check_url is a remote url shows the available current version of the app
# This url must give the version number as plain text output
# This version should ensure if the app is up-to-date
version_check_url =  https://download.eenos.com/apps/sample-php-app/version.txt

# The auto update script path used to update the scripts
# You can place this in ,/scripts/ folder so that will be installed 
auto_update = /usr/local/eenos/scripts/samplephpapp_update

[wap]
# The general settings for WAP admin app
# To enable or disable this app in admin panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = on

[rapp]
# The general settings for RAPP - Reseller control panel app
# To enable or disable this app in reseller  panel 
# Supported values ,[ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values, [ off,  on] , default off
open_new_window = on

[uapp]
# The general settings for UAPP - User control panel app
# To enable or disable this app in user  panel 
# Supported values, [ on , off ]
status = on

# If you wish to open the app in new browser window during a click action
# from the  control panel
# Supported values [ off,  on] , default off
open_new_window = on

You should set the language with value php for a PHP app.

Files and destination of php app  - samplephpapp

The following table will let you know where the files will be placed during app installation time.

Sample App Item Location to place Description
./hooks/* /var/eenos/hooks/  All hook scripts of the app
./scripts/* /usr/local/eenos/scripts/ All scripts of the app
./wap/samplephpapp /usr/local/eenos/3rdparty/apps/wap/samplephpapp The admin panel plugin files
./rapp/samplephpapp /usr/local/eenos/3rdparty/apps/rapp/samplephpapp The reseller panel plugin file
./uapp/samplephpapp /usr/local/eenos/3rdparty/apps/uapp/samplephpapp The user panel app files
./static/samplephpapp /usr/local/eenos/wap/public/static/default/samplephpapp Admin panel static files
./static/samplephpapp /usr/local/eenos/rapp/public/static/default/samplephpapp Reseller panel static files
./static/samplephpapp /usr/local/eenos/uapp/public/static/default/samplephpapp User panel static file
./vhosts/wap.samplephpapp.conf /usr/local/eenos/etc/eenosd/wap.samplephpapp.conf The admin panel nginx vhost
./vhosts/rapp.samplephpapp.conf /usr/local/eenos/etc/eenosd/rapp.samplephpapp.conf Reseller panel nginx vhost
./vhosts/uapp.samplephpapp.conf /usr/local/eenos/etc/eenosd/uapp.samplephpapp.conf User panel nginx vhost

The static files are common files that will be copied into the three control panel interface static folders.

 App folder structure 

An example folder structure of  php app, samplephpapp is as follows,

# tree samplephpapp
samplephpapp
├── app.conf
├── hooks
├── LICENSE
├── post
│   └── 02-post.sh
├── pre
│   └── 01-ps.sh
├── rapp
│   └── samplephpapp
│       ├── index.php
│       └── starter-template.css
├── README
├── requirements.txt
├── scripts
│   └── samplephpapp-scripts.sh
├── static
│   └── samplephpapp
│       ├── css
│       │   ├── bootstrap.min.css
│       │   ├── bootstrap.min.css.map
│       │   ├── bootstrap.rtl.min.css
│       │   └── bootstrap.rtl.min.css.map
│       └── js
│           ├── bootstrap.bundle.min.js
│           └── bootstrap.bundle.min.js.map
├── uapp
│   └── samplephpapp
│       ├── index.php
│       └── starter-template.css
├── vhosts
│   ├── rapp.samplephpapp.conf
│   ├── uapp.samplephpapp.conf
│   └── wap.samplephpapp.conf
└── wap
    └── samplephpapp
        ├── index.php
        └── starter-template.css

Python requirements

You can place all your pip requirements for your python app inside the file  requirements.txt

Pre-installation scripts

Put all your pre-installation scripts of the plugin inside the folder pre/

Post-installation scripts

Place all your post plugin installation scripts inside the folder post/

scripts

Place all scripts related to your plugin in the folder scripts/

hooks

Place all your hooks  for Eenos inside the folder hooks/

Vhosts

Place all your nginx vhost files inside the folder vhost/

Manage Authentication in PHP Apps

You can authenticate the php apps using the php pam module or a custom preg function. The sample code is as follows,

PAM Authentication
<?php
// Sample function to check authentication using php-pam module 
function auth_pam($user,$password){    
    if (pam_auth($user,$password)){
        return true;
    }else{       
        return false;
    }
 }
Custom Preg 
<?php
 
function is_notsuspended($username){
    if (file_exists("/var/eenos/suspended/$username")){        
        return false;
    }else{        
        return true;
       
    }
}

function iseenosuer($username){
    if (file_exists("/var/eenos/users/$username")){        
        return true;
    }else{        
        return false;
    }
}

function sauthenticate($user, $pass){
    if (iseenosuer(($user))){
        if (is_notsuspended($user)){
        $shad =  preg_split("/[$:]/",`cat /etc/shadow | grep "^$user\:"`);
        if (!isset($shad[2]) || !isset($shad[3])) return false;
        $mkps = preg_split("/[$:]/",crypt($pass, '$'.$shad[2].'$'.$shad[3].'$'));         
        return ($shad[4] == $mkps[3]);
        }else{
            return false;
        }
    }
    else{
        return false;
    }   
  }

Packaging your app

To package an app create a gzip tar file of the source folder. An example of samplephpapp is as follows:

tar -czf samplephpapp-1.0.0.tar.gz samplephpapp/

Install, Remove, and Upgrade the App

To install, remove, or upgrade the app please read the app operations from Manage Apps  page.

Manage Apps

How to install, remove, and update apps from Eenos. This is a Command line tool for managing the Eenos app.

Manage Apps

appmanager

Manage Eenos Apps

Eenos has an app management tool called appmanager. This tool can be used to control the app operations.

Command:  /usr/local/eenos/scripts/appmanager

This tool can be used to install, remove, update, list, and disable apps on the server. 

Options : 
usage: appmanager [command] [command options]  

Eenos App Manager Tool

Command(s):
  -i path_to_app, --install path_to_app
                        The full path to the app package ( .tar, .tar.gz, .tgz)
  -r app_name, --remove app_name
                        App name to uninstall
  -u app_name, --update app_name
                        Update the app using auto update script of the app
  -l, --list            List all installed apps
  -b, --build           Rebuild the app menus
  -d app_name, --disable app_name
                        Disable the app on wap,uapp or rapp
  -e app_name, --enable app_name
                        Enable the app on wap,uapp or rapp

Disable / Enable Options(Required):
  -p PANEL, --panel PANEL
                        The panel name to disable or enable, values ( wap, uapp, rapp)
  -a, --all             Disable or Enable from all panels

optional arguments:
  -h, --help            show this help message and exit

Install App

To install the app, use the following command,

/usr/local/eenos/scripts/appmanager -i  path_to_app

Where path_to_app is the full path of the gzip tar file of the app.

Example: 

Install the app sampleapp.tar.gz

/usr/local/eenos/scripts/appmanager  -i /root/sampleapp.tar.gz

Uninstall App

To remove an app from Eenos use the following command

 /usr/local/eenos/scripts/appmanager -r app_name   

, where app_name is the name of the app

Example :

Remove the app sampleapp

/usr/local/eenos/scripts/appmanager --remove sampleapp

Upgrade App

You can run upgrade actions for the app. 

To run an upgrade using  Eenos your app must need an auto_update script configured during app installation time.

Use the following command to upgrade the app:

/usr/local/eenos/scripts/appmanager  -u app_name

Where app_name is the name of the app

Disable App

You can disable the app from all control panel interfaces or a single interface 

To disable the app on all interfaces use the following command.

/usr/local/eenos/scripts/appmanager --disable app_name --all

To disable the app on a single panel use the following command :

/usr/local/eenos/scripts/appmanager --disable app_name --panel  PANEL_NAME

Where, 

Enable App

You can enable the app from all control panel interfaces or a single interface 

To enable the app on all interfaces use the following command.

/usr/local/eenos/scripts/appmanager --enable app_name --all

To enable the app on a single panel use the following command :

/usr/local/eenos/scripts/appmanager --enable app_name --panel  PANEL_NAME

Where,

If the app is disabled globally, you can enable it for a single control panel.

List  Apps

To view all installed apps on the server use the following command.

/usr/local/eenos/scripts/appmanager -l