Deployment with ExpressionEngine
-
Upload
green-egg-media -
Category
Technology
-
view
593 -
download
1
description
Transcript of Deployment with ExpressionEngine
Deploymentwith ExpressionEngine
@BostonEErs
November 16, 2010
Roadmap
1. Vanilla Migration - Step by Step
2. Making Deployment Easier - Tools and Methods
3. Alternative DeploymentMethods
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.
The Players
The Database Staging Server
Local Environment
Production Server
Mystery Element??
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.
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.
Migrating Step by Step
Step 1: Backup
Back up the files and the database.
Don't not do this.
Step 2: Sync Templates
This is very easy to do on EE2.1
EE Templates
Is the template saved as a file?
Yes
Notes
Get all data for the template out of the database.
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/
Step 3: Export DB
Take note of Database collation. Changing the DB collation might break your site entirely.
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.
Step 4: Create a New Database
Only necessary if moving databases.
Import SQL file and verify that collation is the same.
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.
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.
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)
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
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.
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.
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.
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.
Step 11: Load Your Site
It either works or it doesn't or something in-between.
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)
Making DeploymentEasierCool Tools You Gotta Use If You Wanna Stay in School
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/
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/
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/
EE Deployment Accessory
List (with links where applicable) and helpful resources.
Available at on the GEM blog www.greeneggmedia.com/blog
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
Making DeploymentEasierMethods
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/
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.
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
Alternative DeploymentMethods
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.
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.)
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.
Resources, links, and more stuff can be found at:
http://www.greeneggmedia.com/deployment