配置兼容的开发和生产站点 [英] configuring compatible development and production sites

查看:91
本文介绍了配置兼容的开发和生产站点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发Magento网站. 我可以访问本地主机和远程主机,并且想 以某种方式配置开发和生产环境.在 远程主机,我还原了备份到数据库中的数据库数据. 本地主机,但是这样做时,我会覆盖主机的基本名称并 这会导致在以下情况下将网站重定向到不存在的URL: 页面已加载.我如何避免这种冲突:

I am developing a Magento site. I have access to a local host and a remote host and would like to somehow configure development and production environments. On the remote host I restore the database data that was backed up on the local host, but when I do so, I overwrite the host's base name and this causes the site to be redirected to a nonexistent URL when the page is loaded. How can I avoid this clash:

我希望能够在http://remotehost/foobardev上开发(a) 并将我的数据备份到http://remotehost/foobar或其他方式(b)开发 在http://localhost/foobar上部署,并在http://remotehost/foobar上部署.一世 想知道如何来回传输数据库数据而无需 覆盖在Magento管理面板->系统中找到的值 ->配置-> Web->不安全的基本URL/安全的基本URL 当我运行mysql并使用mysql命令源恢复时 在开发站点上找到的数据库条目到 生产现场.

I want to be able to develop either (a) on http:// remotehost/foobardev and back up my data to http:// remotehost/foobar or otherwise (b) develop on http:// localhost/foobar and deploy on http:// remotehost/foobar . I want to know how to transfer the database data back and forth without overwriting the values found in Magento Admin Panel -> System -> Configuration -> Web -> Unsecure Base URL / Secure Base URL when I run mysql and use the mysql command source to reinstate the database entries found on the development site onto the production site.

因此,我想要一种更简单的方法来还原数据库内容而无需 这样做会覆盖在magento管理面板中配置的基本url 会导致重定向到每个页面加载中不存在或错误的位置 从而使系统无法使用.

So, I would like an easier way to restore the database contents without overwriting the base url configured in magento admin panel as doing so would cause a redirect to a nonexisting or wrong place on each page load and thus render the system unusable.

推荐答案

不完全是SO类型的问题. Magento EE具有内置的暂存器,也可以合并您的数据.您必须了解,如果没有一些认真的同步框架来跟踪每行和每一列的状态,并且知道哪些数据是新数据,什么是旧数据并解决同步冲突,那么就不可能轻易地将数据从开发人员同步到实时状态.

Not exactly a SO type of question. Magento EE has staging built in and can merge your data as well. You have to understand that syncing data from dev to live is not easily possible without some serious sync framework that keeps track on state of every row and column and knows what data is new and what is old and solve syncing conflicts.

以下是假设您正在使用CE且未捆绑数据迁移工具的情况.

  • 设置实时数据库并计算数据将仅从实时迁移到开发人员,而不会从开发人员迁移到实时,因为您没有数据迁移.您需要在数据库级别进行制作和保存的每个配置都可以在实时数据库中完成(在开发环境中对其进行测试,然后在实时环境中创建)
  • 制作一个shell脚本,fabric脚本,无论您喜欢什么部署脚本,都将导出实时数据库转储,删除dev数据库(如果存在)并创建一个新数据库并将其导入实时数据库,运行pre或post sql脚本更改/删除与环境相关的配置值(例如base_url,secure_base_url等)
  • 为避免重复输入数据,请始终创建您需要使用magento设置脚本保留的所有属性和配置值.

代码也一样,这是带有实时,舞台和开发环境的常见设置场景

  • 基于干净的magento版本树的一个主版本控制(最好是裸露,以免有人更改文件在那里)
  • 每个环境(活动,阶段,dev(n))的独立分支,以及从dev(您在其中进行开发并可能具有破损的代码库状态)到阶段(在其中发布候选版本并已准备好进行测试和执行)的经过验证的代码流不变)从现场到现场(您的现场代码处于稳定状态)
  • 每个开发人员都从dev分支进行结帐,并提交到自己的dev分支,然后将更改推送到dev进行评估,并确定更改是否足够成熟以进行登台
  • 阶段是发布候选者生活的地方,客户可以测试(或自动测试)并诊断发布是否准备就绪,这里没有人更改代码,并且代码来自dev分支
  • live是实时运行版本,没有人直接更改任何代码.如果测试通过,则代码只能从阶段进入这里

因此,要形象化,可以更好地想象您的代码库位于git中.

so to visualise it better imagine your codebase residing in git.

myproject_magento_se (your project git repository on bitbucket.org or in github or wherever you can host)
--> master (branch with all clean magento versions from your current to latest)
--> dev (git checkout -b master (or by specific version from master) 
--> stage (while on dev: git checkout -b stage)
--> live (while on stage: git checkout -b live)

并想象您的主机设置是这样的:

and imagine your hosts setup like this:

www.mylivesite.com =  git clone yourgitrepo; git checkout live;
stage.mylivesite.com = git clone yourgitrepo; git checkout stage;
dev.mylivesite.com = git clone yourgitrepo; git checkout dev;

为此,您最好拥有部署脚本,只需按一下按钮即可在环境之间进行切换以及代码和数据库的提升.

For all this you better have deployment scripts that do switching and code and database lifting between environments with a push of the button.

以下是每个软件项目每天需要执行的一些常见操作

  • 从实时迁移/重置数据到从实时迁移到开发人员的阶段(如果需要加扰处理,以扰乱或更改与客户相关的数据)
  • 将代码从开发人员移至阶段
  • 将代码从阶段转移到现场
  • 重置/创建具有实时状态(数据和代码)的任何开发人员

玩得开心:)并通过 https://superuser.com/questions/90301/sync-two-mysql-databases 和其他所有您可以在类似问题上找到的SO.

have fun :) and go through this thread as well https://superuser.com/questions/90301/sync-two-mysql-databases and all other you can find searching on SO in similar matter.

这篇关于配置兼容的开发和生产站点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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