使用 Mercurial 和 Netbeans 进行简单的单一开发人员部署?

发布于 2024-09-28 13:21:07 字数 746 浏览 4 评论 0原文

我正在使用 Codeigniter PHP 框架编写一个网站。

我正在使用 Mercurial 进行版本控制。

我使用 3 个系统。我使用 Netbeans 6.9.1 在 Windows 7 计算机上进行编码。我偶尔会进行提交并推送到 Bitbucket.org 上的存储库,纯粹是出于备份和版本控制的目的。

我有一个“测试版”网站(在一个共享的 Linux 机器上,有自己的专用 IP 地址),我使用 FTP 上传到该网站,在那里我可以测试一切是否在运行 Linux 的实际站点上按预期工作。

一旦我对此感到满意,我就会上传到我的“实时”网站,该网站位于它自己的专用服务器上。同样,我只是使用 FTP 从我的开发服务器上传文件。

我意识到这是完全错误的。一方面,我必须进去并更改测试版和实时计算机上的一些内容,以便它们引用正确的域名,而不是本地主机。另一方面,我根本没有利用 Mercurial 来帮助解决这个问题。我假设我可以使用 Mercurial 来“抓取”我已标记为准备部署的特定修订版,而不是从 FTP 上传。我还认为我可能会在 Netbeans 中做一些不同的事情,以使该过程变得更容易。

我想要做的是有一些非常平滑的方法来控制这一切,并且希望知道如何处理测试版和实时站点与本地主机的配置设置略有不同的问题。

有没有标准的方法来完成我正在寻找的事情?我已经看到一些第三方应用程序用于“持续集成”的参考,但我不确定我是否需要类似的东西。

我有点迷失了对我来说最简单的事情是什么,这会让我的生活更轻松......非常感谢任何帮助:)谢谢!

I am coding a website using the Codeigniter PHP framework.

I am using mercurial for version control.

I have 3 systems I work with. I do my coding on a Windows 7 machine using Netbeans 6.9.1. I am occasionally making commits, and pushing to a repository at Bitbucket.org, purely for the purposes of backup and version control.

I have a "beta" website (on a shared Linux box with it's own dedicated IP address) that I upload to using FTP, where I can test that everything is working as intended on an actual site running Linux.

Once I'm happy with that, I upload to my "live" site, which is on it's own dedicated server. Again I'm just using FTP to upload the files from my development server.

I realize that this is all kinds of wrong. For one thing I have to go in and change some things on the beta and live machines so that they're referring to the correct domain name, instead of localhost. For another, I'm not making use of mercurial at all to help with this. I assume instead of uploading from FTP, I could be using mercurial to "grab" a particular revision that I've marked as ready to deploy. I also think I could possibly be doing something in Netbeans differently to make the process easier.

What I want to do is have some very smoothe way to control all this, and hopefully one that knows how to deal with the issue of a slightly different configuration setup for the beta and live sites from the localhost.

Is there a standard way to do what I'm looking for? I've seen references to some third party apps for "continuous integration" but I'm not sure I need anything like that.

I'm a little lost as to what would be the SIMPLEST thing for me to do that would make my life easier....any help greatly appreciated :) Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谁与争疯 2024-10-05 13:21:07

这取决于每个站点的设置有多么不同,以及是否涉及秘密,这些秘密不应在公共场所可见(我假设您使用公共位桶存储库)。

如果更改不敏感,则您可以为测试和生产服务器添加两个附加分支,其中应用配置更改。每次您更改默认值并将其部署到测试时,您只需将默认值合并到测试之上,然后 Mercurial 在此过程中填写不同的配置设置。然后,服务器部署将是对正确分支内的 hg archive 的调用。

典型的更改历史记录如下所示:

O----o-o-o-o-o-o-o-o---o      default
 \          \           \
  T1--------T2-----------T3   test
   \                      \
    P1---------------------P2 production

在 T1 和 P1 中填写测试和生产的参数。您还可以使用此分支设置来成熟站点的开发,在默认情况下进行修改,并且仅传播稳定的更改进入测试和生产。

如果更改很敏感,您可以创建一个非版本化部署脚本(或者更好的是版本化部署脚本和非版本化配置文件),它会修补 hg archive 的输出。

无论如何,您应该使用部署脚本,它会处理产品的打包并以自动化和标准化的方式部署目标。在此脚本中,您还可以将有关源修订的信息嵌入到最终存档中。

请注意,此模型适用于服务器上未进行任何更改的环境。如果您对服务器上的产品进行了更改,则需要将文件从服务器复制回您的开发环境(以正确的版本),以检查服务器上发生了什么更改。当您还想在服务器上进行更改时,您可能还想在那里安装 Mercurial。

It depends on how different the setup for each site is, and if there are secrets involved, which should not be visible on a public place (I assume you use a public bitbucket repository).

If the changes are not sensitive, then you can add two additional branches for your test and production servers, where only the configuration changes are applied. Every time you change something in default and deploy it to test, you would simply merge default on top of test, and mercurial fill in the different configuration settings in the process. Then the server deployment wold be a call to hg archive within the correct branch.

A typical change history would look like this:

O----o-o-o-o-o-o-o-o---o      default
 \          \           \
  T1--------T2-----------T3   test
   \                      \
    P1---------------------P2 production

where in T1 and P1 the parameters for test and production are filled in. You also can use this branch setup to mature the development of your site, where you hack in default, and only propagate stable changes into test and production.

If the changes are sensitive, you can create a non-versionized deploy script (or better a versionized deployment script and a not versionized configuration file), which patches the output of hg archive.

You should use deployment scripts anyway, which handles the packaging of the product and deploy an the target in an automated and standardized way. Within this script you can also embed information about the source revision into the final archive.

Note that this model works fine for an environment, where no changes are made on the server. If you do changes to the product on the server, you need to copy the files from the server back into your development environment(at the correct revision), to check what was changed on the server. When you want to make changes also on the server, you might want to install mercurial also there.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文