升级到 Ruby 3.0 后应用 (rails 6.1.1) 无法启动

如何解决升级到 Ruby 3.0 后应用 (rails 6.1.1) 无法启动

这是 Gemfile:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '3.0.0'

# Bundle edge Rails instead: gem 'rails',github: 'rails/rails'
gem 'rails','~> 6.1.0'
# Use mysql as the database for Active Record
gem 'mysql2','>= 0.4.4'
# Use Puma as the app server
gem 'puma','~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails','>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker','~> 5.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks','~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder','~> 2.7'

# Flexible authentication solution for Rails with Warden
gem 'devise','~> 4.7'

# A simple HTTP and REST client
gem 'rest-client','~> 2.1'

# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap','>= 1.4.2',require: false

# Devise supports i18n in controllers,models,and in other areas,# but it does not have support for internationalized views.
# devise-i18n adds this support.
gem 'devise-i18n','~> 1.9'
# Devise Bootstrap Views
gem 'devise-bootstrap-views','~> 1.0'
# Configure Devise to send its emails asynchronously using ActiveJob
gem 'devise-async','~> 1.0'

# Stripe is the easiest way to accept payments online
gem 'stripe','~> 5.22'

# A gem that provides a client interface for the Sentry error logger
gem 'sentry-raven','~> 3.0'

# Taming Rails' Default Request Logging
gem 'lograge','~> 0.11'

# Ruby state machines
gem 'aasm','~> 5.0'
# Allows to use ActiveRecord transactional callbacks outside of ActiveRecord models,literally everywhere in your application.
gem 'after_commit_everywhere','~> 0.1','>= 0.1.5'

# Agnostic pagination in plain ruby
gem 'pagy','~> 3.8'

# Connection Pool
gem 'connection_pool','~> 2.2'

# Redis client
gem 'hiredis','~> 0.6'
gem 'redis','~> 4.1',require: ['redis','redis/connection/hiredis']

# Sidekiq
gem 'sidekiq','~> 6.0'

# Check password strength against several rules
gem 'password_strength','~> 1.1'

# Slack Ruby Client
gem 'slack-ruby-client','~> 0.15'

# Assets on AWS S3/CloudFront
gem 'asset_sync','~> 2.12'
gem 'fog-aws','~> 3.6'

group :development,:test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug',platforms: [:mri,:mingw,:x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console','>= 3.3.0'
  gem 'listen','>= 3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen','~> 2.0'
  gem 'rspec-rails','~> 4.0'
  gem 'amazing_print','~> 1.2'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara','>= 2.15'
  gem 'capybara-screenshot'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
  gem 'factory_bot_rails','~> 6.0'
  gem 'shoulda-matchers','~> 4.1'
  gem 'rails-controller-testing'
  gem 'faker'
  gem 'database_cleaner-active_record'
  gem 'coderay'
  gem 'mock_redis'
end

应用程序似乎在 Rails.application.initialize! 期间被阻止。 不知道会不会是Ruby 3.0不兼容的gem,但是我从头开始了一个新的应用,安装了所有的gem,应用正常启动。

我使用 puma (5.1.1) 作为网络服务器。 该应用程序通过 docker-compose 在 docker 容器中运行。

FROM ruby:2.7.2

# Update for security reason
RUN apt-get update -yqq && apt-get upgrade -yqq -o Dpkg::Options::="--force-confold" && apt-get install -yqq --no-install-recommends \
  vim # needed for editing rails credentials

# Ensure we install an up-to-date version of Node
RUN curl -sL https://deb.nodesource.com/setup_14.x | bash -

# Ensure latest packages for Yarn
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update -yqq && apt-get install -yqq --no-install-recommends \
  nodejs \
  yarn

ENV RAILS_ROOT /var/www/app
RUN mkdir -p $RAILS_ROOT

COPY Gemfile* /var/www/app/
WORKDIR /var/www/app

ENV BUNDLE_PATH /gems

RUN bundle install

COPY package.json package.json
COPY yarn.lock yarn.lock

RUN yarn install --check-files

COPY . /var/www/app/

EXPOSE 3000

# Clean up APT when done.
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENTRYPOINT ["./puma-entrypoint.sh"]
CMD ["bundle","exec","puma","-C","config/puma/development.rb"]
# Puma can serve each request in a thread from an internal thread pool.
# The `threads` method setting takes two numbers: a minimum and maximum.
# Any libraries that use thread pools should be configured to match
# the maximum value specified for Puma. Default is set to 5 threads for minimum
# and maximum; this matches the default thread size of Active Record.
#
max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count,max_threads_count

# Specifies the `worker_timeout` threshold that Puma will use to wait before
# terminating a worker in development environments.
#
worker_timeout 3600 if ENV.fetch("RAILS_ENV","development") == "development"

# Specifies the `port` that Puma will listen on to receive requests; default is 3000.
#
port ENV.fetch("PORT") { 3000 }

# Specifies the `environment` that Puma will run in.
#
environment ENV.fetch("RAILS_ENV") { "development" }

# Specifies the `pidfile` that Puma will use.
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }

# Specifies the number of `workers` to boot in clustered mode.
# Workers are forked web server processes. If using threads and workers together
# the concurrency of the application would be max `threads` * `workers`.
# Workers do not work on JRuby or Windows (both of which do not support
# processes).
#
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }

# Use the `preload_app!` method when specifying a `workers` number.
# This directive tells Puma to first boot the application and load code
# before forking the application. This takes advantage of Copy On Write
# process behavior so workers use less memory.
#
# preload_app!

# Allow puma to be restarted by `rails restart` command.
plugin :tmp_restart

有没有办法让日志来查看启动过程中发生的事情?

解决方法

请提供更多信息。

  1. 你在哪个系统上?
  2. 您如何开始申请?如果遇到问题,请始终在控制台上启动。
  3. Puma 有一个日志输出。搜索此位置。将日志输出放在这里。
  4. 尝试移除所有 gem 或其中大部分以查找错误。
,

研究这个话题,我发现没有太多有用的信息,所以只是想为这个事业做出贡献......

您没有提供太多信息,但再次尝试将 Dockerfile 中的 FROM ruby:2.7.2 更改为 FROM ruby: 3.0.0。还要检查 Bundler 是否仍在使用 ruby​​ 3.0,如果不是,请尝试将其更新到 v2.2。

https://www.ruby-lang.org/en/news/2020/12/25/ruby-3-0-0-released/ https://bundler.io/blog/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-
参考1 参考2 解决方案 # 点击安装源 协议选择 http:// 路径填写 mirrors.aliyun.com/centos/8.3.2011/BaseOS/x86_64/os URL类型 软件库URL 其他路径 # 版本 7 mirrors.aliyun.com/centos/7/os/x86
报错1 [root@slave1 data_mocker]# kafka-console-consumer.sh --bootstrap-server slave1:9092 --topic topic_db [2023-12-19 18:31:12,770] WARN [Consumer clie
错误1 # 重写数据 hive (edu)> insert overwrite table dwd_trade_cart_add_inc > select data.id, > data.user_id, > data.course_id, > date_format(
错误1 hive (edu)> insert into huanhuan values(1,'haoge'); Query ID = root_20240110071417_fe1517ad-3607-41f4-bdcf-d00b98ac443e Total jobs = 1
报错1:执行到如下就不执行了,没有显示Successfully registered new MBean. [root@slave1 bin]# /usr/local/software/flume-1.9.0/bin/flume-ng agent -n a1 -c /usr/local/softwa
虚拟及没有启动任何服务器查看jps会显示jps,如果没有显示任何东西 [root@slave2 ~]# jps 9647 Jps 解决方案 # 进入/tmp查看 [root@slave1 dfs]# cd /tmp [root@slave1 tmp]# ll 总用量 48 drwxr-xr-x. 2
报错1 hive> show databases; OK Failed with exception java.io.IOException:java.lang.RuntimeException: Error in configuring object Time taken: 0.474 se
报错1 [root@localhost ~]# vim -bash: vim: 未找到命令 安装vim yum -y install vim* # 查看是否安装成功 [root@hadoop01 hadoop]# rpm -qa |grep vim vim-X11-7.4.629-8.el7_9.x
修改hadoop配置 vi /usr/local/software/hadoop-2.9.2/etc/hadoop/yarn-site.xml # 添加如下 <configuration> <property> <name>yarn.nodemanager.res