简体   繁体   English

由于 ruby-buildpack + bundler,部署到 dokku 失败?

[英]Deploy to dokku fails because of ruby-buildpack + bundler?

I'm deploying a rails app to dokku.我正在将 Rails 应用程序部署到 dokku。 The Versions are:版本是:

  • ruby 3.1.2 ruby 3.1.2
  • bundler 2.3.26 (on my development machine) bundler 2.3.26(在我的开发机器上)
  • gem 3.3.22 (on my development machine) gem 3.3.22(在我的开发机器上)

when i try to deploy to dokku, the heroku ruby buildpack is used, and I get the following output:当我尝试部署到 dokku 时,使用了 heroku ruby buildpack,我得到以下 output:

-----> Ruby app detected
-----> Installing bundler 2.2.21
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.1.2
-----> Installing dependencies using bundler 2.2.21
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       [330, #<Thread:0x00007fc0e8b43c90 run>, #<NameError: uninitialized constant Gem::Source
       (defined?(@source) && @source) || Gem::Source::Installed.new
       ^

The crazy thing: I have another app with the same configuration where it works:疯狂的事情:我有另一个具有相同配置的应用程序:

-----> Ruby app detected
-----> Installing bundler 2.2.21
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-3.1.2
-----> Installing dependencies using bundler 2.2.21
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_DEPLOYMENT=1 bundle install -j4
       Fetching gem metadata from https://rubygems.org/.........

My research so far:到目前为止我的研究:

This seems to be the problem described here as an issue with bundler 2.3.7 first described in February 2022. But my buildpack uses bundler 2.2.21, so it should not be affected?这似乎是这里描述的问题,作为 2022 年 2 月首次描述的 bundler 2.3.7 的问题。但是我的 buildpack 使用 bundler 2.2.21,所以它应该不会受到影响?

The newest ruby-buildpack from heroku seems to have been released in 2021?来自 heroku 的最新 ruby-buildpack似乎已经在 2021 年发布了? Can this be right?这是对的吗?

This fixed the problem for one app:这解决了一个应用程序的问题:

  • upgrade to ruby 3.1.3 (by editing ruby version in Gemfile and in .ruby-version )升级到 ruby 3.1.3(通过在Gemfile.ruby-version中编辑 ruby 版本)
  • bundle install捆绑安装
  • bundle lock --add-platform x86_64-linux捆绑锁 --add-platform x86_64-linux

After one successfull install I could also roll back to the old ruby version, before upgrade, and successfully install that.一次成功安装后,我还可以在升级之前回滚到旧的 ruby 版本,并成功安装它。

How?如何? Why?为什么? What is going on here?这里发生了什么?

Now another app that used to work stopped working.现在另一个曾经工作的应用程序停止工作。

Purging the dokku build cache fixed the problem:清除 dokku 构建缓存解决了这个问题:

dokku repo:purge-cache

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM