You have been redirected from an outdated version of the article. Below is the content available on this topic. To view the old article click here.

Services

There’s a couple of system services that have to be defined in structr.conf in order to activate certain functionality.

The following services exist:

Service Name Functional Area
AgentService Background agents and bulk commands
CronService Crontab-like periodic command execution
DirectoryWatchService Filesystem change listener
FtpService FTP server
HttpService HTTP server
LDAPService LDAP client / sync
NodeService Graph object access
SSHService SSH/SCP server
SchemaService Custom schema support

Search results for "Services"

Services

configured.services Controls the availability of services in the Structr Services Layer. Only services that are enabled in this setting can be started.
services.start.timeout The number of seconds Structr waits before trying again to start a failed service.
services.start.retries The number of times Structr tries to start a service before it gives up.
nodeservice.start.timeout The number of seconds Structr waits before trying again to start the NodeService. The Node Service is a vital service that provides access to the configured database.
nodeservice.start.retries The number of times Structr tries to start the NodeService before exiting.

The Services Settings tab allows you to (re)start and stop Structr services. The available services include a MailService, CronService, SchemaService, AgentService, NodeService, SSHService, FtpService, LDAPService, HttpService, as well as a DirectoryWatchService.

Structr Services Layer

The Structr Services Layer is a part of the Structr architecture. It manages the configured services that run in an instance.

maintenanceMode

When the maintenance mode is started, the following services are shut down:

  • FtpService
  • HttpService
  • SSHService
  • AgentService
  • CronService
  • DirectoryWatchService
  • LDAPService
  • MailService

After a brief moment, the following services are restarted with another port:

  • FtpService
  • HttpService
  • SSHService

Enables or disables the maintenance mode. In maintenance mode, most services are stopped and some other services are restarted on different ports to enable maintenance work to be done without interference.

Periodic Task Scheduler

# CronService is included in the configured.services setting (and thus active)
configured.services = NodeService SchemaService HttpService CronService

# three global schema method names are registered as tasks
CronService.tasks = cleanUpMethod1 cleanUpMethod2 exampleMethod

# Run every 30 minutes
cleanUpMethod1.cronExpression = 0 0,30 * * * *

# Run every 15 minutes
cleanUpMethod2.cronExpression = 0 */15 * * * *

# Run each hour on Mondays during the first 10 days in April and October
exampleMethod.cronExpression = 0 0 * 1-10 4,10 1

Authenticating - JWKS Provider

Structr also supports JWT validation with tokens issued by other authentication systems than Structr like e.g Keycloak or Auth0 via the open .well-known JWKS endpoints of those services.

To activate this feature, the configuration entry ‘security.jwks.provider’ has to be configured with the endpoint of the service. After this, Structr will verify a send token in the Authentication Header of the requests against the configured service.

Periodic Task Scheduler

  • The CronService must be included in the structr.conf setting configured.services to be activated
  • When a cronExpression is added, deleted or edited, the CronService has to be restarted for the changes to take effect. This can be done at runtime via the configuration tool or by restarting structr
  • By default, structr prevents the same cron task to run run while the previous execution is still running. This can be changed via the setting CronService.allowparallelexecution in structr.conf.

Hardware Requirements

The hardware requirements are determined by the amount of data to be processed and the load profile. Basic setup requirements can be met with 1 CPU core and 1 GB of RAM. However, to provide a more stable experience, our recommended minimum setup is 4 GB of RAM and 2 CPU cores dedicated to the Structr JVM process. Additional CPU and RAM should be planned for other processes/services running on the same machine.

Importing data from JDBC sources

Importing data from a SQL database is possible via the jdbc() function function in the Structr scripting engine. You can execute an SQL query on a server and process or display the result in your application. The code for that is essentially the same as for the “Import from Webservices” example above.

Log file

The definitive place to look for error messages is the log file. Structr will write almost everything that is an error or warning message into the log, depending on some configuration settings. In addition to warning and error messages, Structr also logs informative messages, for example the licensing configuration, information about services, etc.

Step-by-step Guide

  1. Set application.https.enabled = true via the configuration tool. This enables HTTPS.
  2. Set application.https.<a data-id="c3ea50e922724cb7a14ac51658248ac4" class="mention">port</a> = 443 via the configuration tool. This sets the HTTPS port to 443 (default is 8083)
  3. Configure Let’s Encrypt Domain setting letsencrypt.domains = your-domain.com via the configuration tool. (Replace your-domain.com with your actual domain)
  4. Create/update certificate from Let’s Encrypt.
    • Either via curl (replace the admin credentials with your credentials and adjust the server+port according to your installation):
    curl -XPOST -HX-User:admin -HX-Password:admin http://localhost:8082/structr/rest/maintenance/letsencrypt -d '{"server":"production","challenge":"http","wait":"10"}'
    
    • Or via builtin function
    ${{
        $.maintenance('letsencrypt', {server: "production", challenge: "http", wait: "10"});
    }}
    
  5. Restart the HTTP Service via the configuration tool tab Services and the button Restart next to the entry HttpService.default

The structr HTTP service will now reload completely with HTTPS enabled.

Translation Module

translation.google.apikey Sets the API key for Google services.
translation.deepl.apikey Sets the API key for the DeepL service.

maintenanceMode

If for example a cron job is running, it will not be halted. Only the services are stopped so no NEW processes are started. Active processes will keep running until they are finished.

General

oauth.servers Space-seperated List of available oauth services. Defaults to “github twitter linkedin google facebook auth0”.

Services

Note: If a vital service cannot be started even after retrying several times, Structr will exit. The configuration key services.start.retries controls this number of retries.

Changes to the configuration file requires a restart of Structr to become effective. In contrast, most setting changes made via the configuration tool become effective immediately. In particular, services may have to be (re)started via the respective tab in the interface. For this reason, and because of the available tooltips, the configuration interface is the recommended way of making changes to the Structr settings.

Create Relationships

Cold backup