Skip to content

first-sync : Setup an existing website

The regular sync command cannot be run without a local copy of WordPress to bootstrap a website, so this is a special version of that command which can be run before there's a local working database.

Essentially, this command quickly sets up a new local copy of an existing website with an up-to-date database.

Usage

First you need to clone the website's Git repository to your development machine. Then add the usual local config for your hostname, DB details, and then run composer install.

Before load the website in your browser, add the config documented below and run the following command:

bash
wp eighteen73 first-sync

Config

INFO

This same configuration is shared by the first-sync and sync so adding it once covers both commands.

Nebula/Bedrock websites

This config does not store any especially sensitive login credentials so it may be beneficial to add configuration to config/environments/development.php and commit to your repo for the benefit of other developers working on the project.

If you would rather not share your config, or you need to override any committed shared configuration, you can also add it to you personal .env file.

php
Config::define( 'EIGHTEEN73_SSH_HOST', 'website.example.com' );
Config::define( 'EIGHTEEN73_SSH_USER', 'username' );
Config::define( 'EIGHTEEN73_SSH_PATH', '/path/to/remote/website' );

// Optional, if the SSH port is not 22
Config::define( 'EIGHTEEN73_SSH_PORT', 123 );

// Optional, to automatically activate/deactivate plugins on sync
Config::define( 'EIGHTEEN73_SYNC_ACTIVATE_PLUGINS', 'plugin1,plugin2' );
Config::define( 'EIGHTEEN73_SYNC_DEACTIVATE_PLUGINS', 'plugin3' );
dotenv
EIGHTEEN73_SSH_HOST=website.example.com
EIGHTEEN73_SSH_USER=username
EIGHTEEN73_SSH_PATH=/path/to/remote/website

# Optional, if the SSH port is not 22
EIGHTEEN73_SSH_PORT=123

# Optional, to automatically activate/deactivate plugins on sync
EIGHTEEN73_SYNC_ACTIVATE_PLUGINS=plugin1,plugin2
EIGHTEEN73_SYNC_DEACTIVATE_PLUGINS=plugin3

Default WordPress

On websites without the above files, you will need to add config to the website's wp-config.php file. This is only for use on non-Nebula/Bedrock websites.

php
define( 'EIGHTEEN73_SSH_HOST', 'website.example.com' );
define( 'EIGHTEEN73_SSH_USER', 'username' );
define( 'EIGHTEEN73_SSH_PATH', '/path/to/remote/website' );

// Optional, if the SSH port is not 22
define( 'EIGHTEEN73_SSH_PORT', '123' );

// Optional, to automatically activate/deactivate plugins on sync
define( 'EIGHTEEN73_SYNC_ACTIVATE_PLUGINS', 'plugin1,plugin2' );
define( 'EIGHTEEN73_SYNC_DEACTIVATE_PLUGINS', 'plugin3' );