Skip to content

Team configuration sharing

Jelle Siderius edited this page Nov 12, 2025 · 2 revisions

Share database configurations across your development team using a private repository and symlinks. This approach ensures consistent configurations while maintaining security.


Setup Process

Step 1: Create Private Repository

Create a private Git repository for your team's database configurations.

Recommended Structure:

mage-db-sync-databases/
├── production.json
├── staging.json
└── custom-commands/
    └── project-name/
        ├── database.txt
        └── magerun2.txt

Step 2: Add Configuration Files

Add your database configuration files to the repository:

  • production.json - Production environment credentials
  • staging.json - Staging environment credentials
  • custom-commands/ - Project-specific command scripts (optional)

Important: Never commit this repository to public version control.


Step 3: Clone Repository Locally

Clone the private repository alongside your mage-db-sync installation:

cd ~/.mage-db-sync
git clone [email protected]:your-team/mage-db-sync-databases.git

Expected Directory Structure:

~/.mage-db-sync/
├── config/
│   └── databases/
└── mage-db-sync-databases/
    ├── production.json
    ├── staging.json
    └── custom-commands/

Step 4: Create Symlinks

Navigate to the databases configuration directory and create symlinks:

cd ~/.mage-db-sync/config/databases

Link Configuration Files:

ln -s ../../../mage-db-sync-databases/production.json production.json
ln -s ../../../mage-db-sync-databases/staging.json staging.json
ln -s ../../../mage-db-sync-databases/custom-commands custom-commands

Verify Symlinks:

ls -la

You should see symlinks pointing to your private repository files.


Benefits

Version Control

  • Track configuration changes over time
  • Review updates before applying
  • Revert to previous configurations easily

Team Synchronization

  • All team members use identical configurations
  • Updates propagate automatically via git pull
  • Reduces configuration-related issues

Security

  • Credentials stored in private repository only
  • No sensitive data in public repositories
  • Centralized access control

Maintenance

  • Update configurations in one place
  • Changes available to entire team
  • Simplified onboarding for new developers

Team Workflow

Initial Setup (New Team Member)

# Clone the private configuration repository
cd ~/.mage-db-sync
git clone [email protected]:your-team/mage-db-sync-databases.git

# Create symlinks
cd config/databases
ln -s ../../../mage-db-sync-databases/production.json production.json
ln -s ../../../mage-db-sync-databases/staging.json staging.json
ln -s ../../../mage-db-sync-databases/custom-commands custom-commands

Updating Configurations

# Pull latest configurations
cd ~/.mage-db-sync/mage-db-sync-databases
git pull origin main

# Changes are immediately available via symlinks

Adding New Databases

# Edit configuration in the repository
cd ~/.mage-db-sync/mage-db-sync-databases
nano production.json

# Commit and push changes
git add production.json
git commit -m "Add new production database configuration"
git push origin main

# Team members pull updates
git pull origin main

Best Practices

Repository Management

  • Use descriptive commit messages for configuration changes
  • Review changes before committing credentials
  • Implement branch protection for production configurations
  • Regular audits of access permissions

Security

  • Restrict repository access to authorized team members only
  • Use SSH keys for authentication
  • Consider encrypting sensitive values with tools like git-crypt
  • Never commit SSH private keys to the repository

Documentation

  • Include README with setup instructions in repository
  • Document any project-specific configuration requirements
  • Maintain changelog of significant configuration updates

Testing

  • Test configuration changes in staging first
  • Verify symlinks after repository updates
  • Validate credentials before committing

Troubleshooting

Symlink Not Working

# Remove broken symlink
rm production.json

# Recreate with correct path
ln -s ../../../mage-db-sync-databases/production.json production.json

Permission Issues

# Check repository permissions
ls -la ~/.mage-db-sync/mage-db-sync-databases/

# Ensure files are readable
chmod 644 ~/.mage-db-sync/mage-db-sync-databases/*.json

Repository Not Found

# Verify repository was cloned correctly
ls ~/.mage-db-sync/mage-db-sync-databases/

# If missing, clone again
cd ~/.mage-db-sync
git clone [email protected]:your-team/mage-db-sync-databases.git