QPKG Training

advertisement
SUMMARY
Foreword
Guidelines for the QNAP QPKG system v1
Overview
Development recommendations
Exercise #1 : Asterisk QPKG – IPBX
Exercise #2 : XDove – All-in-one Mail Service
Second Meeting
Q&A regarding previous session
Asterisk example
Workshop (1 hour):
-
Package your first Hello QPKG
How to select your 2nd QPKG
Review the list of Apps to be packaged
First Meeting
XDove example presentation (30 mins)
This slide presentation (3 hours)
Workshop (2.5 hours):
-
Workshop (30 mins):
-
Get familiar with the folder structure of the
sample-qpkg-hello_qnap template
Take XDove and package
Code reading
Wrap-up (1 hour)
-
Q&A about issues, points to clarify
8 avril 2015

Cloud Computing and SaaS (Software as a Service)
These are two major strategic developments that will disrupt the information systems
business by decoupling the Usage from the Infrastructure.
◦
USAGE = Saas (pronounced 'sass') is a model of software deployment whereby a provider
licenses an application to customers for use as a service on demand.



SaaS is pushed by:


◦
Applications are hosted on the provider web servers
Applications are loaded on demand and disabled after use or contract expiration.
Need to use/pay software license on-demand
Improve application’s inter-connections by using the same tools among large groups of users
INFRASTRUCTURE = Cloud computing is a way of computing, via the Internet, that broadly
shares computer resources instead of using software or storage on a local PC.


NOTE: confusion may arise because Cloud computing providers also promote a SaaS offer to run on their infrastructure.
Cloud computing is pushed by:

Need to improve the CADE - Corporate Average Data center Efficiency



waste of energy to power large, numerous, under-used data center (be greener)
Share maintenance costs of data center
Scale user infrastructure to what they really need (computing power and time slots)
8 avril 2015

QNAP QPKG
◦

QPKG may be seen as SaaS-like applications

Provide a wide variety of applications to the end-users

Groups of applications are tailored by market segment (usage)

EZ to install/remove by non-technical end-users

Generic (database, mail) or specific (ERP) applications

Open system that enables OS communities to develop QPKGs

Currently all QPKG are released for free to NAS users

QPKG system will evolved in the near future to improve
QPKG available today
◦
Official QPKG

MLDonkey, SSOTS (SlimServer on Turbo Station), Optware IPKG (Itsy Package Management System), phpMyAdmin, Joomla,
WordPress, SABnzbd+, AjaXplorer, Tomcat, XDove, Asterisk, JRE 6 (Java Runtime Environment),
◦
Beta QPKG

rTorrent++, NZBGet, IceStation, Plugmedia (Multimedia Station), Perl, Piwik, phpBB3, Unrealircd, Q-Ext, Q-Sims (Virtual World
Simulator), eyeOS, Magento, OpenX, MediaWiki, PostgreSQL

To install a new application from a QPKG, the USER:
1. Use the RSS feed to download the QPKG from the QNAP servers
2. Shall upload the QPKG on the NAS thanks to the QPKG page of the
NAS Administration web UI
3. Proceed with the installation by clicking the INSTALL button
1
QPKG
2
3

QPKG Application management
1.
Once installed, the Application may be started
Execute the script : ./qpkg_name.sh start
2.
The Application may be stopped
Execute the script : ./qpkg_name.sh stop
3.
The QPKG may be removed
Execute the script : ./.uninstall.sh
4.
The user can access the Application web interface (if any)
The URL link is active once the QPKG is Enabled
4
1
2
3

In order to develop QPKG applications, you will need to deal with:
◦
Linux Bash scripts

◦
PHP language




◦
To enable the QPKG to support several selectable languages
To enable the QPKG to support help pages in different languages
Wiki page writing



◦
To issue admin commands from the web interface
LOCALE and Internationalization understanding


◦
Compile some application from source
CGI script understanding

◦
Web interface code writing
JQuery for Rich Interface Applications
Smarty* for web page skin management
TinyMCE* as user text editor
Linux cross-compilation understanding

◦
For installation and administration tasks
To make available online help pages
To maintain a troubleshooting page
To provide additional information about the QPKG (eg. case study, technology information, etc…)
Technical English


For code comments and QPKG help pages
For Applications Notes and Wiki pages
* To be discussed
GUIDELINES
For
QNAP QPKG system v1 development
SUMMARY
Foreword
Guidelines for the QNAP QPKG system v1
Overview
Development recommendations
Exercise #1 : Asterisk QPKG – IPBX
Exercise #2 : XDove – All-in-one Mail Service

Use SVN for versioning
◦ Repository svn://…….
◦ Use of TRAC (TBD)

Use Bugzilla for bug tracking
◦ (TBD)

Use collaborative environment
◦ To share documents
◦ To get support from QNAP

Use QPKG template
◦ sample-qpkg-hello_qnap

There are several levels of packaging:
◦
Packaging applications as a PHP web applications (eg Joomla). The QPKG provides:



◦
Packaging applications already existing as IPKG modules (eg Asterisk). The QPKG provides:



◦
A folder with the binary/libs downloaded from the Deb pkg
an installation/remove script to copy/remove the files and recreate the symbolic links to the libs
a script to Start/Stop the application
An URL link to access the Web server/GUI if any
Packaging an application from a source code exists (eg FreeSwitch). The QPKG provides:





◦
an installation script for the IPKG
a script to Start/Stop the application
An URL link to access the Web server/GUI if any
Packaging an already existing Debian x86/ARMEL package (eg Mono). The QPKG provides:




◦
an installation/remove script to copy/remove the PHP code
A folder with the web files
an URL link to access the application from the QPKG Interface
A folder with your compiled binaries
A folder with the binary/libs downloaded from the Deb pkg
an installation/remove script to copy/remove the files and recreate the symbolic links to the libs
a script to Start/Stop the application
An URL link to access the Web server/GUI if any
BUT most of the time you will have to (eg Plugmedia):





Use some IPKG to install libs
Compile some source code to get the application running
Write/modify script for the QPKG installation/removal
Write/modify script to start/stop the application
Develop a PHP interface to enable the user to configure the application
under /apps/scritps folder
qpkg_build_QNAP.sh
Built-in.sh
DO NOT MODIFY
DO NOT MODIFY
START
Creating a QPKG archive
◦
1
build.sh
+
DO NOT MODIFY
Only configure
1
under /apps/qpkg_name folder
4
built-in.sh
3
X
2
qinstall.sh
Once the code is written, we proceed with
the QPKGing
The build.sh script is launched to
manage the QPKG creation. It will call the
qpkg_build_QNAP.sh script to finish up
the packaging.
Compression of the relevant files for the
selected NAS model into the archive
npkg_name.tar.tgz
Add the installation script renamed as
qinstall.sh for the selected NAS model.
3
qinstall_x09.sh
qinstall_x19.sh
qinstall_x86.sh
qinstall_all.sh
Add the built-in.sh script to enable the
QPKG archive self-extraction
npkg_name.tar.tgz
4
Installation scripts
qpkg_name-version.qpkg
5
+
2
QPKG files
PHP, binaries, images,
Scripts, css, JS, etc.
QPKG
5
under /apps/build folder
The QPKG archive file is stored into the
/build folder
WARNING: keep consistency between QPKG name
and file naming (QPKG name may be retrieved
from script name.

Tree structure for QPKG development [MANDATORY]
apps folder

◦
All QPKG applications
/qpkg_name folder (for one Apps)


build.sh script used to create the QPKG build - SYNTAX= ./build.sh [arm-x09|arm-x19|x86|all]
qinstall_xxx.sh scripts for the QPKG installation (one for each NAS model)

/src-all folder


The relevant qinstall_xxx.sh will be rename as qinstall.sh and embeded in the QPKG build

All the files for a platform independent applications
/src-shared folder




/src-x09 folder




Every files required by Chrooted ARMEL platforms (TS-109/209/409)
Libs and/or IPKG modules
CGI files compiled or not. CGI file to pass bash cmd from PHP with admin status
/src-x19 folder




Every files that are platform independent – eg PHP files for a web interface
Icons files
Start/Stop script and .uninstall.sh script
Every files required by ARMEL platforms (TS-119/219/419)
Libs and/or IPKG modules
CGI files compiled or not. CGI file to pass bash cmd from PHP with admin status
/src-x86 folder



Every files required by Intel platforms (TS-509/809/239/439/639...x59)
Libs and/or IPKG modules
CGI files compiled or not. CGI file to pass bash cmd from PHP with admin status
/build folder


Receive the QPKG archives for distribution created by the ./build.sh <model> cmd
A build is made of a build-in.sh script and a tar file that gather the folder above according to the NAS type.
/script folder



Hosts the scripts to create the build – DO NOT MODIFY
built-in.sh is a bootstrap included into the QPKG to make it self-extracted and launch the installation
qpkg_build_QNAP.sh is the builder script to create the QPKG archive
/apps
# QPKG application folder
|-- /hello_qnap
# Sample QPKG app (Hello QNAP)
|---- build.sh
# QPKG build script
|---- qinstall-x09.sh
# QPKG install script for x09 series NAS
|---- qinstall-x19.sh
# QPKG install script for x19 series NAS
|---- qinstall-x86.sh
# QPKG install script for x86 series NAS
|---- qinstall-all.sh
# QPKG install script for NAS independant app
|---- qpkg.cfg
# QPKG package information
|---- /src-all
# for non hardware-dependent apps (eg, web apps)
|---- /src-shared
# for non hardware-dependent common files
|---- .qpkg_icon.gif
# Main QPKG icon (display in admin backend)
|---- .qpkg_icon_80.gif
# QPKG icon shown in pop-up window
|---- .qpkg_icon_gray.gif
# Grayed-out QPKG icon (when disabled)
|---- /hello_qnap
# Stores QPKG webUI files
|---- index.php
# QPKG webUI files
|---- hello_qnap.sh
# QPKG app start/stop script (/etc/init.d/hello_qnap.sh)
|---- .uninstall.sh
# QPKG uninstall procedures
|---- /src-x09
# QPKG app folder (for arm-x09 series NAS)
|---- /bin
# Stores QPKG binaries
|---- hello_qnap # QPKG main app binary (for arm-x09 series NAS)
|---- hello_qnap.conf
# QPKG main app config file
|---- /src-x19
# QPKG app folder (for arm-x19 series NAS)
|---- /bin
# Stores QPKG binaries
|---- hello_qnap # QPKG main app binary (for arm-x19 series NAS)
|---- hello_qnap.conf
# QPKG main app config file
|---- src-x86
# QPKG app folder (for x86 series NAS)
|---- /bin
# Stores QPKG binaries
|---- hello_qnap # QPKG main app binary (for x86 series NAS)
|---- hello_qnap.conf
# QPKG main app config file
/build
# Destination build folder
/scripts
# Stores QPKG build scripts
|---- built-in.sh
# QPKG build scripts
|---- qpkg_build_QNAP.sh
# QPKG build scripts

Help and Documentation
◦
Code files MUST BE documented in English
◦
User help pages shall support Internationalization (selectable languages)
◦
Application user interface (web GUI) shall have help pages/pop-ups to provide additional information to the
user (English, Chinese)
◦
Applications Notes for each QPKG must be accessible from QNAP website
◦
User documentation, application examples, troubleshooting sections may be gathered as wiki pages
◦
Also consider to translate the application in Chinese if not available




Translate the Web GUI
Translate the Help pages any
Translate the Installer if any
Optionally, you can translate (low priority)



◦
The wiki pages (shall be at least in English)
The online help if any
The examples
Languages (speakers)






English – mandatory
Chinese
Hindi
French
Arabic
Spanish
( 920
(1.12
( 740
( 600
( 482
( 380
millions)
milliard)
millions)
millions)
millions)
millions)

Full testing requires the QPKG to be created

Application testing can be done “in situ” by duplication of the QPKG src-xxx
folders
◦ You may install the QPKG manually (see §3)
◦ Copy the relevant src-xxx folders for a specific NAS model under:

/share/xx0_DATA/.qpkg/<your_qpkg>
◦ Create the symbolic links and set the permissions
◦ Run the application from this location

Installation debugging is tricky
◦ Once the QPKG is created copy the QPKG into /share/Public
◦ Start the installation using ./your_qpkg.qpkg (self-extraction)
◦ The QPKG installs on your NAS the same way as if it was uploaded and installed from
the QPKG interface
◦ Monitor the installation and check for failure
◦ qinstall_xxx.sh script debugging:





There is no easy way to debug the installation script
If the qpkg installation fails use ./built.sh <model> debug and check the temporary folder:
/mnt/HDA_ROOT/update_pkg/tmp
You will find the qinstall.sh, qpkg-name.tgz, qpkg.cfg and common.sh
Edit and modify the qinstall.sh to fix bug
Copy the working version back to your SVN

Recommendations (TBD)
◦ Avoid folder removal (rm –R /xxx/$VAR and VAR is empty due to bug or
user entry error)
◦ Log your code execution
 into a log file for debugging (using a tee instruction for example)
 Report critical errors using the QNAP Admin log system (/sbin/write_log)
 Keep log file size under control (tail or rotation files)
◦ To improve coding, use “pair programming” on sensitive pieces of code
◦ Use code review across project teams
◦ Cross projects with your colleagues for beta tests
◦ Suggestion : Agile Software development methodology (e.g. Scrum)
 List all tasks into a backlog
 Extract a backlog subset which can provide in a fixed 2 weeks timeslot, a
functional* product with the selected features (Sprint)
 Reiterate the Sprints until the backlog gets empty
* Functional means, all selected features for the Spring have been implemented,
tested and validated like in a final product

Minimum testing to be performed on a QPKG for each NAS models (series) before Alpha
release
◦
◦
◦
◦
◦
◦
◦
◦

If your QPKG (A) is to be used by an other QPKG (B) (eg. PostgreSQL)
◦
◦
◦

Test your QPKG (A) with the QPKG (B)
Test that the QPKG (A) removal will not destroy data that belong to QPKG (B)
For the time being there is no way to prevent the removal of QPKG (A) if QPKG (B) is still installed
Testing with IPKG modules installation
◦
◦

Test QPKG installation – qinstall.sh script
Test QPKG removal - .uninstall.sh script (and check for residue after removal such as broken
symblink )
Test QPKG Enable/Disable - <your_qpkg>.sh script
Test QPKG installation and upgrade
Test Web GUI if any
Test for security issues if the QPKG needs to support some restrictions (password, account, multiusers,…)
Test cased can be user cases and may also be providing in the user’s document
Any other tests to ensure the QPKG to meet the requirements
Shall you QPKG use IPKG modules, you must test the correct installation of modules
If a pre-installation is enabled (see next slides for ipkg modules installation) check for failure and
possible remote ipkg installation from Internet
QPKG shall be released for Production
◦
Ensure to fully passed the Alpha and Beta levels
SUMMARY
Foreword
Guidelines for the QNAP QPKG system v1
Overview
Development recommendations
Exercise #1 : Asterisk QPKG – IPBX
Exercise #2 : XDove – All-in-one Mail Service

Standard QPKG installation procedure
1. Download the QPKG from the QNAP servers
2. Upload the QPKG on the NAS with the NAS Administration web UI
3. Install by clicking the INSTALL button

Manual QPKG installation procedure
1. Copy the QPKG on the NAS (eg /share/Public)
2. Auto-run the QPKG - ./qpkg_name_ver_model.qpkg

Once the installation has been launched,
◦
The QPKG is copied into a temporary folder
◦
The QPKG is self-launched to:
/mnt/HDA_ROOT/update_pkg/tmp



Extract the embedded tar archive thanks to the built-in.sh bootstrap script
Execute the qinstall_xxx.sh script to proceed with the installation
Remove the files from th temporary folder
◦
The qinstall.sh script has several functions to handle the different situations:

Utils Defines section

All bash commands used

System Defines section

QPKG Info section


Required by the QPKG system
Source the common variables defined in config.cfg

pre-install() – Add you code here

install_routines() – Add you code here


Routines to install or check for libs required by the QPKG application


Routines to execute during installation
The TAR file extraction is handled in the install() routine

Routines to clean-up, remove temp file, etc …

If an update is detected (QPKG already installed) this routine shall receive the code to backup data for example.

Update the application files concerned by the upgrade procedure
post-install() – Add you code here

pre-update() – Add you code here

update_routines() – Add you code here

post-update() – Add you code here

If an update is detected (QPKG already installed) this routine shall receive the code to restore the previously backup data for
example.
your_routine()


You may need to add your own routine to keep the script more legible
◦
The qinstall.sh script structure – cont’d:

_exit() – DO NOT MODIFY

find_base() – DO NOT MODIFY



Exit the script and return a message in the NAS log
Get the shared folder in QPKG_BASE=[HDx_DATA or MDx_DATA]
Set the QPKG_INSTALL_PATH and QPKG_DIR

link_start_stop_script() – DO NOT MODIFY

register_qpkg() – DO NOT MODIFY

check_existing_install() – DO NOT MODIFY

copy_qpkg_icons() – DO NOT MODIFY

start_apache() – DO NOT MODIFY





Creates the link to enable to start/stop the application from the QPKG administration interface and during the boot if enabled
Register the QPKG into the QPKG database
Detect which kind of installation to perform (install or upgrade)
Move the QPKG icons to their final location
Start the Apache server if not running – WARN: will not restart a run Apache server

create_req_symlinks() – Add you code here

set_req_permissions() – Add you code here

install() – DO NOT MODIFY UNLESS THERE IS A VERY GOOD REASON




Create the symbolic links needed by the appllication
Set the permissions on files and folders
Proceed with the files copy
A folder for each QPKG is created under /share/xx0_DATA/.qpkg (where xx stands for HD in std mode or MD in RAID mode)
The qinstall_xxx.sh script is no longer available after installation. QPKG removal is managed by the .uninstall.sh script.

The .uninstall.sh script (Please, leave the place clean after QPKG removal)
◦
◦
◦
The script is stored under the QPKG src-shared folder
The .uninstall.sh script is used during QPKG removal operation
There is one uninstall.sh script for all NAS type (use model detection if needed)
◦
Keep in mind :
 To set the QPKG name in QPKG_NAME variable – there is no easy way to retrieve safely and automatically the
name
 To remove dead symbolic links that you have create for your application

Recreating over an existing symblink may cause some issues

DO NOT remove libs and/or IPKG modules you have installed. They may be used now by other QPKG
applications

To remove all configuration files, temporary files or folders that you have created for the QPKG applications
and which are not located under the QPKG root folder – clean your mess !

DO NOT delete database system that you have installed but only the database/tables that you have created

Be careful while removing users/groups to be sure they are not used by other applications

The . start/stop script qpkg_name.sh and qpkg_name.conts scripts
◦
The qnap_name.sh script is stored under the apps/qpkg_name/src-shared folder
◦
The qnap_name.sh script is used to
 Start the application



When the user press the Enable button on the QPKG Administration page

When the NAS reboot if the QPKG has been enabled
Stop the application

When the user press the Disable button on the QPKG Administration page

When the user press the Remove button on the QPKG Administration page
Restart the application

◦
Proceed with a Stop and a Start
The qnap_name.sh script does not need to be modified – modifications are placed into the qnap_name.sh
script
 Specific code is placed into the qnap_name.conf bash file for each NAS version under the src-xxx folders
 The qnap_name.conf file is sourced in the qnap_name.sh file to take into account the specific code

QPKG application icons
◦
.qpkg_icon.gif
Icon displayed on the QPKG admin GUI when QPKG is
◦
.qpkg_icon_gray.gif
Icon displayed on the QPKG admin GUI when QPKG is
.qpkg_icon_80.gif
Icon displayed in the QPKG control dialog box
◦
◦
◦
◦
Enabled
Disabled
Icons are located into the apps/qpkg_name/src-shared folder
Icons are copied into the /home/httpd/RSS/images/ folder during installation
Please use QNAP graphical charter
.qpkg_icon_80.gif
.qpkg_icon.gif
.qpkg_icon_gray.gif

You may have to develop a Application interface
◦
◦
This does NOT concern the Application PHP to be packages (e.g. Joomla PHP or PhpPgAdmin PHP interface)
It is related to YOUR PHP development to create an application configuration page for example.
◦
Configuration and variable in the config.php


◦
No hard coded paths please (use path variable in config.php)
Variables for : params (Ports, URL, IP Add, …) etc.
Recommended folders structure (to be discussed first and used by EVERYONE)
├─ /src-shared
│
└─ /<qpkg_name> (web gui folder)
│
├─ index.php
│
├─ /database
│
├─ /system
│
│
├─ /_cache
Smarty cache
│
│
├─ /_compiled
Smarty accelerator
│
│
├─ /config
configuration files
│
│
├─ /js
JQuery, javascript code
│
│
├─ /libraries
│
│
│
├─ /smarty
│
│
│
└─ /editors
│
│
│
└─ /tiny_mce
│
│
├─ /langs
folder for languages and help files
│
│
├─ /logs
│
│
├─ /inc
folder for php files
│
│
├─ /themes
│
│
└─ /default
Default skin themes
│
│
├─ /css
folder for CSS sheets
│
│
├─ /images
folder for images and thumbnails
│
│
├─ /js
javacript used by the default template only
│
│
└─ /tpl
(or inc)
│
├─ / src-xxx
│
└─ /bin
binaries not related to the application (eg. compiled bash) and cgi files
Required by Smarty
Required by TinyMCE

PHP web interface
◦
Has DOCTYPE = DTD XHTML 1.0 Transitional


◦
◦
◦
Has CHARSET = UTF-8
Is W3C compliant – please submit your pages for compliance
Has to support Internationalization for different languages



◦
Get it from QNAP or mimic the v3 admin GUI
Share graphics, CSS, Smarty templates between your QPKG devs
Shall you need a skinner please use Smarty
◦
◦
◦

Set a default language to English using a configuration variable in your config.ini
Have a language drop list to enable the user selection
Optional : Use browser language detection to find the language or fallback to English
Has to follow the QNAP graphical charter



Needed with JQuery
DocType experts are welcomed to address this topic then use the same for all QPKG
Default page size is 1024 x 768 px.
Pages must be correctly displayed for this resolution and above.
Choose one stable version and keep it for all QPKG
Shall you need a RIA (Rich Internet Application) please use JQuery
◦
Do not mods the JQuery (tweek the code) to allow future upgrades

For application that requires a user configuration
◦
◦
◦
Use a QSA – Quick Start Assistant (Wizard) and support internationalization
5/6 pages maximum
Users are non-technical persons
Q-Sims QSA
8 avril 2015
Pa
ge
28

PHP web interface
◦
◦

User is seen as Guest (Apache)
User cannot issue admin commands using the exec PHP instruction
A workaround exists
◦
◦
◦
Call a CGI code (bash) from the PHP using the wget instruction
The CGI code is executed with admin privileges
Execution may be incredibly slow because:



To do
◦
Place you cgi files under the right folder:





wget start to check for IPV6 then fallback to IPV4 after timeout
Need to force IPV4 (use a variable to allow easy setup changes)
apps/qpkg-name/src-shared – for ASCII cgi files
apps/qpkg-name/src-xxx – for compiled cgi files
CHMOD 755 qpkg_name.cgi
Create a symbolic link from qpkg_name/bin/ folder to /home/httpd/qpkg_name
For debugging – unitary tests
◦
Enable your CGI to be run from a shell command line

PHP code
◦
◦
Bash command as guest
$ret = exec(‘<bash command>’, $output);
Bash command as admin
$ret = exec(‘/usr/bin/wget "http://127.0.0.1:8080/<cgi_file>’, $output);
Please see code examples to log the command output for debugging

Basic restricted access control can be implemented
◦ By using .htaccess file
◦ And user from the /mnt/HDA_ROOT/.config/shadow file
 Example:
AuthName “This Access is Restricted"
AuthType Basic
AuthUserFile /mnt/HDA_ROOT/.config/shadow
AuthGroupFile /dev/null
<limit GET POST>
require user admin
</Limit>

Protect the user’s data
◦ Configuration folders must be restricted access
 Eg .htaccess with deny all
◦ Sensitive data must be gathered and stored in a protected folder
◦ Protect user’s data against typing errors (confirm deletion/modifications,
enable rollback transactions, confirm password change, etc.)
◦ Use poke-yoke to limit user errors or check user entry consistency
 All default answers are Yes but one which is inverted must be set to No
 Do not display the ‘Continue’ button unless all fields are fill-in
◦ Implement backup/restore procedures for databases and sensitive data
(.bak files, archive)

MySQL database system is available on QNAP NAS
◦ Recommanded by QNAP

PostgreSQL database system is available through a QPKG

SQLite is not available but through the IPKG modules

Translated strings must be able to support :
◦ HTML tags to improve the presentation
◦ Foreign characters, Quotes

There are mainly two implementations today
◦ Use of arrays (plugmedia)

Loaded as any PHP variable
$lang = array(
'TRIER_PAR' =>'Trier par',
'ORDRE_TRIS' =>'Ordre de tris‘);
◦ Use of constants (XDove, q-ext, Q-Sims)



Need to process the language text file (parser)
Strings are gathered into sections (e.g. by pages, common, buttons, etc.)

[common]
charset
date_format
= iso-8859-15
= d F Y H:i:s
Translation files for the web interface and help
◦ Are 2 different files
◦ Translation of the apps interface may be used with default English help pages
◦ Do not rely on the LOCALE – NAS are seldom set to correct regionalization

# locale –a
C
en_US.utf8
POSIX
◦ Q-Ext QPKG can install locales if needed but uis still Beta and for Tech. guys

Ipkg - Itsy Package Management System,
◦
◦

is a lightweight package management system designed for embedded devices that tries to resemble Debian's dpkg.
is used in the Unslung operating system for the Linksys NSLU2 (Optware), in OpenWRT, Openmoko, WebOS, Gumstix,
the iPAQ, QNAP NASes, Synology NASes and elsewhere.
In normal operation
◦
IPKG modules are downloaded from the Internet
◦
IPKG modules are NAS model dependant (libs installation)


BUT we might prefer sometimes to install from a local folder



◦
◦
x86 :
arm-x19:
arm-x09:
http://ipkg.nslu2-linux.org/feeds/optware/ts509/cross/unstable/
http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/
http://ipkg.nslu2-linux.org/feeds/optware/cs05q1armel/cross/stable/
Install the ipkg modules in the “correct” order to respect module’s dependencies

◦
to speedup the installation,
to avoid the need for an Internet connection
to secure the ipkg modules installation (bad Internet connection)
Download and place the ipkg modules into an ipkg folder under your QPKG tree folder



If you have not installed an ipkg module (a) when the ipkg module (b) is being installed and required the module (a), a download
will be performed.
Installation from a local file:


Ex. # ipkg install coreutils
Ex. # ipkg install coreutils_8.4-1_arm.ipk
Folder structure to use with IPKG pre-installation
◦
◦
◦
Store IPKG modules for each model under /apps/qpkg_name/src-xxx/ipkg folders
The IPKG module pre-installation is handled in the qinstall_xxx.sh script
An example of such implementation is availabe into the PosgreSQL QPKG
Create a QPKG
Your GUI
3rd party code
Web interface
required ?
Y
System lib
required ?
Y
DDL the application code
In the QPKG tree folder
Code compilation
required ?
Y
Write a PHP interface
to link to
/share/Qweb/qpkg_name
IPKG module
available ?
Y
Debian lib
available ?
Y
Cross-compile source
DDL QNAP toolchain
Write languages
and help files
Add libs in qinstall_xxx.sh
Ipkg install <lib>
DDL, extract and store libs
Install libs in pre-install
qinstall_xxx.sh
Store the binaries
Install libs in pre-install
qinstall_xxx.sh
Data to save
before upgrade ?
Y
Your Scripts
QNAP NAS
End user
Wiite removal code
in .uninstall.sh
Add permissions &
Symbolic links
in qinstall_xxx.sh
Add pre-install & postinstall code
in qinstall_xxx.sh
Is the code for all
NAS type ?
Y
Create other
qinstall_xxx.sh
Check configuration
file qpkg.cfg
Your Tests
Support &
Maintenance
Start beta testing with
the QNAP community
+ QNAP validation
Unitary & integration
tests, validation
and Alpha testing
Add pre-update & postupdate code
in qinstall_xxx.sh
Build QPKG
./build <nas_type>

Toolchains
◦
X09





◦
X19






◦
For x09 series (TS-109 TS-209 TS-409 TS-409U)
Linux: 2.6.12.6-arm1
Marvell: Orion
arm-none-linux-gnueabi
NOTE : chrooted
For x10 series (TS-110 TS-210 TS-410)
For x19 series (TS-119 TS-219 TS-219P TS-419P TS-419U)
Linux: 2.6.30.6
Marvell: Kirkwood
arm-none-linux-gnueabi
NOTE : ARMEL (endian little)
X86





For x39 series (TS-239 TS-259 TS-439 TS-459 TS-639 TS-659 TS-809 TS-809U TS-859 SS-439 SS-839)
For one x09 model (TS-509 )
Linux: 2.6.24
Intel: Atom
Compatible Debian / Ubuntu

Some QPKGs (you must be registered to access the QPKG on the forum)
◦
◦
◦

QPKGs with QSA (configuration wizard)
◦
◦

Q-Ext, NZBGet, Q-Sims
QPKG that have required to compile source code
◦

JRE, Tomcat, Mono, FreeSwitch
SSOTS
QPKG with admin commands from PHP interface
◦

PlugMedi@, AjaXplorer
QPKG that installs binaries
◦
◦

Joomla, phpMyAdmin, AjaXplorer, XDove, PlugMedi@, PostgreSQL, MediaWiki, eyeOS
Tomcat,
QPKG with Ajax
◦

XDove
Q-Sims
QPKG that installs PHP web interface
◦
◦

Forum: http://forum.qnap.com/viewforum.php?f=121
Asterisk:
XDove:
Mono, FreeSwitch
QPKG that use IPKG pre-installation process
◦
PosgreSQL, PlugMedi@ v2

WARNING: QPKGs may have been developed with a different QPKG template and therefore
may slightly differ in their folder structure and/or script functions organization
SUMMARY
Foreword
Guidelines for the QNAP QPKG system v1
Overview
Development recommendations
Exercise #1 : Asterisk QPKG – IPBX
Exercise #2 : XDove – All-in-one Mail Service IPBX

Asterisk is a software implementation of a telephone private branch
exchange (IPBX)

Asterisk can be installed through the IPKG module

Asterisk QPKG was created to:
◦ Ease the installation using the NAS web interface instead of a SSH console (Putty)
◦ Enable/Disable the Asterisk application
◦ Made available a link to the Asterisk web GUI

Few files to modify from the QPKG template (use of an old template):
/asterisk :
build.sh:
script to create the Asterisk QPKG
qinstall-all.sh:
script to install or upgrade the QPKG
.uninstall.sh:
script to remove the QPKG
/src-all:
asterisk.sh;
script to Enable/Disable the Asterisk application
◦ Forum:
http://forum.qnap.com/viewforum.php?f=165
◦ Wiki:
http://wiki.qnap.com/wiki/Asterisk
Create variable to access the Asterisk
web GUI and the configuration file
Install Asterisk application
using the ipkg modules
Configure the Asterisk
application
QPKG interface
on the NAS web GUI
8 avril 2015
Pa
ge
40
URL to
Asterisk web GUI
asterisk.sh
.uninstall.sh
URL to
Asterisk web GUI
First log
User A/C: admin/password
and change yourpasword
Asterisk QPKG documentation is available
at http://wiki.qnap.com/wiki/Asterisk
SUMMARY
Foreword
Guidelines for the QNAP QPKG system v1
Overview
Development recommendations
Exercise #1 : Asterisk QPKG – IPBX
Exercise #2 : XDove – All-in-one Mail Service

XMail is an Internet and Intranet mail server featuring:
◦ a (E)SMTP server – XMail and phpXmail for the web interface
◦ a POP3 server – Xmail
◦ A IMAP server - Dovecot
◦ 2x webmails applications
 RoundCube : IMAP only
 T-dah webmail (UebiMiau) : POP3/IMAP and Chat (between
registered users)
◦ A scheduled mail backup and restore functions
◦ A shared calendar (webcalendar) between users (registered user on
IMAP server)
◦ A QSA – Quick Start Assistant
◦ Support 5 languages (English, French, German, Italian, Chinese Trad
& Simp.)
 Forum:
http://forum.qnap.com/viewforum.php?f=143
 Wiki:
http://wiki.qnap.com/wiki/XDove_Configuration


Release for 2009 Chinese New year
First QPKG with a QSA (6 pages Web installer)
◦
◦
◦
◦
◦
◦
123456-
Router configuration reminder
XMail server and phpXmail configuration
Domain and Postmaster account
XMail SMTP server configuration
User mailboxes creation
Webmail configuration
We hope you enjoy as much as we do.
Question ? Advice ?
You may use the QNAP forum to get
support and interact with thousands
of users from around the world
Download