Magento& Subversion(SVN)-开始开发环境? [英] Magento & Subversion (SVN) - Getting a Development Environment Started?

查看:53
本文介绍了Magento& Subversion(SVN)-开始开发环境?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建Magento网站,这是迄今为止我使用过的最庞大的软件包.我决定设置适当的开发服务器,并将Subversion用于版本控制.我遇到了一些障碍,需要一些帮助.

I'm working on building a Magento site, and it's by far the most mammoth package I've ever worked with. I've decided to set up a proper development server and use Subversion for version control. I'm running in to a couple roadblocks and need some help.

到目前为止我所做的:

  1. 在使用cPanel的主机上设置虚拟主机.我的实时"网站(mysite.com)将位于〜/public_html/.
  2. 创建了一个指向〜/public_html/dev/"的开发"子域(dev.mysite.com).
  3. 在〜/svn/中启动了SVN存储库.我的回购包含文件夹分支|标签|树干.
  4. 在主干/magento的回购库中导入了一个刚装过的未损坏的magento tarball(1.3.2.4版).
  5. 创建了两个数据库mysite_live和b. mysite_dev.
  6. 从我的仓库中检出magento代码到〜/public_html/dev/(dev.mysite.com)
  7. 运行最初的Magento安装程序,该安装程序填充了mysite_dev Db并创建了一些配置文件(app/etc/local.xml是我所知道的唯一文件-可能还有其他文件吗?).

这是我被困住的地方:

因此,我在开发空间中安装了功能齐全的Magento安装程序.我现在想做的是,以与开发站点相同的方式部署实时站点.由于app/etc/local.xml文件中的配置不同;再加上Magento将{{base_url}}的值存储在数据库中,这不像从我的开发站点更新我的svn干线,然后导出/导入数据库那样简单.

So I've got a fully functional Magento Install in my dev space. What I want to do now is get my live site deployed identical to my dev site, as a starting point. Because the config is different in the app/etc/local.xml file; plus Magento stores the value for {{base_url}} inside the database, it's not as easy as updating my svn trunk from my dev site, then exporting/importing the db.

随着这一步的深入,我希望有一条简单的途径,可以将开发站点上的所有内容通过SVN推送到我的实时站点,并保持数据库同步,除了{{的值base_url}}.我在其他地方读过一些论坛文章,这些文章使用svn:ignore进行引用以避免某些特定于环境的文件和目录,但是不知道如何在我的实时网站上进行设置并确保所有内容正确同步.

As I get further down the road with this, I want for there to be a straightforward path to push everything on my dev site through SVN and to my live site, along with keeping the databases synced except for the value of {{base_url}}. I've read a couple forum posts elsewhere that reference using svn:ignore to avoid certain environment-specific files and directories, but don't know how to get set up on my live site and ensure everything is properly synchronized.

我应该只是从仓库中检出主干/magentoo中基本代码的副本到我的活动站点的空间,然后运行安装程序,然后将svn设置为忽略local.xml,并假定它们相同,除了地方差异?

Should I just check out a copy of the base code from trunk/magentoo from my repo to my live site's space, then run an install, then set svn to ignore local.xml, and assume that they're identical except for local differences?

在这一点上,我只是不知道如何进行,因此不愿做任何猜测,以防万一将导致一切都消失wipe尽,并在不久的将来重新开始.

At this point I just don't know how to proceed, and am reluctant to make any guesses in case it'll result in having to wipe everything out and start over again in the near future.

作为旁注-我还需要为另一个子域创建代码的演示"分支;向人们展示概念证明.当我来到那座桥时,我可能会越过那座桥.也许到我完成这项任务时,这一切都说得通了.

As a side note - I also need to create a 'Demo' branch of the code for another subdomain; to show to people as proof-of-concept. I'll probably just cross that bridge when I come to it. Maybe it'll all make sense by the time I get to that task.

tl; dr版本-如何使用SVN管理Magento开发和实时代码以及Db?

感谢大家花时间阅读和回复!

Thanks to all for taking the time to read and reply!

推荐答案

首先要做的是检入程序的已安装版本.这样,您可以实际使用存储库中程序的副本.然后,您将需要忽略某些文件和目录,以便可以运行其他环境. local.xml是一个很好的例子,但在以下方面也设置了ignore:

First thing to do is check in the installed version of the program. That way, the copy of the program in the repo is a working one that you can actually use. Then you will need to ignore some files and directories so that you can run the other environments. local.xml is a good example, but also set ignore on the following:

/var/report/*
/var/log/exception.log
/var/log/system.log
/var/locks/*
/var/session/*
/var/cache/*
/var/tmp/*
/media/tmp/*

可能还有其他人,但这应该为您提供一个良好的开端.如果您认为可能会更改local.xml(并且可能),请将local.xml复制到local.xml.dist,然后将.dist版本检查到存储库中.当您结帐到其他站点时,您仍然必须手动进行更改,但更易于跟踪.

There are probably others but this should give you a good start. If you think that you might make changes to local.xml (and you might), copy local.xml to local.xml.dist and check the .dist version into the repo. When you checkout onto your other sites you will still have to make the changes manually, but it will be easier to track.

对于数据库,通常的做法是在开发环境上进行mysqldump并将其也保存在存储库中.

For the database, a common practice is to do a mysqldump on the dev environment and keep that in the repository as well.

mysqldump -u user -p database > mysqldump.sql

您必须输入该密码.现在,回购中的副本就是站点的完整副本.要设置其他环境,您需要检出整个代码库,然后将MySQL文件导入数据库.

You'll have to enter your password for that one. Now the copy in the repo is a complete copy of the site. To set up another environment, you'll check out the entire code base and then import the MySQL file into the database.

请记住,执行此操作时(以及每次在存储库中更新数据库,然后要更新其他环境上的更改时),都需要更改数据库中的{base_url}和{secure_url}.我已经看到了一些环境,开发人员可以在其中创建脚本来自动完成此任务.

Remember that when you do this (and any time you update the database in the repo and then want to update the changes on other environments) you will need to change the {base_url} and {secure_url} in the database. I've seen some environments where developers created scripts to accomplish this automatically.

最后,尝试对网站的开发副本进行所有更改,因为这将有助于使数据库保持同步.如果您在实时副本上进行更改而至少没有在开发中也反映出它们,则稍后可能会意外地用其中一个转储覆盖它们,然后想知道功能的去向.

Finally, try to make all changes to your dev copy of the site, as it will help keep your database in sync. If you make changes on the live copy without at least also reflecting them in dev, you will probably accidentally overwrite them later with one of the dumps and then wonder where your functionality went.

希望有帮助.如果您还有其他特定问题,请告诉我.

Hope that helps. If you have other specific questions, let me know.

谢谢, 乔

这篇关于Magento& Subversion(SVN)-开始开发环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆