EasyEngine / feature-requests

A repo to track all feature requests on EasyEngine project using issue tracker.
5 stars 2 forks source link

Create site sync/clone command #85

Open kirtangajjar opened 4 years ago

kirtangajjar commented 4 years ago

Create a command to sync 2 sites.

After implementing this feature, the site clone feature will also become really easy to implement.

Releated issues: https://github.com/EasyEngine/feature-requests/issues/22 https://github.com/EasyEngine/feature-requests/issues/43 https://github.com/EasyEngine/feature-requests/issues/54

kirtangajjar commented 4 years ago

I think the best syntax to have is a rsync-ish syntax. Then later we can add a flag in site create to mark a site as prod/dev so that a prod site is not accidentally overwritten.

To clone a site

ee site clone <src> <dest>

-- pull --

# will clone rtcamp.com from remote to local with same name
ee site clone root@rtcamp.aws.rstuff.in:rtcamp.com .            

# will clone rtcamp.com from remote to local in rtcamp.local
ee site clone root@rtcamp.aws.rstuff.in:rtcamp.com rtcamp.local 

-- push --

 # will clone rtcamp.com in local with same name
ee site clone . root@rtcamp.aws.rstuff.in:rtcamp.com        

# will clone rtcamp.com in local to rtcamp.local
ee site clone rtcamp.com root@rtcamp.aws.rstuff.in:rtcamp.dev 

-- alternate syntax --

ee site clone --push <command>
ee site clone --pull <command>

ee site push <command>
ee site pull <command>

To sync a site, syntax could be same, but with additional parameters - --skip-db, --skip-files, --skip-uploads(for wp) cc @rahul286

rahul286 commented 4 years ago

@kirtangajjar can you include syntax for local? More like symlink mode that @mrrobot47 is experimenting for shallow copies to create per branch on same server for rtcamp.com a few client projects.

rahul286 commented 4 years ago

rsync

This gives me an idea!

Maybe we can create ee sync as an underlying command which works like rsync. It can have a flag e.g. --create which basically tells EE that if dest site doesn't exist. Create it!

Then we can add a syntactic sugar where ee cloneee sync --create 🤔

I somehow feel if we handle data transfer part well, then ee sync may act as a base for backup/restore where dest rather than being EE server, could be s3/Google Drive or ftp or any other storage supported by say duplicity.

We better try to standardize flags such as --skip-db, --skip-files, --skip-uploads etc

kirtangajjar commented 4 years ago

To implement this feature, we need to determine the correct site create parameters for all site types. We cannot keep this logic in site-command because it will create a cyclic dependency to site-type-php/wp. So I think it's best to keep create a separate package for it.

cc @mrrobot47

Update: After our discussion, it seems that it's fine to keep it in a single package for now since there isn't any code-based dependency in it. Will separate it in future if it seems necessary.

kirtangajjar commented 4 years ago

Hello folks, there are a few updates over here.

Handling SSL

SSH params

We will be adding support for additional parameters for SSH which users will be able to specify these will also be used in rsync.

rahul286 commented 4 years ago

Few ideas:

  1. whenever possible use source setting
  2. Make le as default (should work in multi-env as all new sites are created under same top-level domain)
  3. Feel free to disable SSL if not needed e.g. localhost

Overall, ask fewer questions to the user.