Shared Cluster Hosting Command Line Sync Tools

Advomatic has created several command line tools to assist you in moving your data efficiently between your staging server and the Shared Cluster webservers.

Note: These commands can only be used for servers within the Advomatic network.

Site_Sync

The site_sync utility is a command line tool used to move files from your staging server to all of the webservers in the Shared Cluster.

This is a very powerful tool, and it is possible to overwrite your entire site. Please use it with caution. If you have any questions, email support@advomatic.com prior to using this utility.

Usage

$ site_sync folder_or_file_to_be_synced

The file or folder is relative to the webroot -- usually this is ~/domains/CLIENT.advomatic.com/www, but the actual webroot may vary based upon custom configuration.

Example

$ site_sync sites/all/modules/

This will push your ~/domains/CLIENT.advomatic.com/www/sites/all/modules/ directory and everything underneath it, to the Shared Cluster production servers. Note the trailing slash '/'

$ site_sync sites/all/testfile.txt

This will push your ~/domains/CLIENT.advomatic.com/www/sites/all/testfile.txt file to the Shared Cluster production servers.

Notes

- This utility supports the '-d' flag to specify which domain you wish to use, in the event you are set up with multiple domains in ~/domains/. If you fail to specify '-d' and it is required, no changes will be made, and an error will be displayed.
- The destination is always relative to the web root (most likely ~/domains/CLIENT.advomatic.com/www/). This means that even if you are in a deeper directory and you do a '$ site_sync testfile.txt'
you will sync ~/domains/CLIENT.advomatic.com/www/testfile.txt.
- To protect user uploaded data already on the Shared Cluster production servers, the Drupal 'files' directory in the webroot is excluded by this tool. Please see the utility 'files_sync' below.
- Please use caution when synching a directory that is frequently changing (i.e. a theme directory). You may inadvertently push something to the Shared Cluster production servers that is not production ready.

DB_Sync

The db_sync utility is a command line tool used to copy a database from either your staging server to the Shared Cluster production database servers or from the production database servers to your staging server.

No matter which direction you are copying the database, it is important to understand that this is a destructive command: in copying a database from one server to another, it will overwrite the data on the destination server. There is no mechanism to reverse an incorrect db_sync command short of a restoration of your database from a backup.

Please use this command with care.

NOTE: THIS COMMAND HAS CHANGED. PLEASE USE THE '--help' FLAG TO SEE THE NEW SYNTAX!

Usage

$ db_sync source destination

The 'destination' will be overwritten with the 'source'.

Example

This will copy your staging database to the Shared Cluster production database:

$ db_sync YOURSITE.advomatic.com YOURSITE.com

This will copy the Shared Cluster production database to your staging server:

$ db_sync YOURSITE.com YOURSITE.advomatic.com

Notes

- This utility supports the '-d' flag to specify which domain you wish to use, in the event you are set up with multiple domains in ~/domains/. If you fail to specify '-d' and it is required, no changes will be made, and an error will be displayed.
- This utility will not work if $db_url is an array (i.e. a site accesses multiple databases via db_set_active()). In this case you will need to do a manual mysqldump and restore. Email support@advomatic.com for further instructions.
- This utility will leave a backup copy of each database in your home directory, just in case you need to undo your actions. Keep in mind that "undo" is a manual mysql restore. Email support@advomatic.com for further instructions.

Files_Sync

The files_sync utility is a command line tool used to copy contents of the Drupal 'files' directory from the development server to the Shared Cluster production servers and vice versa. Once the file transfer is complete, permissions are changed on the Shared Cluster production servers, making those items owned by the user www-data.

Usage

$ files_sync -p2s testfile.txt

The destination will be overwritten with the source.

Example

This will copy the 'testfile.txt' from the production 'files' directory to your staging server's 'files' directory using the '--production-to-staging' (-p2s) flag.

$ files_sync -p2s testfile.txt

This will copy the 'testfile.txt' from your staging server's 'files' directory to the production 'files' directory using the '--staging-to-production' (-s2p) flag.

$ files_sync -s2p testfile.txt

Notes

- This utility supports the '-d' flag to specify which domain you wish to use, in the event you are set up with multiple domains in ~/domains/. If you fail to specify '-d' and it is required, no changes will be made, and an error will be displayed.
- This utility, by design, manipulates files that are in use on the Shared Cluster production servers. In order to make this magic occur, a read/write mount of the production files directory is set up on the staging server as 'production_files'. Directly manipulating those files runs the risk of a permissions mismatch, potentially causing a production site failure.

Contact Us