Reference9:Concept Linux Application

From innovaphone wiki
Revision as of 16:37, 14 April 2011 by Smayoral (talk | contribs)
Jump to navigation Jump to search
There are also other versions of this article available: Reference9 (this version) | Reference10

Introduction

Applications like innovaphone reporting can be developed for the linux application platform.

Requirements

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

Installation

You can install new applications or just update them here.

Requirements

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 must exist at top-level only one script with a name beginning with install and with any executable extension (sh, pl, py, out), like install_helloWorld.sh. It is of course allowed to have other install scripts inside folders or another script at top-level but beginning with another name.

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 helloWorld.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 helloWorld.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></package>
    </packages>
    <database name="hello-world" username="hello-world"/>
    <cronjobs>
        <cronjob username="www-data" script="hello_world.sh"/>
    </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>
    <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/>
</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).
- 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 an script defined in the uninstall tag.
- log-files: log files to be shown under diagnostics and also to be backup
- config-files: application configuration files that will be backup
- backup: you can define commands here that will be executed when clicking on them. 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/script 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 upload a previous application config backup.
-- restorehello-worlddb: you can upload a database backup.
You can implement your own commands/script 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 an 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 provides such an script with following options:
-- -f : xml file for the application to be uninstall.
-- -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
-- -log_script: uninstall log file.
Example:

<uninstall script="uninstall.sh -f "helloWorld.xml" -linux_user "no" -database "yes" -database_user "yes" -log_script "var/www/innovaphone/log/appl_uninstall.log"/>.<br>