1 / 47

QNAP QPKG Lecture Topic : Create your QPKG

QNAP QPKG Lecture Topic : Create your QPKG. 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. Tentative Agenda. Second Meeting.

rory
Download Presentation

QNAP QPKG Lecture Topic : Create your QPKG

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. QNAP QPKG LectureTopic: Create your QPKG 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

  2. Tentative Agenda 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): • Take XDove and package • Code reading • Workshop (30 mins): • - Get familiar with the folder structure of the sample-qpkg-hello_qnap template • Wrap-up (1 hour) • - Q&A about issues, points to clarify

  3. Foreword • 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. • Applications are hosted on the provider web servers • Applications are loaded on demand and disabled after use or contract expiration. • SaaS is pushed by: • 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)

  4. Foreword cont’d • 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

  5. QPKG QPKG overview-User Installation • To install a new application from a QPKG, the USER: • Use the RSS feed to download the QPKG from the QNAP servers • Shall upload the QPKG on the NAS thanks to the QPKG page of the NAS Administration web UI • Proceed with the installation by clicking the INSTALL button 1 2 3

  6. 4 1 2 3 QPKG Overview -Enable/Disable/Remove Application • QPKG Application management • Once installed, the Application may be started • Execute the script : ./qpkg_name.sh start • The Application may be stopped • Execute the script : ./qpkg_name.sh stop • The QPKG may be removed • Execute the script : ./.uninstall.sh • The user can access the Application web interface (if any) • The URL link is active once the QPKG is Enabled

  7. Developer Prerequisite • In order to develop QPKG applications, you will need to deal with: • Linux Bash scripts • For installation and administration tasks • PHP language • Web interface code writing • JQuery for Rich Interface Applications • Smarty* for web page skin management • TinyMCE* as user text editor • Linux cross-compilation understanding • Compile some application from source • CGI script understanding • To issue admin commands from the web interface • LOCALE and Internationalization understanding • To enable the QPKG to support several selectable languages • To enable the QPKG to support help pages in different languages • Wiki page writing • 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

  8. QPKG development GUIDELINES For QNAP QPKG system v1 development

  9. Overview 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

  10. Organizing the work • 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

  11. What to package • There are several levels of packaging: • Packaging applications as a PHP web applications (eg Joomla). 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 • Packaging applications already existing as IPKG modules (eg Asterisk). 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: • 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: • 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

  12. QPKG qinstall_x09.sh qinstall_x19.sh qinstall_x86.sh qinstall_all.sh Building a QPKG under /apps/scritps folder qpkg_build_QNAP.sh DO NOT MODIFY Built-in.sh DO NOT MODIFY Creating a QPKG archive • 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. Add the built-in.sh script to enable the QPKG archive self-extraction 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. START 1 build.sh DO NOT MODIFY Only configure + 1 4 qpkg_name-version.qpkg built-in.sh 2 3 qinstall.sh X under /apps/qpkg_name folder 3 npkg_name.tar.tgz 4 Installation scripts 5 + 2 QPKG files PHP, binaries, images, Scripts, css, JS, etc. 5 under /apps/build folder

  13. QPKG tree folder structure • 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) • The relevant qinstall_xxx.sh will be rename as qinstall.sh and embeded in the QPKG build • /src-all folder • All the files for a platform independent applications • /src-shared folder • Every files that are platform independent – eg PHP files for a web interface • Icons files • Start/Stop script and .uninstall.sh script • /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 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

  14. Hello example /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

  15. Internationalization • 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 ( 920 millions) • Chinese (1.12 milliard) • Hindi ( 740 millions) • French ( 600 millions) • Arabic ( 482 millions) • Spanish ( 380 millions)

  16. QPKG Debugging • Full testing requires the QPKG to be created • You may install the QPKG manually (see §3) • Application testing can be done “in situ” by duplication of the QPKG src-xxx folders • 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

  17. QPKG Debugging • 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

  18. QPKG Testing • Minimum testing to be performed on a QPKG for each NAS models (series) before Alpha release • 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, multi-users,…) • 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 • 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 • 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

  19. QPKG 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

  20. QPKG Installation • Standard QPKG installation procedure • Download the QPKG from the QNAP servers • Upload the QPKG on the NAS with the NAS Administration web UI • Install by clicking the INSTALL button • Manual QPKG installation procedure • Copy the QPKG on the NAS (eg /share/Public) • Auto-run the QPKG - ./qpkg_name_ver_model.qpkg • Once the installation has been launched, • The QPKG is copied into a temporary folder /mnt/HDA_ROOT/update_pkg/tmp • The QPKG is self-launched to: • 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

  21. qinstall.sh script • The qinstall.sh script has several functions to handle the different situations: • Utils Defines section • All bash commands used • System Defines section • Required by the QPKG system • QPKG Info section • Source the common variables defined in config.cfg • pre-install() – Add you code here • Routines to install or check for libs required by the QPKG application • install_routines() – Add you code here • Routines to execute during installation • The TAR file extraction is handled in the install() routine • post-install() – Add you code here • Routines to clean-up, remove temp file, etc … • pre-update() – Add you code here • If an update is detected (QPKG already installed) this routine shall receive the code to backup data for example. • update_routines() – Add you code here • Update the application files concerned by the upgrade procedure • 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

  22. qinstall.sh script (cont’d) • The qinstall.sh script structure – cont’d: • _exit() – DO NOT MODIFY • Exit the script and return a message in the NAS log • find_base() – DO NOT MODIFY • 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 • Creates the link to enable to start/stop the application from the QPKG administration interface and during the boot if enabled • register_qpkg() – DO NOT MODIFY • Register the QPKG into the QPKG database • check_existing_install() – DO NOT MODIFY • Detect which kind of installation to perform (install or upgrade) • copy_qpkg_icons() – DO NOT MODIFY • Move the QPKG icons to their final location • start_apache() – DO NOT MODIFY • Start the Apache server if not running – WARN: will not restart a run Apache server • create_req_symlinks() – Add you code here • Create the symbolic links needed by the appllication • set_req_permissions() – Add you code here • Set the permissions on files and folders • install() – DO NOT MODIFY UNLESS THERE IS A VERY GOOD REASON • 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.

  23. .uninstall.sh & qpkg_name.sh/.confScripts – Part I • 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

  24. .uninstall.sh & qpkg_name.sh/.confScripts –Part II • 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

  25. QPKG Icons • QPKG application icons • .qpkg_icon.gif Icon displayed on the QPKG admin GUI when QPKG is Enabled • .qpkg_icon_gray.gif Icon displayed on the QPKG admin GUI when QPKG is Disabled • .qpkg_icon_80.gif Icon displayed in the QPKG control dialog box • Icons are located into the apps/qpkg_name/src-sharedfolder • 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

  26. PHP Interface Guidelines • 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

  27. PHP Interface Guidelinescont’d • PHP web interface • Has DOCTYPE = DTD XHTML 1.0 Transitional • Needed with JQuery • DocType experts are welcomed to address this topic then use the same for all QPKG • Has CHARSET = UTF-8 • Is W3C compliant – please submit your pages for compliance • Has to support Internationalization for different languages • 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 • 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 • 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

  28. PHP InterfaceUser configuration screens • 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

  29. PHP InterfaceExecute cmds with admin privileges • 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: • wget start to check for IPV6 then fallback to IPV4 after timeout • Need to force IPV4 (use a variable to allow easy setup changes) • To do • Place you cgi files under the right folder: • 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

  30. PHP interfaceAccess control • 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)

  31. PHP interfaceSQL databases • 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

  32. Internationalization • 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 = iso-8859-15date_format = 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 –aCen_US.utf8POSIX • Q-Ext QPKG can install locales if needed but uis still Beta and for Tech. guys

  33. IPKG module installationHow to speed-up • 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 • Ex. # ipkg install coreutils • IPKG modules are NAS model dependant (libs installation) • BUT we might prefer sometimes to install from a local folder • 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 • x86 : http://ipkg.nslu2-linux.org/feeds/optware/ts509/cross/unstable/ • arm-x19: http://ipkg.nslu2-linux.org/feeds/optware/cs08q1armel/cross/unstable/ • arm-x09: http://ipkg.nslu2-linux.org/feeds/optware/cs05q1armel/cross/stable/ • Install the ipkg modules in the “correct” order to respect module’s dependencies • 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_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

  34. QPKG Dev Sum-up 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 Wiite removal code in .uninstall.sh Add permissions & Symbolic links in qinstall_xxx.sh Add pre-install & post- install code in qinstall_xxx.sh Add pre-update & post- update code in qinstall_xxx.sh Create other qinstall_xxx.sh Check configuration file qpkg.cfg Build QPKG ./build <nas_type> Is the code for all NAS type ?Y QNAP NAS End user Your Tests Start beta testing with the QNAP community + QNAP validation Unitary & integration tests, validation and Alpha testing Support & Maintenance

  35. Compilation Tools • Toolchains • X09 • 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 • X19 • 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

  36. QPKG Examples • Some QPKGs (you must be registered to access the QPKG on the forum) • Forum: http://forum.qnap.com/viewforum.php?f=121 • Asterisk: • XDove: • QPKGs with QSA (configuration wizard) • XDove • Q-Sims • QPKG that installs PHP web interface • Joomla, phpMyAdmin, AjaXplorer, XDove, PlugMedi@, PostgreSQL, MediaWiki, eyeOS • Tomcat, • QPKG with Ajax • PlugMedi@, AjaXplorer • QPKG that installs binaries • JRE, Tomcat, Mono, FreeSwitch • SSOTS • QPKG with admin commands from PHP interface • Q-Ext, NZBGet, Q-Sims • QPKG that have required to compile source code • 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

  37. Exercise #1 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

  38. #1 Asterisk QPKG • 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

  39. Modification in the qinstall_all.sh Create variable to access the Asterisk web GUI and the configuration file Install Asterisk application using the ipkg modules Configure the Asterisk application

  40. Installation QPKG interface on the NAS web GUI

  41. Asterisk QPKG control URL to Asterisk web GUI asterisk.sh .uninstall.sh

  42. Asterisk web GUI 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

  43. Exercise #2 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

  44. #2 XDove QPKG

  45. #2 XDove QPKG • 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

  46. #2 XDove QPKG • Release for 2009 Chinese New year • First QPKG with a QSA (6 pages Web installer) • 1- Router configuration reminder • 2- XMail server and phpXmail configuration • 3- Domain and Postmaster account • 4- XMail SMTP server configuration • 5- User mailboxes creation • 6- Webmail configuration

  47. We hope you enjoy as much as we do. Thanks Everybody Question ? Advice ? You may use the QNAP forum to get support and interact with thousands of users from around the world

More Related