Deploying your Custom Client

Resource Name

The resource name is important for the deployment of the custom client. The resource name is defined in the package.json file in the main client project folder and is custom by default. 

package.json (excerpt)
...
"config": {
    "resourcename": "custom"
},
...

The resource name defines the name of the artifact and the URL at which the client application will be available. 

# the resource name of the standard client is 'client', so the standard client is available at
http://<hostname>/app/client

# custom client, if its resource name is set to 'custom', is available at
http://<hostname>/app/custom 

The developer must choose a resource name before building the production artifact, as the client application must know at build time which URL it will be available at.

Production Artifact

The production artifact of the custom client is built using the run task build:prod

npm run build:prod

After completion of the build process, the production artifact with the name <resource_name>_<version>.zip ( e. g., custom_1.0.0.zip) will be created in the output directory.

Pushstate Routing

A running client application requires Pushstate Routing which can be enabled for the webcontainer of the gateway by setting the property pushstate.routing.required. To enable Pushstate Routing ensure your client ZIP artifact contains the file client.properties in the main folder providing the following content:

pushstate.routing.required=true

For Custom Client Projects (i. e., projects based on @eo-sdk/client library), the integrated build process creates the client.properties file with the appropriate content at build time. In case you build your Individual Client (e. g., based on @eo-sdk/core only) you have to create the client.properties file on your own.

Deployment

To deploy the client artifact, follow these steps:

  1. Copy the artifact to the public directory of the Service Manager. You can either do this ...
    1. manually by extracting the ZIP file and copying its contents into the directory /data/webresource/public/<resource_name> of the Service Manager (e. g., <SERVICE_MANAGER_INSTALLATION_PATH>/data/webresource/public/custom) or
    2. by installing the ZIP artifact using SAM tool:

      # installing the artifact for the first time
      sam.bat install <artifact_zip_file>

      or

      # updating an already installed artifact
      sam.bat update <artifact_zip_file>
  2. If the custom client with the given resource name is installed for the first time, its path must be added to the exposed endpoints in the gateway configuration <SERVICE_MANAGER_INSTALLATION_PATH>/config/gateway-prod.yml, e. g:

    /config/gateway-prod.yml (excerpt)
    # endpoints that can be called (and routed) without prior authentication
    # example: authentication.exposed.endpoints: '/endpoint1/**,/endpoint2/**'
    authentication.exposed.endpoints: '/app/client/**,/app/custom/**'
  3. If the custom client with the given resource name is installed for the first time, restart the gateway and, if necessary, the client service.