Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Workflow with SVN and customizing magento
 
woodmage
Jr. Member
 
Total Posts:  10
Joined:  2008-05-14
 

Getting ready to setup a base Magento store.  Will be doing multiple modifications to the code so would like to keep that separate and leave Magento upgradeable to new versions without overwriting custom code.

I have read the article by Mark_Kimsal ( http://www.magentocommerce.com/wiki/groups/174/changing_and_customizing_magento_code ) on merging the new versions into the vendor branch.

My questions are

1. This is not a subversion layout that I am familiar with.  I usually make my live sites another working copy and just do an svn update to promote new code to the live site (all changes pretty much go to the trunk, with an occasional branch for major functionality changes that get merged back into trunk).

How would changes be promoted to the production site while using the methods described in the article above to handle upgrades.  Can you make it a working copy?  Do you use rsync?  Any insight into how everybody is doing this with success would be appreciated.  Is the src directory have the full subversion install?  What about media, cache and config files.

2. If intending to use subversion to handle new versions and updates, what is the best method to do the initial install?  I would assume it would be to start with an svn checkout of the latest version, but unless I figure out #1 above, I am not sure how to make this work easily.

Thanks in advance

 
Magento Community Magento Community
Magento Community
Magento Community
 
salsasepp
Member
 
Avatar
Total Posts:  32
Joined:  2008-03-21
Saarlouis, Germany
 

I am using the vendor branches workflow with subversion, for the same reason as you intend to (fixing bugs and adding functionality). If that was not the case, I’d just copy new magento versions over my trunk.

The vendor branches do not conflict at all with your method of checking out a live site as a working copy. Whenever we have a new magento source drop, we import that into a branch, merge that into the trunk of our working copy, resolve conflicts, test, commit and we’re ready to deploy elsewhere. Just make sure you have a backup copy of your repository before running the svn_load_dirs.pl script; one typo will haunt you forever (the script makes commits).

I have the media and var folders checked in (but nothing beneath). app/etc/local.xml is not checked in.

My personal taste is not to use subversion on the live system, two reasons:
- I would have to access my repo from there (configure VPN or open the company firewall for ssh)
- I rather use some scripting and rsync to exclude unnecessary files (also the .svn folders), do css/js compression, set filesystem permissions etc

I originally started with the ZIP download of magento-0.9 and used svn import, if I remember correctly.

Cheers,
Stefan.

 
Magento Community Magento Community
Magento Community
Magento Community
 
woodmage
Jr. Member
 
Total Posts:  10
Joined:  2008-05-14
 

Thanks for the reply, that is very helpful.

Do you have a list of magento files/folders that you exclude from the rsync, or even a paste of the script you use?  This is my first magento install, so I have not yet quite figured out what should and shouldn’t be messed with.

Thanks again,

Greg

 
Magento Community Magento Community
Magento Community
Magento Community
 
salsasepp
Member
 
Avatar
Total Posts:  32
Joined:  2008-03-21
Saarlouis, Germany
 

Greg,

can’t really share much, but here’s what I can do (running Linux, simple sh script without fancy stuff):

#! /bin/sh

# arg1: local path to sync from (root of magento tree)
# arg2: hostname of shop server to sync to

# This script is supposed to sync a testing environment to a shop webserver.
# 1. rsyncs all necessary files (and omits ballast)
# 2. sets correct permissions
# 3. clears cache (and sessions)
# 4. does not touch local.xml

USER=root
REMOTEPATH
=/var/www/magento

rsync \
--verbose \
--archive --compress \
--exclude=.svn\
--exclude=/app/etc/local.xml \
--exclude=/media/ --exclude=/var/ \
$1 $USER@$2:$REMOTEPATH

ssh $USER
@$2 chown -R www-data.shop $REMOTEPATH

ssh $USER
@$2 rm -rf $REMOTEPATH/var/*

This is very experimental. Things will NOT work until you have set up your local.xml and database. I standard-installed magento on my live system, saved my local.xml, then deleted everything, used the script to install to my changed code, replaced the local.xml and I was up. Database updates (if any) will happen automatically as soon as the first page is called up.

Additional excludes (consider carefully):
- if you don’t use Magento Connect on your live system: --exclude=/downloader/
- if your live system doesn’t need the admin interface: --exclude=/app/design/adminhtml/ (and even more code under app/code/core)

Known issues:
- Syncs more than is necessary
- Kills active sessions (not nice)
- May also overwrite files whose importance eludes me up to now (app/etc/config.xml?)
- Needs to fix permissions on some files, e.g. local.xml may have been created with 644 permissions depending on your umask, which may be a security risk if you have other users on your machine (local.xml contains the encryption key used for customer data)
- What about the ‘report’ folder?

If you’re just getting started, you may want to wait a bit until you invite complications by using the above. Anyway, I’d by happy to help.

Stefan.

 
Magento Community Magento Community
Magento Community
Magento Community
 
dgmsolutions
Jr. Member
 
Total Posts:  8
Joined:  2008-06-19
 

Hi all, I develop offline on my windows machine on a xampp stack.  I just know my way around windows much better than linux.  Wouldn’t a tool like Beyond Compare do everything one needs to handle the merging of updates into live sites effectively?  I guess I’m looking for the best way to handle updates from the start and not lose any changes.  I also don’t want to have to spend the entire weekend on an update like I did using Oscommerce. No expert on this topic so thought I would ask.  Any advice appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top