Deploying GWA apps

This section describes how to build and deploy GWA apps with Genero.

Building GWA apps with Genero

Genero provides a command-line tool to create GWA.

Genero Web Applications are distributed as Genero archive (gwa) files, similar to standard Genero application. A GWA package can be deployed on a GAS to be served by a web server.

Genero provides the gwabuildtool command line tool to build GWA applications.

Before building the GWA application:
  1. The Genero BDL development environment (FGLDIR) must be installed to compile your program files.
  2. The GWA must be installed. For more details, go to Install Genero Web Application.
  3. Refer to the topics in the Overview section to quickly become familiar with the features of the GWA.

Program directory required for the build

To build a GWA application, you must prepare a directory, referred to as the programdir, containing the program files (.42m, .42f, and so on) and resource files (images, database files, web components) needed by the Genero Web application. This directory might have a structure similar to that described for mobile applications in Directory structure for GMA apps.

Specifying the GBC to be used

A GBC must be bundled with the GWA. The gwabuildtool selects the GBC at build time in the following order:
  1. The first option, is to use the GBC specified by the gwabuildtool --gbc gbc-directory build option.
  2. If the --gbc option is not specified, gwabuildtool will look for the FGLGBCDIR environment variable.
  3. Finally, it defaults to the FGLDIR/web_utilities/gbc/gbc directory if none of the previous options is set.

GBC is loaded in an iframe inside the GWA application, so the index.html of GWA does not equal the index.html of GBC.

Any customization of the GBC is expected to work. GWA requires that GBCDIR/index.html exists and GBCDIR/VERSION exists.

You can specify GBC query string options – "debugmode","contextmenu","mobileui", "theme" and so on – as you would with standard server applications. For example, to load the GWA application in debug mode, start your application with gwarun. The URL may be something like this:
http://localhost:9103/d/r/index.html?fglapp=main.42m&uuid=gwarun2024_12_11_18_00_31_769&viaMiniWS=1
Add &debugmode=1 at the end of the URL and reload the application. On reload, the GBC debug icons should be visible in the chromebar at the top. For more information about GBC query string options, refer to Query string parameters page in the Genero Browser Client User Guide.

Specifying environment with fglprofile

If you provide a fglprofile file in your program directory, it will be bundled with your application package. For details of setting environment for your GWA application, go to Setting environment with fglprofile.

The Web manifest file

Every GWA application must be created with a web application manifest file. The gwabuildtool creates a default manifest file that can be modified later. For more details, go to Web application manifest file.

Specifying the start-up module

By default, GWA will load the "main.42m" module as the main entry point (for example, programdir/app/main.42m). You can change this behavior in two ways:
  1. In the URL query string, you can specify fglapp=anothermodule. GWA will then look in the embedded file system for a 42m of that name (for example, /app/anothermodule.42m)
  2. Or with the gwabuildtool, you can use the option --main-module to specify the initial 42m module to be loaded.

Build and deploy the application

Build, deploy, and launch a GWA application on the GAS

It is assumed you have a directory with your Genero program files. For more information on creating the program directory, go to Program directory required for the build

Follow these steps to build the GWA application:

Steps

Execute the gwabuildtool command and related build options to create the GWA application.
If required, specify other options, such as the location of the GBC directory with the --gbc option if the default GBC is not to be used. For more information, go to Specifying the GBC to be used.
gwabuildtool --program-dir /usr/myprogramdir 
Where the --program-dir option is mandatory. It must be set to the path of your program directory.
The default directory called gwa_dist with all the necessary files is created in your current path.

Deploy and launch the application

After building the GWA application, you can launch your application for testing purpose directly to your browser, using the gwasrv server. For example, execute these commands to run the GWA application created by the gwabuildtool tool:
cd gwa_dist
gwasrv index.html
The default browser opens with an address like http://localhost:9101/d/r/gwa_dist/index.html and serves the Genero application now running in the browser.

To deploy the application on your GAS, you must first produce a Genero archive (gwa) file using fglgar gwa.

Steps

  1. Execute the fglgar gwa command and related options to create a Genero archive (gwa) file.
    fglgar gwa --gwa gwa_dist --output myapp.gwa
    Where:
    • The --gwa option is mandatory. It must be set to the path of the gwa directory created by the gwabuildtool.
    • The --output option is also mandatory. You must set it to the name of the gwa file to generate and the relative or absolute path to where it is to be output.

    An archive file (gwa) with all the necessary files is created in the output path.

  2. Execute the gasadmin gwa command and related options to deploy the Genero archive (gwa) file on the GAS.
    For details, refer to the gasadmin topic in Genero Application Server User Guide.
    gasadmin gwa --deploy-archive myapp.gwa 

    The application should now be accessible on the server where the GAS is running at a URL like this: https://host:port/gas/gwa/myapp/index.html

Troubleshooting GWAs

What steps can you take if you have trouble with a Genero web application (GWA)?

If a GWA is stuck during the load process, check the browser debug console for errors.

The error is most likely visible in the console, either from the JavaScript side or from the fglrun side. fglrun VM runtime errors are unfortunately not visible in the UI yet, so console output may contain the following:

  • Program stopped at 'main.4gl, line number 21.
  • FORMS statement error number -6331.
  • Front end module could not be loaded.
These kind of errors will eventually – in the GA version – be shown in the GBC UI like in any other Genero app.

If the error is not an fglrun runtime error:

  1. First, try reloading the app with the browser reload option with:
    • "Force Reload this page"(Chrome).
    • "Reload page from Origin" (Safari®).
    • Ctrl-F5 (Firefox™).
  2. Next, clear the browser cache and then reload.
  3. Next, clear website data for the development host and reload.
If all that is unsuccessful, send a copy of the web development console log to support.