Skip to main content
Version: 8.1

Static content bundling service

Level: advanced

Static content includes *.js and *.css files that are located in the Creatio file system and are required to display the Creatio UI in the browser. *.js files might include code of client module schema or other JavaScript data. If the browser must initially load a large amount of static content, this can significantly affect the loading time. Use static content bundling service to improve Creatio performance. Out of the box, Creatio has static content enabled. Learn more about features of static content: Packages file content basics.

View the ways to optimize the page loading time provided by Creatio in the table below.

Way

Description

Minification

Reduces the size of *.css, *.js, and *.html files. This implies removal of commented out code as well as superfluous line breaks, leading and trailing spaces. This reduces the size of the original file by 10-20%.

Bundling, i. e., generation of bundled files

Optimizes the performance by combining the static files of the same type into a single bundled file. Reduces the number of requests.

Static content bundling service executes both minification and bundling. Most web apps are delivered with minified and bundled files. Since the Creatio configuration and static content can change during the life cycle, the service runs minification and bundling automatically when necessary. If you use Creatio in the cloud, the static content bundling service is deployed out of the box.

Architecture of static content bundling service

View the list of bundling service components in the table below.

Component

Description

ContentService

The service that minifies and bundles Creatio files. Deployed independently of Creatio.

ContentWatcher

A utility that interacts with Creatio files and ContentService to ensure timely minification and bundling.

To improve performance, the app is configured to generate minified bundled files out of the box.

View the bundling service flowchart in the figure below.

View the bundling service workflow in the figure below.

Requirements for the correct operation of the bundling service:

  • Uninterrupted operation of ContentService and ContentWatcher.
  • ContentService and ContentWatcher access to static content.
  • Ability to access static content from ContentService to ContentWatcher via HTTP.
  • A valid configuration of ContentService and ContentWatcher.

ContentService

ContentService can be paired with ContentWatcher or work independently. If the ContentService works independently, access the endpoints manually or using a third-party automation, for example, when deploying or updating Creatio. Learn more: ContentService endpoints.

The bundling service does not require a change in the ContentService configuration to work correctly. Out of the box, the bundling service is configured optimally, but you can change the settings to boost performance or enable additional functionality. Learn more: ContentService settings.

ContentWatcher

ContentWatcher executes the following actions:

  • Monitors the specified static content files to determine if their content changes.
  • Notifies ContentService that the file contents are updated and passes the appropriate parameters to the service.

ContentWatcher works as follows:

  1. Watch for changes to the _MetaInfo.json file that is changed when static content is updated.
  2. Send a notification to ContentService about a pending bundling. ContentWatcher can track changes to any file and send a notification to any URL.

ContentWatcher can monitor multiple Creatio instances. To orchestrate Creatio, ContentWatcher, and ContentService correctly, configure ContentWatcher. Learn more: ContentWatcher settings.

Deploy the static content bundling service

Deploy the static content bundling service using Docker. Learn more: official vendor documentation (Docker).

1. Perform preliminary setup

  1. Deploy physical or virtual server on Linux machine. We recommend using stable versions of Debian or Ubuntu. The server serves as the host machine for the bundling service components.
  2. Install Docker. Install Docker (user documentation).
  3. Provide the server access to files in the /conf directory of the current Creatio instance to make files accessible for the server runtime, for example, over a network using the NFS protocol.

2. Install bundling service components

Install bundling service components for a server that has internet connection

  1. Contact Creatio support to obtain read access to the private Creatio image repository (https://registry.creatio.com) and *.tar archives that include Docker images of the bundling service components.

  2. Log in to the private Creatio image repository using user credentials provided by Creatio support. To do this, run the following command.

    docker login https://registry.creatio.com -u=SomeUserLogin -p=SomeUserPassword

    Where SomeUserLogin and SomeUserPassword are user credentials.

As a result, subsequent deployment of the bundling service will download components from the private repository automatically.

Install bundling service components for a server that has no internet connection

  1. Contact Creatio support to obtain *.tar archives that include Docker images of the bundling service components.

  2. Place the obtained archives on the server where the bundling service is deployed.

  3. Upload Docker images from the file system on the server to the local Docker cache. To do this, run the following command.

    docker load -i content-service.tar
    docker load -i content-watcher.tar

    If you use an internal storage of Docker images, upload archives to the storage.

As a result, bundling service components will be installed.

3. Set up the bundling service

  1. Provide the server access to content of the files in the /conf directory to make file content accessible for the server runtime. Omit this step if the bundling service is deployed on the same server as Creatio. If you use a dedicated server to deploy bundling service:

    1. Obtain read and write access to the /conf directory.
    2. Specify the path to the /conf directory on the server dedicated to deploying the bundling service.
  2. Ensure that an arbitrary directory on the server includes the configuration files of the bundling service listed in the table below.

    Configuration file

    Description

    ../etc/content-watcher/appsettings.json

    Configuration of the ContentWatcher utility.

    docker-compose.yml

    Configuration of the Docker Compose utility.

    *.env

    A list of environmental variables to launch the bundling service components.

  3. Specify the parameters listed in the table below in the *.env file.

    Parameter

    Description

    DOCKER_REGISTRY

    Path to the registry of Docker images. If you deploy the bundling service from local cache, leave the parameter blank.

    DOCKER_TAG_SERVICE,
    DOCKER_TAG_WATCHER

    Current versions of the bundling service components provided by Creatio support.

    ContentPath

    Path to the /conf directory that includes the static content.

4. Download the required Docker images

Download the required Docker images of the bundling service components to the directory where the configuration files are deployed, for example, /opt/services. Take this step if you deploy the bundling service using the private Creatio image repository. To do this, run the following command.

docker-compose pull

5. Launch the bundling service components

  1. Run the following command within the directory that includes the configuration files of the bundling service.

    docker-compose up -d
  2. Make sure the bundling service components are launched successfully and view the logs. To do this, run the following command within the directory that includes the configuration files of the bundling service.

    docker logs SomeContainer

    Where SomeContainer is the name of the Docker container.

6. Make sure the bundling service is deployed successfully

  1. Make sure the bundling service is ready to accept requests to generate bundled files in one of the following ways:

    • Send GET request to the SomeServerIP:SomeBundlingServicePort.
    • Enter the SomeServerIP:SomeBundlingServicePort URL in the browser address bar.

    Where:

    • SomeServerIP is the IP address of the server that includes the installed service.
    • SomeBundlingServicePort is the port where the ContentService is launched.

    If the bundling service is ready to accept requests to generate bundled files, you receive the following response.

    Service is running. Go to /start page to use web interface
  2. Make sure the static content of the Creatio instance is bundled correctly.

    1. Log in to Creatio.

    2. Save an arbitrary client schema.

    3. Make sure the bundling service starts to generate bundled files. To do this, verify the logs of ContentService component include the following record.

      INFO|ContentService.Web.API.ContentProcessingRequestHandler|Content processing (/process-content) is running for path /app/content/content...
    4. Wait for the process that generates bundled file to complete. To do this, verify the logs of ContentService component include the following record.

      INFO|ContentService.Web.API.ContentProcessingRequestHandler|Content processing (/process-content) finished in 12345ms for path /app/content/content
    5. Ensure that bundled files are loaded instead of static files when using Creatio. To do this, verify that the Network tab in browser debugging tools includes the /conf/content/bundles/ requests whose *.js files have the _bundle prefix.

Interaction between bundling service components and Creatio

View the interaction diagram of ContentService, ContentWatcher and Creatio that uses common settings and is deployed using the default configuration in the figure below.

If ContentWatcher and ContentService are deployed on Linux (including Docker) and the Creatio file system is shared with ContentWatcher and ContentService, specify the paths to the directories where the Creatio file system is mounted in the Directory and ContentPath settings. For example, if the /conf directory of the Creatio instance is built-in into a container in the /app/content/ path, specify /app/content/ in the Directory setting and /app/content/content in the ContentPath setting.

View the example of the configuration file for Creatio on-site below.

Configuration file example (Creatio on-site)
{
"ContentServiceUrl": "http://host.docker.internal:29572/process-content",
"ConfigurationRefreshInterval": "86400000",
"DefaultFileFilter": "_MetaInfo.json",
"FileEventWatcher": {
"RetryFileWatchingDelay": "180000",
"MaxFileWatchingRetries": "20"
},
"ContentWorkers": [
{
"Name": "Some Website Name",
"Directory": "/path_to_creatio_conf_directory/",
"ContentWorkerArguments": {
"key": "ContentPath",
"value": "/path_to_creatio_conf_directory/content"
}
}
]
}

See also

Packages file content basics

ContentService service

ContentWatcher utility

Deploy the Creatio .NET application server on Linux (user documentation)


Resources

Official vendor documentation (Docker)