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

查看:28
本文介绍了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 tarball (v.1.3.2.4) 导入到我的主干/magento 存储库中.
  5. 创建了两个数据库mysite_live 和 b.mysite_dev.
  6. 从我的 repo 中检出 magento 代码到 ~/public_html/dev/(dev.mysite.com)
  7. 运行初始 Magento 安装程序,它填充了我的 mysite_dev Db 并创建了一些配置文件(app/etc/local.xml 是我所知道的唯一一个 - 可能还有其他的?).

这就是我被卡住的地方:

所以我的开发空间中有一个功能齐全的 Magento 安装.我现在想要做的是让我的实时站点部署与我的开发站点相同,作为起点.因为app/etc/local.xml文件中的config不同;加上 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?

此时我只是不知道如何进行,也不愿意做出任何猜测,以防它导致在不久的将来不得不清除所有内容并重新开始.

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!

推荐答案

首先要做的是检查已安装的程序版本.这样,repo 中的程序副本就是您可以实际使用的工作副本.然后您将需要忽略一些文件和目录,以便您可以运行其他环境.local.xml 是一个很好的例子,但也设置了忽略以下内容:

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 用户 -p 数据库 >mysqldump.sql

您必须输入该密码.现在 repo 中的副本是站点的完整副本.要设置另一个环境,您将检查整个代码库,然后将 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.

最后,尝试对站点的开发副本进行所有更改,因为这将有助于保持数据库同步.如果您对 Live Copy 进行了更改,但至少没有在 dev 中反映它们,您可能会在稍后不小心用其中一个转储覆盖它们,然后想知道您的功能去了哪里.

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 &amp;Subversion (SVN) - 开始开发环境?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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