Deploy an application

When you have your application configured correctly and running on the GAS, you are now ready to package the files required to deploy it as an application.

This topic provides you with steps to configure and deploy an application that you can test on your own machine.

For the purposes of this quick start, you can use the configuration files created for the HelloWorld.xcf application. See Configure an application.

  1. Remove the HelloWorld.xcf file in your GAS appdata/app directory (On Linux/UNIX: $FGLASDIR/appdata/app, on Windows®: C:\ProgramData\FourJs\gas\gas_version\app)

    This file may have been uploaded by yourself during the Configure an application task. Applications with the same xcf can not be deployed.

  2. Update the application configuration file (HelloWorld.xcf) for your HelloWorld application.
    Update the <PATH> element to the GAS deployment path as follows:
    <PATH>$(res.deployment.path)</PATH>
    The configuration should now look like this:
    <?xml version="1.0" encoding="UTF-8" ?>
    <APPLICATION Parent="defaultgwc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
                xsi:noNamespaceSchemaLocation="http://www.4js.com/ns/gas/4.01/cfextwa.xsd">
      <EXECUTION>
        <PATH>$(res.deployment.path)</PATH>
        <MODULE>HelloWorld.42r</MODULE>
      </EXECUTION>
    </APPLICATION>
  3. Create a new directory where you will archive the application's runtime files (you can name it "helloworld_deploy").
  4. Copy all the HelloWorld application runtime files from $GSTDIR/samples to the archive directory.
    Note:

    If you are deploying resources (for example, images or web components) with your application, these need to go in dedicated directories in the archive.

  5. Copy the application configuration file (HelloWorld.xcf) to the directory with the application runtime files.
  6. In the same directory, create a MANIFEST file and save it with the name "MANIFEST" (without extension).
    The MANIFEST contents resembles the following:
    <MANIFEST>
      <DESCRIPTION></DESCRIPTION>
      <APPLICATION xcf="HelloWorld.xcf"/>
    </MANIFEST>
  7. Create an archive file (gar) to deploy your application by performing the following steps:
    1. Navigate to your Genero Studio installation directory and set the environment.
      • On Linux®/macOS™, change to your Genero Studio root directory and source the script, for example:
        cd /opt/fourjs/gst
        source envgenero 
      • On Windows, change to your Genero Studio root directory and run the bat file, for example:
        cd "c:\program files\fourjs\gst"
        envgenero.bat 
    2. Navigate to the directory that contains the application runtime files AND the MANIFEST file.
    3. Create an archive file (gar) to deploy your application by typing this command:
      fglgar gar .

      Where the dot (period) specifies the current directory.

      A Genero Archive (gar) file is created in your current directory that has the same name as the directory. See the fglgar topic in the Genero Business Development Language User Guide.

Deploy your application on your machine

About this task:

Once you have configured your application for deployment and created an archive for it in the steps above, you can now deploy your application locally on your machine to test it as described in the next steps.

  1. Deploy your Genero Archive (gar) file locally on your machine.
    1. Start the command line interface in a Genero Workplace Window and set the environment.
      • On Linux/macOS, change to your Genero Studio root directory and source the script, for example:
        cd /opt/fourjs/gst
        source envgenero 
      • On Windows, change to your Genero Studio root directory and run the bat file, for example:
        cd "c:\program files\fourjs\gst"
        envgenero.bat 
    2. Navigate to the directory that contains the HelloWorld_deploy.gar
    3. Deploy the gar file by typing this command:
      gasadmin gar --deploy-archive HelloWorld_deploy
      A subdirectory is created in your GAS $(res.deployment.path) directory (On Linux/UNIX: $FGLASDIR/appdata/deployment, on Windows: C:\ProgramData\FourJs\gas\gas_version\deployment ) identified by the archive name and the date and time deployed. In our example, this would be a directory named HelloWorld_deploy-20240826-130838. All the files contained in the Genero Archive (gar) file are placed in the directory.
  2. Enable your deployed application locally on your GAS.

    To list all deployed archives:

    gasadmin gar --list-archives

    To enable the archive, reference it by its archive name:

    gasadmin gar --enable-archive HelloWorld_deploy

    This enables the application by copying its configuration file (HelloWorld.xcf) to your $(res.appdata.path) directory.

Run the deployed application

About this task:

Once you have deployed your application on your machine in the steps above, you can now run your application locally to test it as described in the next steps.

  1. If your standalone dispatcher is not running, start it from the command line by typing httpdispatch.
    • On Linux/macOS, change to your Genero Studio GAS directory and type httpdispatch, for example:
      cd /opt/fourjs/gst/gas/bin
      httpdispatch
    • On Windows, change to your Genero Studio GAS directory and type httpdispatch, for example:
      cd "c:\program files\fourjs\gst\gas\bin"
      httpdispatch
  2. In a browser enter the address of your deployed application, e.g. http://localhost:6394/ua/r/HelloWorld
    The Genero Application Server responds, and you should see your application displayed and be able to interact with it. You have successfully deployed an application.