Skip to main content

Setup an existing website

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

Essentially, you can use this if you need to start work on an existing website and want to quickly setup a new local version with an up-to-date copy of the remote database.

Usage

First you need to clone the website's Git repository to your development machine in the normal way. You will also need to add the usual local config for your hostname, DB details, etc. and run composer install.

Then, before actually loading the website in your browser, add the config documented below and run the following command:

wp eighteen73 first-sync

Config

Nebula/Bedrock websites

note

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

via development.php

Because this doesn't store any sensitive login credentials it may be beneficial to add sync configuration to the environment config and commit to your repo for the benefit of other developers working on the project.

/config/environments/development.php
// Required
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' );

via .env

If you would rather not share your config, or you need to override the shared configuration added above, you can add this to you personal .env file.

/.env
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

Older/basic 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.

/wp-config.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' );