QNAP QPKG Lecture Topic: Create your QPKG

Slides:



Advertisements
Similar presentations
Web Hosting. The purpose of this Startup Guide is to familiarize you with Own Web Now's Web Hosting. Own Web Now offers two web hosting platforms, one.
Advertisements

PC Encryption installation progress/password screen Includes comments from: Encryption team Sarah Deane Tony Stieber Selected people who took part in the.
July 2010 D2.1 Upgrading strategy Javier Soto Catalog Release 3. Communities.
DNR-322L & DNR-326.
15.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 15: Configuring a Windows.
Installation and Deployment in Microsoft Dynamics CRM 4.0
Calendar Browser is a groupware used for booking all kinds of resources within an organization. Calendar Browser is installed on a file server and in a.
Objectives Moodle is an online learning environment where instructors & their students interact. In this workshop you will learn: 1.Configure system requirements.
Chapter Apache Installation in Linux- Mandrake. Acknowledgment The following information has been obtained directly from
1 of 6 This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation.
How Clients and Servers Work Together. Objectives Learn about the interaction of clients and servers Explore the features and functions of Web servers.
Module 6 Windows 2000 Professional 6.1 Installation 6.2 Administration/User Interface 6.3 User Accounts 6.4 Managing the File System 6.5 Services.
MCDST : Supporting Users and Troubleshooting a Microsoft Windows XP Operating System Chapter 5: User Environment and Multiple Languages.
SETUP AND CONFIGURATIONS WEBLOGIC SERVER. 1.Weblogic Installation 2.Creating domain through configuration wizard 3.Creating domain using existing template.
NETOP ONDEMAND What’s new in version 2.1? DECEMBER 09 NETOP ONDEMAND1.
12-Aug-15VL Download Center1 Volume Licensing Download Center Electronic Software Fulfillment for Volume License Customers Go Live: November 13, 2006.
Slide 1 of 9 Presenting 24x7 Scheduler The art of computer automation Press PageDown key or click to advance.
1 Chapter Overview Creating User and Computer Objects Maintaining User Accounts Creating User Profiles.
Amazon EC2 Quick Start adapted from EC2_GetStarted.html.
SEEM4570: XAMPP, Eclipse, Summary of Html Kangfei Zhao Room 711,ERB
Automation using Selenium Authored & Presented by : Chinmay Sathe & Amit Prabhu Cybage Software Pvt. Ltd.
Linux Operations and Administration
By Jeerarat Boonyanit. As you can see I have chosen Cpanel for my server management tool. cPanel is a Linux based web hosting control panel that provides.
Hosted Exchange The purpose of this Startup Guide is to familiarize you with ExchangeDefender's Exchange and SharePoint Hosting. ExchangeDefender.
Ch 11 Managing System Reliability and Availability 1.
Portal and AQAS-Philadelphia University 21-22/6/2011 AVCI Platform in PU Dr. Abdel-Rahman Al-Qawasmi Philadelphia University Director of Computer Center.
Linux Operations and Administration
WebFOCUS Developer Studio Update Dimitris Poulos Technical Director September 3, 2015 Copyright 2009, Information Builders. Slide 1.
Configuring the MagicInfo Pro Display
© 2008, Renesas Technology America, Inc., All Rights Reserved 1 Introduction Purpose  This training course provides an overview of the installation and.
Tutorial 11 Installing, Updating, and Configuring Software
Copyright© 2003 Avaya Inc. All rights reserved PUBVT Loading and Implementation instructions for the Pre-upgrade, Backup Verification Tool.
© 2011 Delmar, Cengage Learning Chapter 7 Managing a Web Server and Files.
Special Project Group 03 Chintan Shah Nisharg Patel Cynthia York.
1 Chapter Overview Configuring and Troubleshooting the Display Configuring Power Management Configuring Operating System Settings Configuring and Troubleshooting.
Database-Driven Web Sites, Second Edition1 Chapter 5 WEB SERVERS.
INSTALLATION HANDS-ON. Page 2 About the Hands-On This hands-on section is structured in a way, that it allows you to work independently, but still giving.
Chapter 13 Users, Groups Profiles and Policies. Learning Objectives Understand Windows XP Professional user accounts Understand the different types of.
MCTS Guide to Microsoft Windows Server 2008 Applications Infrastructure Configuration (Exam # ) Chapter Four Windows Server 2008 Remote Desktop Services,
Training Guide for Inzalo SOP Users. This guide has been prepared to demonstrate the use of the Inzalo Intranet based SOP applications. The scope of this.
Avira Endpoint Security. Introduction of Avira Management Center (AMC)
1 Session 1: Introduction to PHP & MySQL iNET Academy Open Source Web Development.
Www2.computer.org Web Publishing Training Leo Wadsworth, Staff Manager April 2008.
Apache, MySQL and PHP Installation and Configuration Chapter 2 MySQL Installation and Configuration.
© 2006 Cisco Systems, Inc. All rights reserved.Cisco PublicITE I Chapter 6 1 Router Initialization steps.
TOPIC 7.0 LINUX SERVICES AND CONFIGURATION. ROOT USER Root user is called “super user” because it has power far beyond those of mortal user. As root,
VMWare Workstation Installation. Starting Vmware Workstation Go to the start menu and start the VMware Workstation program. *Note: The following instructions.
Linux Operations and Administration Chapter Twelve Configuring a Mail Server.
Intro to APACHE, MySQL, and PHP & freely available (hackable) Packages Aonghus Sugrue 04 Oct 2012.
A leap ahead... Darren Kearney Don Miller Ilya Pinchuk.
LINUXCHIX WEBMAIL. Software run by an ISP or online service that provides access to send, receive, and review using only your Web browser. Users.
Your current Moodle 1.9 Minimum Requirements Ability to do a TEST RUN! Upgrading Moodle to Version 2 By Ramzan Jabbar Doncaster College for the Deaf By.
1 © 2004 Cisco Systems, Inc. All rights reserved. Session Number Presentation_ID Cisco Technical Support Seminar Using the Cisco Technical Support Website.
CACI Proprietary Information | Date 1 PD² SR13 Client Upgrade Name: Semarria Rosemond Title: Systems Analyst, Lead Date: December 8, 2011.
CACI Proprietary Information | Date 1 PD² v4.2 Increment 2 SR13 and FPDS Engine v3.5 Database Upgrade Name: Semarria Rosemond Title: Systems Analyst, Lead.
Windows Vista Configuration MCTS : Internet Explorer 7.0.
Tutorial 1 Getting Started with Adobe Dreamweaver CS5.
Upgrading PD² Archiving Utility Name: Semarria Rosemond Title: Systems Analyst, Lead Date: December 8, 2011.
Windows Server 2003 { First Steps and Administration} Benedikt Riedel MCSE + Messaging
How to use Drupal Awdhesh Kumar (Team Leader) Presentation Topic.
COM621: Advanced Interactive Web Development Lecture 10 PHP and MySQL.
11 DEPLOYING AN UPDATE MANAGEMENT INFRASTRUCTURE Chapter 6.
CACI Proprietary Information | Date 1 Upgrading to webMethods Product Suite Name: Semarria Rosemond Title: Systems Analyst, Lead Date: December 8,
ICAICT201A USE COMPUTER OPERATING SYSTEM. USING THE CONTROL PANEL The Control Panel contains many options for configuring your computer, including: adding.
CONTENT MANAGEMENT SYSTEM CSIR-NISCAIR, New Delhi
GLAST Release Manager Automated code compilation via the Release Manager Navid Golpayegani, GSFC/SSAI Overview The Release Manager is a program responsible.
INSTALLING AND SETTING UP APACHE2 IN A LINUX ENVIRONMENT
Title: Tech Training Certificate: Ace of Initiative Program
Managing a Web Server and Files
How to install and manage exchange server 2010 OP Saklani.
Presentation transcript:

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 First 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 20 avril 2017

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) 20 avril 2017

Foreword cont’d QNAP QPKG QPKG available today 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

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 QPKG 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 1 2 3 4

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

GUIDELINES For QNAP QPKG system v1 development QPKG development GUIDELINES For QNAP QPKG system v1 development

Overview SUMMARY Foreword Guidelines for the QNAP QPKG system v1 Development recommendations Exercise #1 : Asterisk QPKG – IPBX Exercise #2 : XDove – All-in-one Mail Service

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

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 Packaging an application from a source code exists (eg FreeSwitch). The QPKG provides: A folder with your compiled binaries 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

Building a QPKG + + X 1 1 4 2 3 3 4 5 2 5 Creating a QPKG archive 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 under /apps/qpkg_name folder 3 X qinstall.sh qinstall_x09.sh qinstall_x19.sh qinstall_x86.sh qinstall_all.sh npkg_name.tar.tgz 3 4 Installation scripts 5 + QPKG 2 QPKG files PHP, binaries, images, Scripts, css, JS, etc. 5 under /apps/build folder

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) /src-x86 folder Every files required by Intel platforms (TS-509/809/239/439/639...x59) /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

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) |---- hello_qnap # QPKG main app binary (for arm-x19 series NAS) |---- src-x86 # QPKG app folder (for x86 series NAS) |---- hello_qnap # QPKG main app binary (for x86 series NAS) /build # Destination build folder /scripts # Stores QPKG build scripts |---- built-in.sh # QPKG build scripts |---- qpkg_build_QNAP.sh # QPKG build scripts

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)

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

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

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

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

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

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

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.

.uninstall.sh & qpkg_name.sh/.conf Scripts – 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

.uninstall.sh & qpkg_name.sh/.conf Scripts –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

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-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

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

PHP Interface Guidelines cont’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

PHP Interface User 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 20 avril 2017

PHP Interface Execute 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

PHP interface Access 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)

PHP interface SQL 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

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-15 date_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 –a C en_US.utf8 POSIX Q-Ext QPKG can install locales if needed but uis still Beta and for Tech. guys

IPKG module installation How 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

QPKG Dev Sum-up Create a QPKG Your GUI 3rd party code Your Scripts 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 Is the code for all NAS type ? Y Create other qinstall_xxx.sh Check configuration file qpkg.cfg Build QPKG ./build <nas_type> QNAP NAS End user Your Tests Start beta testing with the QNAP community + QNAP validation Unitary & integration tests, validation and Alpha testing Support & Maintenance

Compilation Tools Toolchains X09 X19 X86 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 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

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

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

#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

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

Installation QPKG interface on the NAS web GUI 20 avril 2017

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

Asterisk web GUI Asterisk QPKG documentation is available 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

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

#2 XDove QPKG

#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

#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

Thanks Everybody Question ? Advice ? 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