70kft / craft-golive

Deploy changes from staging to production with the push of a button
78 stars 2 forks source link

Go Live plugin for Craft

Go Live makes moving changes from staging to production as easy as pressing a button!

Go Live gif

Installation

To install Go Live, copy the golive/ folder into craft/plugins/, and then go to Settings › Plugins and click the Install button next to "Go Live".

Configuration

When you first install Go Live, you'll be shown a brief introduction that explains how Go Live does its thing. After closing the introductory wizard, you'll be looking at the Encryption Key page.

Environment Variables

goLive_encryptionKey

'goLive_encryptionKey' => ''

Sets the encryption key used to encrypt and decrypt passwords. You'll get lots of warnings if this is not set.

goLive_enabled

'goLive_enabled' => true

If set to false, hides all of the plugin's UI in the Craft CP. This can be useful in environments that share the same database as staging, but from which you do not want to perform deployments. Also useful to avoid deploying production to production, which would presumably break the universe.

Encryption Key

Because Go Live stores the SSH and MySQL passwords to your production server, it is critical that you set a unique, secret encryption key to protect those passwords. The Encryption Key tab will generate a random encryption key every time you refresh the page. Copy one of the encryption keys shown and add it to general.php as an environment variable named goLive_encryptionKey, similar to the example below:

'environmentVariables' => array(
    'goLive_encryptionKey' => '(your encryption key here)'
)

This encryption key must be exactly 32 bytes, Base64-encoded. Because of this requirement, it's probably best to use the built-in key generator.

Credentials

Go Live uses SSH to access your local and remote servers and run the various commands needed to deploy a Craft site from staging to production. You'll need to provide SSH credentials for the local and remote servers, and SSH credentials for the remote server.

All actions will be performed using these credentials, so keep permissions in mind if you want Go Live to be able modify files on the remote server.

Settings

The Go Live process always follows this basic pattern:

  1. Run some optional console commands on the local server.
  2. Dump the staging database.
  3. Copy the database dump file to your production server via SFTP.
  4. Import the database dump file to your production MySQL database.
  5. Run some optional console commands on the remote server.

1: Before Backup

2: Backup Staging Database

3: Copy Backup to Production

4: Import Backup to Production

5: After Import