unionco / craft-sync-db

MIT License
10 stars 1 forks source link

Unclear docs #2

Closed Jones-S closed 5 years ago

Jones-S commented 5 years ago

Hi there

I would really like to use your plugin but the docs are a bit confusing. First I think some prefilled settings in the config yaml would be very helpful. I now have this:

syncdb.yaml

skipTables: []
environments:
  -
    name: local DB
    username: root
    host: localhost
    root: /
    backupDirectory: /my/craft/root/path/storage/backups/databases/
    port: 22
    phpPath: /usr/local/php5/bin/php
    dbDumpClientPath: /Applications/MAMP/Library/bin/mysqldump  # Use pg_dump for Postgres
    environment: dev

But I guess I now have to add my remote db as well. But also where do I set the passwords to make these ssh connections?

And what is happening if I run the sync button in my CP? I guess it should somehow copy a db dump from the chosen environment. And then? Will your plugin somehow import this dump into my local db?

Also the docs on the plugin site in the store are deprecated (config is still a php file etc.) If you help me getting this to work I could do a fork and a PR to update some Readme stuff ...

Cheers

colin-oos commented 5 years ago

+1

colin-oos commented 5 years ago

I concur that better documentation is needed. I'm having issues setting it up too.

But also where do I set the passwords to make these ssh connections?

I assume you need to use an ssh key pair for authentication between servers

abryrath commented 5 years ago

@Jones-S @colin-oos I just updated the docs: https://unionco.github.io/craft-plugin-docs/craft-sync-db/

The relevant updated parts are: Overview:

The plugin works by setting up an SSH session to your configured remote servers. Once connected to the server, it uses that environment's .env file to determine the database configuration.

Requirements

Ability to connect to remote servers via SSH using SSH

Configuration

Only remote servers (production, staging, etc) should be configured in the configuration file. The local environment is determined by your .env file.

To connect to remote server, you should add your SSH public key to the server so no password is needed to authenticate. The ssh-copy-id utility makes this simple:

ssh-copy-id <user>@<host>

Please let me know if the documentation is still unclear or could be improved.