Difference between revisions of "Lianja Package Manager"

From Lianjapedia
Jump to: navigation, search
(lianja-lpk)
(lianja-lpk)
Line 138: Line 138:
  
 
====lianja-lpk====
 
====lianja-lpk====
<pre>lianja-lpk list | install | build | refresh<.lpk filename> [<lOverwrite>] [buildlist.txt] </pre>
+
<pre>lianja-lpk list | install | build | refresh <.lpk filename> [<lOverwrite>] [buildlist.txt] </pre>
 
The '''lianja-lpk''' command can be used to list the contents of the specified package file or to install it.
 
The '''lianja-lpk''' command can be used to list the contents of the specified package file or to install it.
  

Revision as of 06:10, 6 March 2021

See Also

COMPARE DATABASE, Deployment

Overview

Lianja Package Files (.lpk) are used to package up Apps, databases and Library files to transfer to another Lianja App Builder installation.

They can also be installed/updated automatically by the Lianja Cloud Server.

How to create a package file

Packages can be created in the Deploy workspace.

  • Select the data, Apps and Library files as you would to deploy them. If your files have been added to a Lianja Project, just tick the checkbox next to the Project name, and all its files will be selected.
  • Click the Build package button in the headerbar and enter the name for your package. There is no need to include the .lpk file extension.
Build Lianja Package


Your package will be created in the packages directory.

OS Location
Windows C:\lianja\packages
Linux /opt/lianja/packages
macOS /Users/Shared/Lianja/packages

Quick Package

From Lianja v5.0 you can also create a 'Quick Package' from the Pages or Apps workspace.

This creates a package of the currently open App and saves it with the App name and version with a '.lpk' extension in the packages directory (as above).

Build Quick Lianja Package


To include database(s), Library files or multiple Apps in a single package, use the Deploy workspace instructions above.

From Lianja v5.3 the Shortcuts menu in the ModeBar includes options for Quick Project Package... and Quick Package... to allow the creation of a package file from the currently open Project or App. If the App or Project uses a database (other than the distribution southwind database), you will be prompted whether your database(s) should be included in the package.

Deployment Target Packages

From Lianja v6.0 the Deploy workspace has been enhanced to allow package files to be built for a specified deployment target.

  • In the Deployment configuration panel, click New to create a target or Edit to modify an existing one.
  • In the Package details panel, click Add Files to add the files selected in the Deployment files tree, or type the names under Files to deploy.
  • Prefixing a filename with '!' excludes that file from the package. Wildcard characters can also be used.
Deployment Target Packages


After building your package, you can share it with other Team members by uploading it to the Team repository. It will then appear in the Team workspace.

Publish to Team or Release Repository


See Team Development and Release Management for more details.

How to install a package file

Lianja packages can be installed from the toolbar in the Lianja App Builder Apps workspace. They can also be installed using the LPK() function or automatically by the Lianja Cloud Server.

From Lianja v6.0, they can also be installed from the OS command line on systems with the Lianja App Builder installed.

Apps Workspace

To install a package:

  • Click the Install package button in the headerbar.
  • Select the package to install.

The installation progress will be displayed in the Console workspace and you will be prompted to confirm if a file will be overwritten.

Build Lianja Package


LPK() Function

The LPK() function can be used to install or list the contents of .lpk Lianja Package Files. See LPK() for full details.

Lianja Cloud Server

The Lianja Cloud Server can automatically install or update any new packages it detects in its packages directory.

OS Location
Windows C:\lianja\cloudserver\tenants\public\wwwroot\packages
Linux /opt/lianja/cloudserver/tenants/public/wwwroot/packages
macOS /Users/Shared/Lianja/cloudserver/tenants/public/wwwroot/packages

The Lianja Cloud Server will disable user access while an upgrade is to be performed and then re-enable user access after the upgrade is complete. This is handled using LOCKRESOURCE().

If the package contains scripts called setup.prg (compiled to setup.dbo) and/or upgrade.prg (compiled to upgrade.dbo), then these are run after all the files are extracted and moved into place. This provides the ability to install on live systems and then set file permissions etc. and/or check for database schema changes. Note that from Lianja v5.0, the COMPARE DATABASE command can be used to compare two databases and automatically generate the upgrade.prg script to perform any required database schema upgrades.

The installation and update of packages creates (if it does not exist) a file packagename-install.log in the packages directory. This is a text file that contains a full history of initial installation and all updates applied. To perform an update of an existing package all you need to do is build the .lpk and upload to the packages directory.

The steps for live updating are:

  1. Write optional setup.prg and upgrade.prg scripts.
  2. Compile them using the button in the Script Editor or the COMPILE command.
  3. Package up your App including these scripts, any required library files (use of lib:/thirdpartylibs is recommended) and any required database if it is a new App.
  4. Transfer the .lpk file to the packages directory of the remote Lianja Cloud Server.
  5. Make sure DB_WWWAUTOUPDATE is enabled on the remote server.
  6. Access your app in the browser by logging in: the package will be installed automatically and your system updated.

OS Command Line

From Lianja v6.0, packages can also installed from the OS command line using the lianja or lianja-lpk commands.

These commands are available when the Lianja App Builder is installed.

lianja

lianja <.lpk filename>

Passing the name of a package file to the lianja command allows the package to be installed and opened in the Lianja App Builder.

It assumes that an App with the same name as the package is included in the package.

If it has already been installed and the version is the same then the App will be opened without being updated.

  • Windows
c:\lianja\bin>start /wait lianja c:\lianja\packages\doc_alias-1.0.lpk
  • Linux
$ lianja doc_alias-1.0.lpk
  • macOS
$ lianja doc_alias-1.0.lpk

The files from the package are listed in the terminal/command window as they are installed (Windows only).

If the package version of the App is already installed, a 'Package is already installed' message is displayed in the window.

The App is then opened in the Lianja App Builder.

lianja-lpk

lianja-lpk list | install | build | refresh <.lpk filename> [<lOverwrite>] [buildlist.txt] 

The lianja-lpk command can be used to list the contents of the specified package file or to install it.

By default the package file will be installed whether the App is already installed or not. If <lOverwrite> is false or .F., then an existing App will not be overwritten.

  • Windows
c:\lianja\bin>lianja-lpk list c:\lianja\packages\doc_alias-1.0.lpk
c:\lianja\bin>lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk
c:\lianja\bin>lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk false
  • Linux
$ lianja-lpk list doc_alias-1.0.lpk
$ lianja-lpk install doc_alias-1.0.lpk
$ lianja-lpk install doc_alias-1.0.lpk false
  • macOS
$ lianja-lpk list doc_alias-1.0.lpk
$ lianja-lpk install doc_alias-1.0.lpk
$ lianja-lpk install doc_alias-1.0.lpk false