deployment with expressionengine

39
Deployment with ExpressionEngine @BostonEErs November 16, 2010

Upload: green-egg-media

Post on 27-Jun-2015

593 views

Category:

Technology


1 download

DESCRIPTION

An overview of deployment methods and procedures for ExpressionEngine 1 and 2. Originally from the November 15th BostonEErs meeting.

TRANSCRIPT

Page 1: Deployment with ExpressionEngine

Deploymentwith ExpressionEngine

@BostonEErs

November 16, 2010

Page 2: Deployment with ExpressionEngine

Roadmap

1. Vanilla Migration - Step by Step

2. Making Deployment Easier - Tools and Methods

3. Alternative DeploymentMethods

Page 3: Deployment with ExpressionEngine

The Two Faces of EE

The Database The Files

- Could be locally hosted, already on the server, or on another server.

- Contains most data that is fed into ExpressionEngine.

- Locally hosted or on another server.

- Contains ExpressionEngine plus any addons and their themes.

- Contains templates (if you are saving templates as files).

- Contains hard-coded EE config files.

Page 4: Deployment with ExpressionEngine

The Players

The Database Staging Server

Local Environment

Production Server

Mystery Element??

Page 5: Deployment with ExpressionEngine

Your Setup

Staging Server? No staging server?

One developer or a team of developers?

What your setup is depends on your organizational needs, your client's needs, and what is overkill.

Page 6: Deployment with ExpressionEngine

BeforehandHave an EE migration checklist handy.

Make sure the new server can handle ExpressionEngine.

Make sure you have enough time (no meetings in 15 minutes).

Make sure you have a backup plan if it hits the fan.

Page 7: Deployment with ExpressionEngine

Migrating Step by Step

Page 8: Deployment with ExpressionEngine

Step 1: Backup

Back up the files and the database.

Don't not do this.

Page 9: Deployment with ExpressionEngine

Step 2: Sync Templates

This is very easy to do on EE2.1

Page 10: Deployment with ExpressionEngine

EE Templates

Is the template saved as a file?

Yes

Notes

Get all data for the template out of the database.

Page 11: Deployment with ExpressionEngine

Step 2: Sync Templates

No native tool in EE1.x

Alternatives: Manual, third-party solutions.

DC Template Manager (Free)

"Saves the content of the template files (saved in the file-system) back to the database."http://devot-ee.com/add-ons/dc-template-manager/

Page 12: Deployment with ExpressionEngine

Step 3: Export DB

Take note of Database collation. Changing the DB collation might break your site entirely.

Page 13: Deployment with ExpressionEngine

Database CollationsNotes

"Set of rules for comparing characters in a character set".

Defines the relationship of the character encoding to the actual characters.

Default is latin1_swedish_ci, because the developers of MySQL are Swedish.

Collations are needed for MySQL to perform logic - such as ordering rows by strings in columns in different languages.

ExpressionEngine will, by default, create databases with utf8 character sets and utf8_general_ci collations.

Page 14: Deployment with ExpressionEngine

Step 4: Create a New Database

Only necessary if moving databases.

Import SQL file and verify that collation is the same.

Page 15: Deployment with ExpressionEngine

Step 5: Migrate File System

Don't delete existing data on the server.

Use an archive (tar or zip) if your host allows it.

& Set Permissions

Confirm and set file permissions as necessary.

Page 16: Deployment with ExpressionEngine

File Permissions

/system/expressionengine/config/config.php/system/expressionengine/config/database.php

666 (or equivalent)

/system/expressionengine/cache//images/avatars/uploads//images/captchas//images/member_photos//images/pm_attachments//images/signature_attachments//images/uploads/

777 (or equivalent)

Set applicable permissions for your template directory.

Check to see if add-ons have file permission needs.

Don't forget ALL the file's need correct permissions.

Page 17: Deployment with ExpressionEngine

File Permissions

/path.php/system/config.php/system/config_bak.php

666 (or equivalent)

/images/avatars/uploads//images/captchas//images/member_photos//images/pm_attachments//images/signature_attachments//images/uploads//system/cache/

777 (or equivalent)

Page 18: Deployment with ExpressionEngine

Step 6: Update Hardcoded Configs

Update configs in the file system for the database and basic configs.

/system/expressionengine/config/database.php/system/expressionengine/config/config.php

You can update the config.php values in the Admin > System Administration > Config Editor in EE2.

/system/config.php/path.php

Page 19: Deployment with ExpressionEngine

Step 7: Change Path Variables

EE likes to keep the server path in different places. You'll need to update those.

Find your server path using the Tools > Utilities > PHP Info tool. Your server path should be the _SERVER['DOMAIN_PATH'] variable.

Page 20: Deployment with ExpressionEngine

Step 8: Update Additional Paths

Look for paths in JS, CSS, add-on paths, etc.

Remember hard-coded paths in templates. You can batch-remove these with search and replace in EE2.

Page 21: Deployment with ExpressionEngine

Step 9: Verify You Can Sync Templates

Use the EE2 Sync tool to make sure that you can synchronize your EE2 templates.

All your template data in the database should be up to date at this point in the move, and you can re-create the directory if there are read/write issues.

Page 22: Deployment with ExpressionEngine

Step 10: Clear Your Cache

Just do it. For fun.

Step 11: Verify Your .htaccess

.htaccess files tend to get lost in moves. You may need to re-create it or modify it for a different server setup.

Page 23: Deployment with ExpressionEngine

Step 11: Load Your Site

It either works or it doesn't or something in-between.

Page 24: Deployment with ExpressionEngine

Contingency PlansPut up old site and start steps from #1.

If you can access the CP, turn off the site and start searching on the forums.

Check file permissions for files in general.

Turn on debugging index.php for PHP errors (EE2) or set error_reporting to 'E_ALL' in index.php (EE1)

Page 25: Deployment with ExpressionEngine

Making DeploymentEasierCool Tools You Gotta Use If You Wanna Stay in School

Page 26: Deployment with ExpressionEngine

DC Template Manager

"...DC Template Manager offers a convenient way of moving the contents of many templates between the database and the filesystem simultaneously."

Freehttp://devot-ee.com/add-ons/dc-template-manager/

Page 27: Deployment with ExpressionEngine

Deeploy Helper

"...collects many of the configuration parameters we most frequently modify on one page, where power users can modify them all at once with search and replace."

$9http://devot-ee.com/add-ons/deeploy-helper/

Page 28: Deployment with ExpressionEngine

Reelocate

"ExpressionEngine stores your website URL and Server Path in a ridiculous number of places. REElocate helps you update these in one simple step."

Freehttp://devot-ee.com/add-ons/reelocate/

Page 29: Deployment with ExpressionEngine

EE Deployment Accessory

List (with links where applicable) and helpful resources.

Available at on the GEM blog www.greeneggmedia.com/blog

Page 30: Deployment with ExpressionEngine

Sparrow

"Sparrow is the ultimate deployment tool. Its premise is simple: make deployment insanely easy. It's powerful, flexible, and brilliantly clever. It tracks your site's changes and pushes them out to servers. It works perfectly with version control systems. It's the best solution to this problem. Want to find out more? Visit http://getsparkplugs.com/sparrow/ to register your interest."

- Jamie Rumbelow

Page 31: Deployment with ExpressionEngine

Making DeploymentEasierMethods

Page 32: Deployment with ExpressionEngine

Erskine Design's Modified EE Setup

Talk from EECI2010 on modifying ExpressionEngine 1 for efficiency.

config.php loads different config file based on server IP.

Takes advantage of EE's hard-coded configuration option.

Code available at:

http://eeinsider.com/blog/eeci-2010-how-erskine-rolls-with-ee/

Page 33: Deployment with ExpressionEngine

EE Config HandlingNotes

system/core.prefs.php handles preferences.

Preferences stored in database in serialized arrays.

Core Prefs saves config.php data, reads the preferences out of the database, and then overwrites those with config.php items if available.

Config.php's $conf array can be populated with any viable config and it will override the database version. Config.php can also be extended over several files provided the $conf array is present, which is what Erskine is doing.

Page 34: Deployment with ExpressionEngine

Configs are in expressionengine/config/config.php in a $config array.

Preferences stored in database using base64 encoding.

EE_Config saves config.php data, reads the preferences out of the database, and then overwrites those with config.php items if available.

Config.php's $config array can be populated with any viable config and it will override the database version. Config.php can also be extended in the same way as EE1.

EE Config HandlingNotes

Page 35: Deployment with ExpressionEngine

Alternative DeploymentMethods

Page 36: Deployment with ExpressionEngine

Partial DeploymentNot every deployment includes the entire site.

Example: Making updates on a local environment and updating those on the live site.

Methods include live development on hidden pages, manual uploading, and versioning.

Page 37: Deployment with ExpressionEngine

Using Git with EEGit is a versioning system that keeps track of changes to files.

Git can be used to collaboratively work on EE sites (mainly using template and theme files).

Can be set up to ignore EE files you never alter.

If you have SSH access to your server, you can deploy with Git commands or automatically with Capistrano or with a paid solution like Beanstalk

Caveat: does not track database changes. (Channels, entries, etc.)

Page 38: Deployment with ExpressionEngine

Ryan Masuga gave a fantastic talk at EECI2010 EuroWorld which can be found at:

http://gititon.masugadesign.com/

"Goal is to not edit anything in the CP, ever"

The elephant in the room is the database. No clear solution at this point.

Page 39: Deployment with ExpressionEngine

Resources, links, and more stuff can be found at:

http://www.greeneggmedia.com/deployment