Reference10:Concept Linux Application

From innovaphone wiki
Jump to navigation Jump to search
There are also other versions of this article available: Reference9 | Reference10 (this version)

Introduction

Applications like innovaphone reporting can be developed for the linux application platform.
For a better integration with the already installed web server and packages, an interface for custom applications is provided.

Requirements

It is needed to have the linux application platform installed and running.

Installation

You can install new applications or just update them here.
The installation/update file must be a .tar.gz file with a name beginning with install like install_helloWorld.tar.gz. Inside this compressed file only one script with a name beginning with install and with an executable extension (sh, pl, py, out) must exist at top-level, like install_helloWorld.sh.
Of course it is allowed to have further install scripts inside folders or another script at top-level, but beginning with another name.

Your archive must also contain a file named majorversion, which contains the major version of the Linux Application Platform, e.g. 10.

Application XML

If you want your application to be managed through the linux application platform, you need to provide an XML file with the name hello-world.xml and copy it to the following location: /var/www/innovaphone/apps/ (more information about the web server here).

This would be an example of a possible hello-world.xml file:

<?xml version="1.0" encoding="utf-8"?>
<application>
    <name>hello World!</name>
    <desc>Test application</desc>
    <version>1.0</version>
    <directory>hello-world</directory>
    <href>helloWorld.php</href>
    <linux-username>hello-world</linux-username>
    <packages>
        <package>php5-gd</package>
    </packages>
    <database name="hello-world" username="hello-world"/>
    <cronjobs>
        <cronjob script="/path/to/your/cronjob"/>
    </cronjobs> 
    <log-files>
        <log title="Hello World">/var/www/innovaphone/apps/hello-world/logs/helloWorld.log</log>
        <log title="Application log">/var/log/my_application.log</log>
    </log-files>
    <config-files>
        <conf>/var/www/innovaphone/apps/hello-world/conf/helloWorld.conf</conf>
    </config-files>
    <backup>
        <command title="Save hello World configuration files" cmd="savehello-worldcfgs" script=""/>
        <command title="Save hello World database" cmd="savehello-worlddb" script=""/>
        <command title="Save hello World log files" cmd="savehello-worldlogs" script=""/>
        <command title="Application dependant command" cmd="my_backup" script="/var/www/innovaphone/apps/hello-world/bin/my_backup.sh"/>
    </backup>
    <initd>
        <init-script>hello-world</init-script>
    </initd>
    <restore>
        <command title="Restore hello World configuration files" cmd="restorehello-worldcfgs" script=""/>
        <command title="Restore hello World database" cmd="restorehello-worlddb" script="">
            <action>/etc/init.d/postgresql restart</action>
        </command> 
        <command title="Application dependant command" cmd="my_restore" script="/var/www/innovaphone/apps/hello-world/bin/my_restore.sh"/>
    </restore>
    <uninstall script="/path/to/your/script">
        <to-delete>
            <to-del path="/path/to/file1"/>
            <to-del path="/path/to/file2"/>
        </to-delete>
    </uninstall>
    <lighttpd-auth>1</lighttpd-auth>
    <public-web-paths>
        <path>mypbx</path>
    </public-web-paths>
</application>

- name: application name displayed at the linux application platform.
- desc: very short description of the application (also displayed).
- version: application version.
- href: main site of your application. When click on name, your site will be opened in a new tab or page.
Apps.jpg
- directory: this is the directory containing at least the web application if any. This directory must be placed under /var/www/innovaphone/apps/ (/var/www/innovaphone/apps/hello-world/helloWorld.php).

If your xml file is named hello-world.xml, your directory must be named hello-world!

- linux-username: it is recommended that the application creates its own user and add it to the linux web server group and postgres group if using databases.
- packages: packages installed by the application. These packages will be removed when uninstalling the application if no other application depends on them.
- database:
-- name: database name.
-- username: it is again recommended that you create your own database postgresql user for your application.
- cronjobs: if your application is installing cronjobs, please register them here in order to remove them when uninstalling the application. You could skip this and uninstall the cronjobs with a script defined in the uninstall tag.
- log-files: log files to be shown under diagnostics and also to be backuped. Attribute no-clear in <log ...> indicates, that this file mustn't be cleared by the web interface.
- config-files: application configuration files that will be backuped/restored.
- backup: you can define commands here that will be executed on manual or automatic backup. The application platform defines by default three commands:
-- savehello-worldcfgs: it will save the configuration files defined in your application xml file.
-- savehello-worldlogs: it will save the log files defined in your application xml file.
-- savehello-worlddb: it will save the database defined in your application xml file.
You can implement your own commands/scripts, but you need to provide the full path to them.
La backup.jpg
- restore: the application platform delivers two default commands.
-- restorehello-worldcfgs: you can restore a previous application config backup.
-- restorehello-worlddb: you can restore a database backup.
The You can implement your own commands/scripts, but you need to provide the full path to them.
Action tag contains an action to be executed after the command, for example restarting the database.
La restore.jpg
- uninstall: this is a script, that will be executed when clicking on the uninstall link of your application. You need to provide the full path to it.
The application platform already provides an universal script with the following options:
-- -f : xml file for the application to be uninstalled.
-- -linux_user: if you want your linux user to be deleted.
-- -database: if you want your database to be deleted.
-- -database_user: if you want your database user to be deleted. This can only be done if no database is owned by this user.
-- -app_script: script file which is started with root rights.
-- -log_script: uninstall log file.
There is also the to-delete tag to define which files or directories should be deleted.

<uninstall script="/usr/local/bin/uninstall.sh -f 'hello-world.xml' -linux_user 'no' -database 'yes' -database_user 'yes' -log_script 'var/www/innovaphone/log/appl_uninstall.log'">
    <to-delete>
        <to-del path="/path/to/file1"/>
        <to-del path="/path/to/file2"/>
    </to-dDelete>
</uninstall>
Of course you can define your own uninstall script!


- lighttpd-auth: if set to 1, the innovaphone Linux Application Platform will provide a possibility to configure separate web server credentials for this application on the administration page.
- public-web-paths: each path will be added as public web path to the lighttpd.conf file and mustn't be specified on the web server configuration page. This can be usefull if an application requires some web paths to be always public. The given path is relative to the application directory. If the path /apps/innovaphone-reporting/mypbx should be public, just enter mypbx. The path itself follows the rules defined here .
- init-script: each init-script will be handled with:

  • update-rc.d -f init-script remove # this removes /etc/rcX.d entries for this init.d script
  • rm -f /etc/init.d/init-script # this removes the init script

Zend support

The ZendGuardLoader PHP extension is installed on the Linux VM, so Zend guarded PHP files are supported.
You can put your Zend licenses under /home/root/zend-licenses

Zend currently does not support the ARM platform, so our IPxx10 does not support the ZendGuardLoader!

Debian packages

If you install debian packages with your application, you have to ensure, that these packages fit to the packages installed by innovaphone. Do not upgrade previously installed packages as this might prevent future hotfixes by innovaphone from installing. So you may have to download the deb files manually instead of downloading directly from debian.