Static content bundling service
Glossary Item Box
All custom content (e.g., the source code of custom schemas, CSS-styles) is generated in a special Creatio directory to improve performance. The benefits of this approach are described in a separate article - “Client static content in the file system.” However, having to process a considerable amount of files, the browser sends a large number of requests while loading the application, which significantly increases the loading time. To ensure stability, similar files are collected into bundles. For this particular purpose, the static content bundling service is implemented in Creatio by default.
Static content bundling service workflow
The “watcher” app (ContentWatcher) monitors the files in a static content directory and notifies the web-service about any changes.
Upon request (either manual or from ContentWatcher), the web-service (ContentService) re-generates bundle-files and modifies a specific Creatio configuration file so that it uses bundles instead of static content.
Fig. 1 illustrates the basic work principles of the static content bundling service.
Fig. 1. Basic work principles of the static content bundling service
A web-service can be installed without the “watcher” app (ContentWatcher). In this case, all requests to the web-service (ContentService) for bundling or minification can only be done manually.
The service components can be installed on the same machine as the Creatio application service or on a separate machine. If the application server and the components of the bundling service are not installed on the same machine, the service components must be able to access Creatio static content files.
ContentService
ContentService is a .NET Core 2.1 web-service which performs the following operations (access points):
- / – tests the service efficiency (the GET method).
- /process-content – generates minified bundle-files (the POST method).
- /clear-bundles – clears bundle-files (the POST method).
- /minify-content – minifies content (the POST method).
ContentWatcher
ContentWatcher is .NET Core 2.1 application. ContentWatcher is run as a service (it can also be run using .NET Core CLI Tools). The primary task of ContentWatcher is to monitor any changes in a file specified in the fileFilter parameter. The path to the file itself is specified in the directory parameter (e.g., --directory='c:\temp' --fileFilter='readme.txt’). By default, the fileFilter parameter value is “_MetaInfo.json.” If this file is changed, ContentWatcher considers this to be an update of all static content. When changes are detected, ContentWatcher notifies ContentService to re-generate bundle-files.
Service configuration structure:
- ets/content-watcher/appsettings.json - ContentWatcher configuration file.
- Docker-compose.yml - docker-compose utility configuration file.
- .env – the file containing environment variables for running the components.
Static content bundling service compatibility with Creatio products
The static content bundling service is compatible with all Creatio products of version 7.11 and up.
Static content bundling service deployment options
You can use the static content budling service both on-site and in the cloud. Use a Docker container to deploy the service on-site. Contact the Creatio technical support to deploy the bundling service in the cloud.
System requirements:
- A Linux OS server (stable versions of Ubuntu or Debian are recommended) with a stable version of Docker installed and configured. The requests to the image repository (Docker Hub) must be allowed from this server.
- Both Docker and Docker Compose must be installed on the server (see the Docker documentation).
See Also