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
Requires
- php: >=8.1
- shopware/core: 6.6.*
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
- Clone the repository into your
custom/plugins
directory:
cd custom/plugins
git clone https://github.com/barbieswimcrew/shopware-database-sync.git AtticConceptsDatabaseSync
- 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:
- Validates connection parameters
- Prompts for SSH password
- Creates a dump on the remote server
- Downloads the dump
- Imports into local database
- 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:
- Check connection parameters (host, user, port)
- Ensure you have the correct password
- 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