====== Introduction ====== This Howto will describe how to create packages with the Package Builder Packages are zip files that contains a PHP application, with or without a database ( MySQL / PostgreSQL ) or a web site design. Once built the package can be made available to others for download or you can publish it on a package repository for a 1 click installation. ====== Requirements ====== To create packages you will need a working installation of [[Radria]] You will need the following packages: * Content Administration (contentadmin) * Package Builder (package_builder) ===== Radria ===== Once setup click on the **Site Manager** and create a new project or open the project where you have the application or web site design you want to package. In the Package manager install the **Content Administration** and **Package Builder** package. ===== DragDrop Sitecreator ===== Click on the **Options** tab, then select ** Software install / upgrade **. In the Package manager install the **Content Administration** and **Package Builder** package. ====== Package Builder ====== The package builder is a 5 step wizard in the Content Administration to create packages with no technical knowledge. Log into the Content Admin, the default username / password is admin / sqlfusion. In the left menu, select __Create Package__. ===== Name and Description ===== In the first step the wizard asks you the name of the package and its version. {{howto:package_info.png|}} * Package Name: Name of your package, we suggest the following guide lines - All lower cases - No spaces, ''_'' are ok - No special characters, only alpha numberical, a-z and 0-9 - Design * Package version: that number is incremented each time you create a new package. If you create a package for an existing software, you need to have 2 version numbers. The second version number is inserted in the package name and separated by a ''_''. The Package version needs to be with Package Name: phpxplorer_0.9.32 Package Version: 0.5 * Package Description: Anything you want to describe your package, what it does, what it contains, change logs. HTML tags are authorized. * Dependency Packages: Packages names separated with comas that are required before installing the package. The package name must include the version number. ===== Files ===== Select the files you want to add to your package. Check the check box on the left of each file you want to include in the package and click **Continue...** ===== Database Tables ===== Skip this step if you don't have a database setup on your project. Select the Tables you want to add in the Package. You may use __CTRL__ to select multiple tables. Decide if you want to include the data in your package. Then click **Continue**. ===== Commands ===== During the installation or transfer of a package you may need to install some configuration or setup files to enable an application run in the user project. This is just an overview; for more details on the commands see [[core:radria_application_package]]. You can run commands during 3 Events. - When the Package is installed - When its Uploaded / Synchronized over FTP - When its removed ==== Environment Variables ==== They are variables taken from the PHP $_ENV or $_SERVER or from the setup. You can use them when executing the commands, to setup configuration files or setup default accounts. === During Install and Remove === To make the commands useful the package manager provides access to environment variables: * **[absolute_http_path]**: Absolute web url to the project: ''http://www.yourdomain.com/webfusion/projectname/'' * **[relative_http_path]**: Web path the project directory: ''/webfusion/projectname/'' * **[absolute_file_path]**: Absolute path to the project: ''/home/sitecreator/projectname/'' files. * **[relative_file_path]**: Relative path to the project directory, ''../projectname'' * **[user_username]**: Username, use the database connection login or application username and default to "admin" if nothing is found. * **[user_password]**: Password, use the database connection password or application username and default to "sqlfusion" if nothing is found. * **[user_password_md5]**: ", md5($user_password), $command) ; * **[domain_name]**: Current Domain name * **[project_name]**: Name of the project * **[server]**: Hostname or IP of the database server * **[database_type]**: Type of database (mysql/pgsql/sqlite) * **[refererkey]**: Referrer key for remote access authorization. === During upload === During the upload process a probe is sent to the live server to detect some of the remote server information. All of the install variables are also available during the upload. * **[remote_absolute_file_path]**: Absolute PATH to the project on the remote server * **[remote_absolute_http_path]**: Absolute web url to the project on the remote server.(http://www.remotedomain.com/folder1/) * **[remote_relative_http_path]**: Relative web url to the project on the remote server. * **[remote_dir]**: Relative path to the project on the remote server * **[remote_php_self]**: PHP_SELF value from the remote server * **[remote_server_name]**: Remote server name (domain name) ==== Installation Commands ==== The installation commands are executed after the files are copied to the project folder. * replace * sqlquery * mkdir * removefile * copyfile * mergefile For all the commands all the files path are relative to the project directory. === replace === Will replace one string by another in a file. replace forums/config.php @databasehost [server] This example will replace the string ''@databasehost'' with the database server hostname in the forums/config.php file. === sqlquery === Run an sql query in the project database. sqlquery "UPDATE phpbb_config SET config_value = '[server_name]' WHERE config_name = 'server_name'" This example will set the server name in the phpbb_config table using an sql query. === mkdir === Creates a directory, the directory path is relative to the project directory. mkdir dokuwiki/data/cache mkdir dokuwiki/data/meta === removefile === Removes a file from the project removefile phpwiki/config.php.dist === copyfile === Creates a copy of an existing file copyfile phpwiki/config.php.dist phpwiki/config.php === mergefile === Merge 2 files into one, it concatenates the content of the first file and the second one into the third one. mergefile file1 file2 finalfile3 ==== Upload commands ==== When the web site or application is uploaded over FTP during the synchronization a set of commands can also be executed. * sqlquery * replace * setwritable The sqlquery and replace work the same way as the Install commands. === setwritable === This will set a chmod 0777 on the remote file, meaning that it makes it writable by everyone. setwriteable imagegallery/uploads ==== Upload files ==== From that package you can select which files should be uploaded when the project is uploaded to the production or testing server. You can enter generic keywords like **none** that will not upload any files or all that will upload **all** the files. If only a set of files is relevant in the production application list the relative path of each of those files. There is a special option in the FTP upload that will convert all the PHP files HTML files before uploading them. This is only for publishing basic web sites on web servers with no PHP capabilities. ==== Application Link ==== To make your application appear in the SiteManager list of Tools (on the left box) you need to provide a relative URL. Optionally you can provide a label for the link and a second link if the application has a back end configuration area on a different URL. If your application is a library or internal component you do not need to provide any URL. ==== Remove/Uninstall commands ==== Commands executed when the package is removed. For now there are none. FIXME ====== Additional information ====== If you want additional information on the packages you can check out the following articles: * [[the_packages]]: Overview of the Radria Packaging architecture * [[core:Radria Application Package]]: Detailed information on the commands * [[core:package|Package Format]]: Reference Documentation