如何更新服务器上的 Web 应用程序?

发布于 2024-07-04 19:06:22 字数 355 浏览 8 评论 0原文

我知道 Capistrano,但它对我来说有点太重了。 就我个人而言,我设置了两个 Mercurial 存储库,一个位于生产服务器上,另一个位于我的本地服务器上开发机。 通常,当新功能准备就绪时,我会将更改从本地计算机上的存储库推送到服务器上的存储库,然后在服务器上更新。 这是一种非常简单快捷的方法,可以在多台计算机上保持文件同步,但无助于更新数据库。

你的问题的解决方案是什么?

I am aware of Capistrano, but it is a bit too heavyweight for me. Personally, I set up two Mercurial repositories, one on the production server and another on my local dev machine. Regularly, when a new feature is ready, I push changes from repository on my local machine to repository on the server, then update on the server. This is a pretty simple and quick way to keep files in sync on several computers, but does not help to update databases.

What is your solution to the problem?

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

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

发布评论

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

评论(5

闻呓 2024-07-11 19:06:22

@Andrew

要使用 git push 部署您的站点,您需要首先在 .git/config 文件中设置要推送到的远程服务器。 然后,您需要配置一个钩子,该钩子基本上会执行 git reset --hard 将刚刚复制到存储库的代码复制到工作目录。

我知道这有点含糊,但我实际上在切换到 rsync 后删除了服务器端 .git 文件夹,所以我没有用来实现奇迹的确切脚本。 不过,这可能是完整问题的一个很好的候选者,因此您可能会通过这种方式得到更多答复。

编辑:我知道已经有一段时间了,但我最终再次找到了我正在使用的东西:

使用 Git 推送部署项目

@Andrew

To use git push to deploy your site you will need to do first set up a remote server in your .git/config file to push to. Then you need to configure a hook that will basically perform a git reset --hard to copy the code you just copied to the repository to the working directory.

I know this is a little vague, but I actually deleted the server-side .git folder once I switched to rsync, so I don't have the exact scripts that I used to make the magic happen. That might be a good candidate for a full question though, so you might get more responses that way.

edit: I know it's been a while, but I eventually found what I was using again:

Deploy a project using Git push

樱娆 2024-07-11 19:06:22

我假设您说的是 Ruby on Rails。

查看 HowTo wiki:

http://wiki.rubyonrails.com/rails/pages/如何#部署

I'm assuming you're speaking of Ruby on Rails.

Check out the HowTo wiki:

http://wiki.rubyonrails.com/rails/pages/Howtos#deployment

巡山小妖精 2024-07-11 19:06:22

Capistrano 有什么重量级的? 如果你想同步文件,那么 rsync 确实很棒。 但如果您需要进行数据库更新,也许上限还不错?

what's heavyweight about capistrano? if you want to sync files then sure rsync is great. but if you're then going to need to do db updates maybe cap isn't so bad ?

月下凄凉 2024-07-11 19:06:22

或者 Fabric(如果您更喜欢 Python)。

Or Fabric, if you prefer Python.

孤星 2024-07-11 19:06:22

我曾经使用 git push 发布到我的网络服务器,但最近我一直在使用 rsync。 我尝试让我的网站尽可能不知道它在哪里运行(使用相对路径等),到目前为止它运行得很好。 唯一的挑战是保持数据库同步,为此,我通常使用生产数据库作为主数据库,并定期备份并导入到我的测试数据库中。

I used to use git push to publish to my web server but lately I've just been using rsync. I try to make my site as agnostic about where it's running as possible (using relative paths, etc) and so far it's worked pretty well. The only challenge is keeping databases in sync, and for that I usually use the production database as the master and make regular backups and imports into my testing database.

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