Search by

adachsoft / data-backup-action

Arkadiusz Adach

An automation action for exporting named data backup targets to configured archive storage.

Package info

gitlab.com/a.adach/data-backup-action

Issues

pkg:composer/adachsoft/data-backup-action

Statistics

Installs: 8

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-11-30 22:15 UTC

This package is auto-updated.

Last update: 2026-11-30 21:16:12 UTC


README

Composer package: adachsoft/data-backup-action.

This library integrates data backup operations into an automation host. It exposes a data_backup.run action that selects a configured backup target and archive storage, then delegates the export to the data backup service.

Main capabilities

  • Publishes the data_backup.run action type with configured target and storage choices.
  • Supports selecting data source IDs and attaching string labels to an export.
  • Defaults to the first configured archive storage and marks every export with the trigger=automation label.
  • Returns the archive and storage identifiers or a failure result for invalid parameters and failed exports.

Requirements

  • PHP ^8.3
  • adachsoft/action-contracts:^0.1.2
  • adachsoft/data-backup-contracts:^0.2

Installation

composer require adachsoft/data-backup-action

Usage

An internal automation action that backs up a named BackupTargetInterface to a named ArchiveStorageInterface through BackupServiceInterface.

The action type is data_backup.run and is intended to be registered in the host application's automation container.

Parameters

NameTypeRequiredDescription
targetenumyesName of the configured backup target.
storageenumnoName of the archive storage; defaults to the first configured storage.
sourcesstringnoComma-separated data source IDs. An empty value exports all sources.
labelsJSON objectnoOptional string-to-string labels. The handler always sets trigger to automation.

The result output contains the configured target and storage names, the archiveId, and the storage's storageId.

Symfony registration

The host application supplies implementations of BackupTargetInterface, ArchiveStorageInterface, and BackupServiceInterface. The example uses application-specific tags to inject the named targets and storages into both action services.

# config/services.yaml
services:
    _defaults:
        autowire: true

    AdachSoft\DataBackupContracts\Contract\BackupServiceInterface:
        alias: App\Backup\BackupService

    app.data_backup_action.target.task_api:
        class: AdachSoft\DataBackupAction\NamedBackupTarget
        arguments:
            $name: task_api
            $target: '@App\Backup\TaskApiBackupTarget'
        tags: ['app.data_backup_action.target']

    app.data_backup_action.storage.nas:
        class: AdachSoft\DataBackupAction\NamedArchiveStorage
        arguments:
            $name: nas
            $storage: '@App\Backup\NasArchiveStorage'
        tags: ['app.data_backup_action.storage']

    AdachSoft\DataBackupAction\ActionType\DataBackupRunActionTypeProvider:
        arguments:
            $targets: !tagged_iterator app.data_backup_action.target
            $storages: !tagged_iterator app.data_backup_action.storage
        tags:
            - { name: adachsoft_automation.action_type_provider }

    AdachSoft\DataBackupAction\Handler\DataBackupRunActionHandler:
        arguments:
            $targets: !tagged_iterator app.data_backup_action.target
            $storages: !tagged_iterator app.data_backup_action.storage
        tags:
            - { name: adachsoft_automation.action_handler }

Register a schedule under adachsoft_automation.schedules to run the action every hour:

# config/packages/adachsoft_automation.yaml
adachsoft_automation:
    schedules:
        task_api_backup:
            rule:
                type: repeating
                frequency: hourly
                interval: 1
            actions:
                - type: data_backup.run
                  params: { target: task_api }