attic-concepts/database-sync

Shopware plugin to sync databases between different instances via SSH

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:shopware-platform-plugin

1.0.0 2025-03-10 18:31 UTC

This package is auto-updated.

Last update: 2025-03-10 18:33:07 UTC


README

This plugin enables database synchronization from a remote Shopware instance via SSH.

Features

  • Interactive SSH password authentication
  • Configurable SSH port and remote path
  • Interactive connection selection with validation
  • Automatic cleanup of temporary files
  • Support for production and staging environments

Installation

  1. Clone the repository into your custom/plugins directory:
cd custom/plugins
git clone https://github.com/barbieswimcrew/shopware-database-sync.git AtticConceptsDatabaseSync
  1. Install the plugin via Shopware CLI:
bin/console plugin:refresh
bin/console plugin:install --activate AtticConceptsDatabaseSync

Configuration

Configuration is managed through the .env.local file. Two connections are supported:

Production

# Production connection
DATABASE_SYNC_PROD_HOST=example.com
DATABASE_SYNC_PROD_USER=ssh-user
DATABASE_SYNC_PROD_PORT=22
DATABASE_SYNC_PROD_PATH=/var/www/shopware

Staging

# Staging connection
DATABASE_SYNC_STAGING_HOST=staging.example.com
DATABASE_SYNC_STAGING_USER=ssh-user
DATABASE_SYNC_STAGING_PORT=22
DATABASE_SYNC_STAGING_PATH=/var/www/shopware

Usage

Synchronize Database

# Interactive connection selection
bin/console database:sync

# Direct connection specification
bin/console database:sync production
bin/console database:sync staging

The command performs the following steps:

  1. Validates connection parameters
  2. Prompts for SSH password
  3. Creates a dump on the remote server
  4. Downloads the dump
  5. Imports into local database
  6. Automatically cleans up temporary files

Create Database Dump

# Create dump and output path
bin/console database:dump --path-only

# Create dump with status messages
bin/console database:dump

Troubleshooting

Invalid Connection

When an invalid connection is specified (e.g., "test"), an error message displays the allowed values:

Invalid connection "test". Allowed values are: "production" or "staging"

Missing Configuration

Missing configuration parameters are clearly displayed:

Missing configuration parameters:
DATABASE_SYNC_*_HOST
DATABASE_SYNC_*_USER
...

SSH Connection Issues

For SSH connection problems:

  1. Check connection parameters (host, user, port)
  2. Ensure you have the correct password
  3. Test SSH connection manually: ssh -p PORT USER@HOST

Security

  • Interactive password authentication
  • Temporary files are automatically deleted
  • Sensitive information is not logged
  • Connection parameters are validated

Requirements

  • PHP 8.1 or higher
  • Shopware 6.5.x
  • SSH access to the remote server
  • Remote server must have Shopware 6 installed with system:dump command available
  • Local Shopware instance must support system:restore command

Support

For questions or issues, please open an issue on GitHub or contact us at support@attic-concepts.com

License

MIT License