Freeze module
Edition |
Incubator (services) |
||
Issues |
|||
Git |
|||
Latest |
2.0
|
The Freeze module allows you to stop all publication activity on a Magnolia author instance temporarily. Authors can continue to work in the system during the freeze but they cannot version content or publish content. Freeze is useful when you want to swap author instances or you want to make sure that public instances stay in sync during an upscaling event.
The Freeze module provides commands for managing a global freeze flag. With these commands, it’s possible to set and unset the freeze flag.
This module is at the INCUBATOR level. If you are using a version prior to With version 2.0, the Freeze module was reorganized into several separate modules:
|
Installing with Maven
Maven is the easiest way to install the module. Add the following to your bundle:
<dependency>
<groupId>info.magnolia.freeze</groupId>
<artifactId>magnolia-freeze</artifactId>
<version>2.0</version>
</dependency>
Add the following dependency to add publication freeze checks to the publication actions in the Pages, Assets and Stories apps:
<dependency>
<groupId>info.magnolia.freeze</groupId>
<artifactId>magnolia-freeze-apps</artifactId>
<version>2.0</version>
</dependency>
Add this dependency to add publication freeze checks to activation commands in Magnolia’s Personalization module:
<dependency>
<groupId>info.magnolia.freeze</groupId>
<artifactId>magnolia-freeze-personalization</artifactId>
<version>2.0</version>
</dependency>
Usage
The module provides a set of commands useful for controlling and reading the freeze flag. These command can be used in a variety of ways to create a freeze event.
A freeze is cumulative: successive calls to a freeze start must be followed by the same number of calls to stop before the freeze is lifted.
Configuration
Global publication freezes are enforced at two levels:
-
In availability rules for actions that trigger publications
-
In publication commands
Both are configured through extending or modifying standard Magnolia configuration but not every action or command has been modified. If you want to enforce a publication freeze in your own app or command, you must configure it.
Action configuration
You can control the availability of actions according the state of a publication freeze by using this availability rule: info.magnolia.services.freeze.availability.IsNoGlobalFreeze
.
Adding IsNoGlobalFreeze
as an availability rule to an action will disable the action if a global publication freeze is active and enable it (depending on other availability rules) if there is no global publication freeze.
Installing the Freeze apps module will modify the availability rules in the following apps:
-
Pages app: availability of the publish, publish recursive and unpublish actions
-
Assets app: availability of the publish, publish recursive and unpublish actions
-
Stories app: availability of the publish, publish recursive and unpublish actions
other Magnolia apps and your own custom apps can launch publications. You’ll have to add IsNoGlobalFreeze to their availability rules to check for publication freezes. |
Command configuration
You can interrupt the execution of command chains carrying out a publication by adding the checkGlobalFreeze
command. This command checks for a current global publication freeze, and if one is present, will return false. This will stop the execution of a command chain.
checkGlobalFreeze should be placed before any other command in the chain to stop execution.
|
Installing the Freeze module will modify the commands defined in the following modules:
publishing-core: the default-publish
, default-unpublish
, versioned-publish
and versioned-unpublish
commands
Installing the Freeze personalization module will modify the commands defined in the Magnolia personalization module
-
personalization-core: the
default-personalizationActivation
command -
personalization-integration: the
default-personalizationActivation
command
If you have your own commands that publish content that should respect a global publication freeze, you should add checkGlobalFreeze to their command chains to prevent executing them during a publication freeze.
|
checkGlobalFreeze should be placed before any command in the chain. checkGlobalFreeze will stop the execution of the command chain if a publication freeze is in effect.
|
Commands
All the freeze commands can be found in the freeze catalog: /module/freeze/commands/freeze
:
Command | Description | ||
---|---|---|---|
|
Start a global freeze, or continue a global freeze.
|
||
|
Attempts to stop a global freeze. The outcome of the attempt is dependent on sequence factors. The index in which the stop is called makes a difference in the default use case. However, using the force parameter in the command context can be used to end a freeze immediately. Set the boolean parameter to true to force the stop to be final. |
||
|
Toggles the state of the flag. Will start a global freeze if a freeze is not active or end a global freeze is one is currently active.
|
||
|
Check the state of the freeze flag. Will return |
REST APIs
You can start, stop and get information about the current freeze state through two REST APIs:
-
through the Magnolia REST Services command endpoint
-
through a Freeze REST API defined in the Freeze module
Both APIs provide exactly the same functionality: starting a global freeze, stopping a global freeze, toggling a global freeze and checking on the global freeze state. Both APIs return exactly the same information: the current global freeze state and the global freeze count.
So which REST API should you use? Whichever you prefer, but if you would like to customize the handling of global freezes, the REST command API is more flexible.
The enabled commands defined in the command endpoint (at /modules/rest-services/rest-endpoints/commands/enabledCommands
) can be modified. You can use a different command to be invoked through the command endpoint or use a command chain to customize the actions taken when managing a global freeze.
REST Command Endpoint
Using Magnolia’s REST API it’s possible to start. stop, or toggle a freeze. The command endpoint makes this possible. After installation of the freeze module you should see the commands enabled under rest-services.
A command issued as a You can use an empty body in this case, for example:
|
Changelog
Version | Notes |
---|---|
|
Several updates.
|
|
Several updates.
|
|
Version 1.8 does not correctly upgrade from earlier versions. Use v1.8.1 instead of 1.8 when updating an installed Freeze version. |
|
|
|
Fixed FREEZE-4 |
|
added notifications when freeze is started and ended |
|
Fixed widgetset warnings |
|
Several updates.
|
|
Initial release of the extensions version of the module. |