在部署中使用 Bundler

发布于 2025-01-05 17:26:27 字数 523 浏览 4 评论 0原文

这是一个非常基本的问题,但我试图了解如何在部署情况下最好地使用 Bundler。

我正在开发一个 Sinatra 应用程序,它有大约 20 个依赖的 gem。在开发过程中,我将 RVM 与应用程序的自定义 gemset 结合使用,并运行 bundle install 来根据 gemfile 更新 gemset。

当涉及到部署时(目前是手动部署,这样我可以在使用像 capistrano 这样的工具之前了解它是如何工作的),我需要执行 bundle install --development 对吗?这会下载 gem 并将它们放置在 vendor/bundle 中。

我的问题是我还需要做什么?我在服务器上使用 Unicorn - 我是否只需 bundle exec unicorn ... 并且一切正常? (即捆绑程序找到供应商目录并使用那里的 gem?)

unicorn 应该是应用程序中的供应商 gem,还是所有应用程序共享的服务器上的单独“系统”gem?

Pretty fundamental question but I'm trying to understand how best to use Bundler in a deployment situation.

I'm working on a Sinatra application that has about 20 dependent gems. During development, I'm using RVM with a custom gemset for the application, and I run bundle install to update the gemset in accordance with the gemfile.

When it comes to deployment (manually for now, so I can understand how it all works before using a tool like capistrano), I need to do bundle install --development right? This downloads the gems and places them in vendor/bundle.

My question is what else do I need to do? I'm using Unicorn on the server - do I just bundle exec unicorn ... and everything just works? (i.e. bundler finds the vendor directory and uses the gems from there?)

Should unicorn be a vendored gem in the application or a separate 'system' gem on the server that all applications share?

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

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

发布评论

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

评论(1

注定孤独终老 2025-01-12 17:26:27

您需要 --deployment 密钥,而不是 --development: http://gembundler .com/man/bundle-install.1.html#DEPLOYMENT-MODE

首次运行时,捆绑程序会在 .bundle 目录中创建配置。您可以通过在项目目录中运行 bundle config 或仅 cat .bundle/config 来检查它。所以 bundle exec unicorn 就足够了,因为bundler知道gems安装在哪里。在开发机器上,您还可以使用 --path 键将 gems 安装到任意目录。有关更多详细信息,请参阅捆绑安装的联机帮助页(上面的链接或捆绑帮助安装)。

You need --deployment key, not --development: http://gembundler.com/man/bundle-install.1.html#DEPLOYMENT-MODE

On first run bundler creates config in .bundle directory. You can check it by running bundle config or just cat .bundle/config in project's directory. So bundle exec unicorn is enough since bundler knows where gems are installed. On development machine you can also install gems to arbitrary directory using --path key. For more details see manpage for bundle install (link above or bundle help install).

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