Skip to content

Latest commit

 

History

History
105 lines (70 loc) · 3.03 KB

USAGE-SYNC.md

File metadata and controls

105 lines (70 loc) · 3.03 KB

<-- Back to main section

Usage ct sync:...

Init and configuration of sync

With the sync commands you can update your local development installation to the current state of your server installations. Currently filesync (rsync) and database fetching is supported.

First you need to create a clisync.yml in your project directory, the CliTools will provide your an example of this file by using following command:

ct sync:init

If you need special SSH settings (ports, compression, identify...) please use your ~/.ssh/config file to such settings.

You can commit this clisync.yml into your project so other developers can use the sync feature, too.

Synchronisation with servers (ct sync:server)

The synchronisation with your servers is one way only, it just syncs your server installation to your local installation (CliTools are no deployment tools!).

In the clisync.yml you can specify multiple servers.

Now you can sync your production server to your local installation:

# Full sync (files and database, with interactive context selection)
ct sync:server

# Only MySQL (from production context, without interactive context selection)
ct sync:server production --mysql

# Only Files (from production context, without interactive context selection)
ct sync:server production --rsync

Project sharing (ct sync:backup and ct sync:restore)

The sharing can be used to share files (assets) and databases between developers. Please use a common development/storage server with ssh access for each developer for this feature.

# Make backup of current state and transfer to share server
ct sync:backup

# ... only MySQL
ct sync:backup --mysql

# ... only files
ct sync:backup --rsync

# Restore to state from the share server
ct sync:restore

# ... only MySQL
ct sync:restore --mysql

# ... only files
ct sync:restore --rsync

Lightweight deployment (ct sync:deploy)

With sync:deploy you can push your files to your production servers. Please keep in mind that this feature is just an wrapped rsync and should only be the simplest solution for deployment. For more advanced or centralized deployemnt try solutions build on Jenkis, Ansible and others.

# Push your project to your servers (with interactive context selection)
ct sync:deploy

# Push your project to your staging server (without interactive context selection)
ct sync:deploy staging

Advanced ssh options

If you need some advaned ssh options (eg. other ports) use your ~/.ssh/config configuration file:

Host project-server
    Hostname project-server.example.com
    Port     12345
    User     root

If you have a proxy server you can configure it like this:

Host ssh-proxy
    Hostname ssh-proxy.example.com
    User foo

Host project-server
    Hostname project-server.example.com
    Port     12345
    User     root
    ProxyCommand ssh ssh-proxy -W %h:%p

Now you can use project-server as ssh-hostname and your settings will automatically used from your ~/.ssh/config.