Lianja Package Manager

From Lianjapedia
Jump to: navigation, search

See Also

COMPARE DATABASE, Deployment, Lianja Cloud Admin Console App

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.

Bm-noteicon.png

From v9, Build Project Package is available from the Develop quick links button in the ModeBar:
- opens the Apps in the current project
- runs a Preview live in browser to generate the HTML files
- creates a package for upload to a Lianja Cloud Server for automatic installation
- or via the Lianja Cloud Admin Console App
- See Upload and Install Apps using the Lianja Admin Console for steps and screenshots.

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.

Develop

Click the Develop button in the Modebar to access a range of handy links including the following for packages:

  • Build Project Package (from v9): opens all the Apps in the current Project, runs a Preview live in browser to generate the HTML files for web and mobile Apps and creates a package that can be uploaded to a Lianja Cloud Server for automatic installation.
  • Quick Project Package: creates a package file from the currently open Project
  • Quick Package: creates a package file from the currently open App
  • Install Package: installs an existing package file
  • List Package: lists the contents of an existing package file

Note: prior to Lianja v8, Develop was named Shortcuts and included the Quick Project Package and Quick Package links.

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.
  • Click the Build button in the Package details panel to just build the package.
  • Click the Deploy button in the Deployment configuration panel to build the package and deploy it to the specified server.
Deployment Target Packages


Repositories

After building a package, you can share it with other Team members by uploading it to the Team repository so it will appear in the Team workspace or share it with end users/customers by uploading it to the Release repository so it will appear in the App Center.

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.

Packages uploaded to a Team or Release repository can be downloaded and installed in the Team workspace or App Center (release).

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.

Install Lianja Package


Bm-noteicon.png
Tip

From v8, Install Package and List Package are available from the Develop quick links button in the ModeBar

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. Make sure DB_WWWAUTOUPDATE is enabled on the remote server.
  4. Build and deploy the .lpk file to the packages directory of the remote Lianja Cloud Server.
  5. After deployment, the package will be installed automatically and your system updated.

Note: prior to v6.0.2 the package was installed when accessing the Lianja Cloud Server login page from the browser.

Bm-noteicon.png
Lianja Cloud Admin Console

Administrators can use the Packages tab in the Lianja Cloud Admin Console App running on the Lianja Cloud Server to upload, install or delete package files.

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

List
  • List the contents of a Lianja package file
lianja-lpk list <.lpk filename>
Build
  • Create a Lianja package file

Use special prefixes such as 'app:/' and 'lib:/' for the files. Separate filelist files with ; on Windows and + on Linux/macOS.

lianja-lpk build <.lpk filename> file | filelist
Add
  • Add files to an existing Lianja package file

Use special prefixes such as 'app:/' and 'lib:/' for the files. Separate filelist files with ; on Windows and + on Linux/macOS.

lianja-lpk add <.lpk filename> file | filelist
Refresh
  • Refresh a Lianja package file with any updated files
lianja-lpk refresh <.lpk filename>
Install
  • Extract and install a Lianja package file
lianja-lpk install <.lpk filename> [<lOverwrite>]

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

Update
  • Extract and install a Lianja package file
lianja-lpk update <.lpk filename> [<lOverwrite>]

If <lOverwrite> is false or .F., then existing App files will not be overwritten, otherwise they will be overwritten.

Deploy
  • Deploy a Lianja package file to a Lianja Cloud Server.
lianja-lpk deploy <.lpk filename> <url[:8001]>,<apikey>[,<uid>,<pwd>]

Deploy to the Lianja Cloud Server at the specified <url>. This can be directly to the Lianja Cloud Server by specifying the port  :8001 on the http URL, or via IIS on Windows or Apache on Linux (http or https).

The optional <uid> and <pwd> are the username and password for a valid user on the server with admin permissions.

The <uid> and <pwd> can be omitted:

  1. If the 'admin' user on the server has the default 'admin' password, these will be used. Note: for security reasons, the password for the 'admin' user should be changed from the default on deployed systems.
  2. If the following environment variables are set on the deploying system and contain respectively the username and password for a valid user on the server with admin permissions, these will be used.
  • LIANJA_LPKUID
  • LIANJA_LPKPWD
Examples
  • Windows
lianja-lpk list c:\lianja\packages\doc_alias-1.0.lpk
lianja-lpk build webapp1-1.0.lpk app:/example_webapp1
lianja-lpk build webapp123-1.0.lpk ^
app:/example_webapp1;app:/example_webapp2;app:/example_webapp3;lib:/helloworld.prg
lianja-lpk add webapp1-1.0.lpk ^
app:/example_webapp1;app:/example_webapp2;app:/example_webapp3;lib:/helloworld.prg
lianja-lpk refresh c:\lianja\packages\doc_alias-1.0.lpk
lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk
lianja-lpk install c:\lianja\packages\doc_alias-1.0.lpk false
lianja-lpk update c:\lianja\packages\doc_alias-1.0.lpk
lianja-lpk update c:\lianja\packages\doc_alias-1.0.lpk false
lianja-lpk deploy doc_alias-1.0.lpk ^
http://win2012.lianja.local:8001,7c52c139-b88d-4756-8695-93a76264e53f
lianja-lpk deploy doc_alias-1.0.lpk ^
http://win2012.lianja.local,7c52c139-b88d-4756-8695-93a76264e53f,admin,1$%p4ss
lianja-lpk deploy doc_alias-1.0.lpk ^
http://win2012.lianja.local,7c52c139-b88d-4756-8695-93a76264e53f,super1,2$%p4ss
set LIANJA_LPKUID=super1
set LIANJA_LPKPWD=2$%p4ss
lianja-lpk deploy doc_alias-1.0.lpk ^
http://win2012.lianja.local,7c52c139-b88d-4756-8695-93a76264e53f
  • Linux
lianja-lpk list doc_alias-1.0.lpk
lianja-lpk build webapp1-1.0.lpk app:/example_webapp1
lianja-lpk build webapp123-1.0.lpk \
app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg
lianja-lpk add webapp1-1.0.lpk \
app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg
lianja-lpk refresh doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk false
lianja-lpk update doc_alias-1.0.lpk
lianja-lpk update doc_alias-1.0.lpk false
lianja-lpk deploy doc_alias-1.0.lpk \
http://ubuntu20.lianja.local:8001,7c52c139-b88d-4756-8695-93a76264e53f
lianja-lpk deploy doc_alias-1.0.lpk \
http://ubuntu20.lianja.local,7c52c139-b88d-4756-8695-93a76264e53f,admin,1$%p4ss
lianja-lpk deploy doc_alias-1.0.lpk \
http://ubuntu20.lianja.local,7c52c139-b88d-4756-8695-93a76264e53f,super1,2$%p4ss
LIANJA_LPKUID=super1; export LIANJA_LPKUID
LIANJA_LPKPWD=2$%p4ss; export LIANJA_LPKPWD
lianja-lpk deploy doc_alias-1.0.lpk \
http://ubuntu20.lianja.local,7c52c139-b88d-4756-8695-93a76264e53f
  • macOS
lianja-lpk list doc_alias-1.0.lpk
lianja-lpk build webapp1-1.0.lpk app:/example_webapp1
lianja-lpk build webapp123-1.0.lpk \
app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg
lianja-lpk add webapp1-1.0.lpk \
app:/example_webapp1+app:/example_webapp2+app:/example_webapp3+lib:/helloworld.prg
lianja-lpk refresh doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk
lianja-lpk install doc_alias-1.0.lpk false
lianja-lpk update doc_alias-1.0.lpk
lianja-lpk update doc_alias-1.0.lpk false

Repositories

Team: Team Workspace

Application packages can be downloaded from the Team Repository in the Team workspace. A tile will be displayed for each package available in the Team repository for the current Team repository username account. Depending on whether the package has already been installed or not, the tile allows the App to be opened or the package downloaded.

App Builder Team Repository


Release: App Center

End users can download packaged Lianja applications from the Repository panel in the Lianja App Center. If an App has already been downloaded, the displayed tile allows the App to be opened or notifies of an available update.

App Center Applications Repository