Configuration backup
StackState Self-hosted v5.0.x
This page describes StackState version 5.0.
StackState configuration can be exported and imported. The import/export functionality can be used to automate the installation process and/or for backup purposes. An export and import can be made in the settings page of StackState's user interface by using the buttons 'Export Model' and 'Import Model'.
An export of the StackState configuration can be obtained from the StackState UI, the StackState CLI or using curl commands. Note that the lock status of configuration items installed by a StackPack configuration will not be included in the export.
To export configuration using the StackState CLI or curl:
CLI: sts (new)
CLI: stac
curl
# Output in terminal window
sts settings describe
# Export to file
sts settings describe --file <PATH_TO_FILE.stj>
⚠️ PLEASE NOTE - from StackState v5.0, the old
sts
CLI has been renamed to stac
and there is a new sts
CLI. The command(s) provided here are for use with the new sts
CLI.# Output in terminal window
stac graph export
# Export to file
stac graph export > export.stj
⚠️ PLEASE NOTE - from StackState v5.0, the old
sts
CLI is called stac
.In a future release of StackState, the new
sts
CLI will fully replace the stac
CLI. It is advised to install the new sts
CLI and upgrade any installed instance of the old sts
CLI to stac
. For details see:curl -X POST -H 'Content-Type: application/json;charset=UTF-8' \
-d '{}' \
"http://<host>:7070/api/export?timeoutSeconds=300" > export.stj
To export configuration from the StackState UI:
- 1.Go to Settings > Import/Export > Export Settings
- 2.Click the button STS-EXPORT-ALL.

Export configuration from the StackState UI
StackState server can be configured to authenticate users when they access the application. In this case, an export curl script is required to first obtain a token before making the export request. This is not necessary when using the StackState CLI as authentication details are configured during installation.
Here is a sample sequence of curl commands to achieve this. The
<token>
used for authorization is available on the CLI page in the StackState UI main menu:curl
# Obtain session from cookie AkkaHttpPac4jSession
# Obtain token from cookie pac4jCsrfToken
curl --fail -v \
-H "Authorization: ApiToken <token>" <stackstate-api-endpoint> \
-H "Content-Type: application/x-www-form-urlencoded" \
"http://<HOST>:7070/loginCallback"
# Do actual request
export SESSION="<MY_SESSION>"; export TOKEN="<MY_TOKEN>"; \
curl -v -X POST \
-H 'Content-Type: application/json;charset=UTF-8' \
-d '{}' \
-H Cookie:AkkaHttpPac4jSession=$SESSION \
-H X-Sts-Token:$TOKEN \
"http://<HOST>:7070/api/export?timeoutSeconds=300" > export.stj
Import is intended to be a one-off action - importing multiple times might result in duplicate configuration entries. This behavior applies to importing nodes without any identifier. It is possible to clear StackState's configuration before an import. Note that the lock status of configuration items installed by a StackPack will not be included in configuration export files - all configuration items will be unlocked after import.
To clear the StackState configuration and import from a file using the StackState CLI or curl. The
<token>
used for authorization with curl is available on the CLI page in the StackState UI main menu:CLI: sts (new)
CLI: stac
curl
sts settings apply --file <PATH_TO_FILE.stj>
⚠️ PLEASE NOTE - from StackState v5.0, the old
sts
CLI has been renamed to stac
and there is a new sts
CLI. The command(s) provided here are for use with the new sts
CLI.stac graph import < <PATH_TO_FILE.stj>
⚠️ PLEASE NOTE - from StackState v5.0, the old
sts
CLI is called stac
.In a future release of StackState, the new
sts
CLI will fully replace the stac
CLI. It is advised to install the new sts
CLI and upgrade any installed instance of the old sts
CLI to stac
. For details see:## Clear StackState configuration
curl -X POST -f "http://<HOST>:7071/clear"
## Import without authentication
curl -X POST -d @./export.stj \
-H 'Content-Type: application/json;charset=UTF-8' \
"http://<host>:7070/api/import?timeoutSeconds=15"
## Import with authentication
# Obtain session from cookie AkkaHttpPac4jSession
# Obtain token from cookie pac4jCsrfToken
curl --fail -v \
-H "Authorization: ApiToken <token>" <stackstate-api-endpoint> \
-H "Content-Type: application/x-www-form-urlencoded" \
"http://<host>:7070/loginCallback"
# Do actual request
export SESSION="<MY_SESSION>"; export TOKEN="<MY_TOKEN>"; \
curl -X POST -d @export.stj \
-H 'Content-Type: application/json;charset=UTF-8' \
-H Cookie:AkkaHttpPac4jSession=$SESSION \
-H X-Sts-Token:$TOKEN "http://<HOST>:7070/api/import?timeoutSeconds=15"
Alternatively, in the StackState UI:
- 1.Go to Settings > Import/Export > Import Settings.
- 2.Choose the
*.stj
file that you want to import configuration from. - 3.Click the button START IMPORT.

Import configuration from the StackState UI
It is possible to export and import individual configuration items through the StackState user interface. For example, to export or export a component type:
- 1.Go to the Settings page and click Component Types.
- 2.To export an individual component type, click Export as config.
- 3.To import a configuration item, click Import Model.
There is a way to use identifiers and namespaces that come with them to perform a configuration update of the specific sets of nodes idempotently. This approach does not lead to duplicates, but checks for the changes within a specified namespace and applies them to existing nodes, including removing nodes, as well as allow for creating the new ones.
Node identifiers are specified in a following pattern:
urn:stackpack:{stackpack_name}:{type_name}:{object_name}
. The namespace effectively used by this process is urn:stackpack:{stackpack_name}:
. If every configuration node has an identifier and they are all in the same namespace, then you can perform an idempotent update using following STS CLI commands:For export:
CLI: sts (new)
CLI: stac
sts settings describe --namespace urn:stackpack:{stackpack_name}:
⚠️ PLEASE NOTE - from StackState v5.0, the old
sts
CLI has been renamed to stac
and there is a new sts
CLI. The command(s) provided here are for use with the new sts
CLI.stac graph export --namespace urn:stackpack:{stackpack_name}:
⚠️ PLEASE NOTE - from StackState v5.0, the old
sts
CLI is called stac
.In a future release of StackState, the new
sts
CLI will fully replace the stac
CLI. It is advised to install the new sts
CLI and upgrade any installed instance of the old sts
CLI to stac
. For details see: