简体   繁体   English

将 Docker Rails 6 应用程序部署到 AWS ECS 时出现 RDS 相关错误

[英]RDS related error when deploying a Docker Rails 6 app to AWS ECS

I am trying to deploy a Rails 6 app to AWS ECS.我正在尝试将 Rails 6 应用程序部署到 AWS ECS。

The deployment fails, and I got the following error:部署失败,我收到以下错误:

health_check failed: Plugin http could not be loaded: Error loading shared library lib/mariadb/plugin/http.so: No such file or directory health_check 失败:无法加载插件 http:加载共享库 lib/mariadb/plugin/http.so 时出错:没有这样的文件或目录

Gemfile宝石文件

gem 'rails', '~> 6.0.0'
gem 'mysql2'

Gemfile.lock Gemfile.lock

mysql2 (0.5.3)
rails (6.0.3.6)

I am not using MariaDB in my app, but according to the mysql2 gem author, it might be necessary to add MariaDB dependencies .我没有在我的应用程序中使用 MariaDB,但根据mysql2 gem 作者的说法,可能有必要添加 MariaDB dependencies

You may need to install a package such as libmariadb-dev, libmysqlclient-dev, mysql-devel, or default-libmysqlclient-dev;您可能需要安装 package,例如 libmariadb-dev、libmysqlclient-dev、mysql-devel 或 default-libmysqlclient-dev; refer to your distribution's package guide to find the particular package.请参阅您的发行版的 package 指南以找到特定的 package。 The most common issue we see is a user who has the library file libmysqlclient.so but is missing the header file mysql.h -- double check that you have the -dev packages installed.我们看到的最常见问题是拥有库文件 libmysqlclient.so 但缺少 header 文件 mysql.h 的用户——仔细检查您是否安装了 -dev 包。

Dockerfile Dockerfile

###############################
FROM ruby:2.6.3-alpine

ARG RAILS_ENV
ENV RAILS_ENV ${RAILS_ENV}

RUN apk add --update --no-cache \
  build-base \
  openssl \
  mysql-dev \
  mariadb-dev \
  git \
  tzdata && \
  cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime

WORKDIR /app
ADD Gemfile* /app/

RUN gem install --no-document bundler
RUN bundle install -j4 --retry 3 \
  && rm -rf /usr/local/bundle/cache/*.gem \
  && find /usr/local/bundle/gems/ -name "*.c" -delete \
  && find /usr/local/bundle/gems/ -name "*.o" -delete

# Add the Rails app
ADD . /app

WORKDIR /app

CMD ["bundle", "exec", "puma", "-C", "config/puma.rb"]

I built my app with:我构建了我的应用程序:

docker-compose build --no-cache

Any help would be highly appreciated.任何帮助将不胜感激。

The error was related to the DB address format.该错误与 DB 地址格式有关。

To make it work, I removed the http:// prefix and the trailing / to the DB address env variable.为了使它工作,我删除了http://前缀和 DB 地址环境变量的尾随/

I changed:我变了:

DB_HOST=http://abcdef-rds.xyz.ap-northeast-1.rds.amazonaws.com/

to:至:

DB_HOST=abcdef-rds.xyz.ap-northeast-1.rds.amazonaws.com

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

相关问题 将Rails 5应用程序部署到EC2- RDS数据库实例连接错误 - Deploying a Rails 5 app to EC2- RDS DB Instance connectivity error 将大型csv文件导入AWS ECS容器上的Rails应用程序时出错 - Error when importing large csv file to Rails app on AWS ECS container 部署Rails应用时出现错误AWS弹性beantalk - error deploying rails app aws elastic beanstalk Rails应用程序中的AWS RDS数据库-从root用户切换到IAM用户时出错 - AWS RDS Database from Rails app - Error when switching from root to IAM user 将 Rails 5 应用程序 database.yml 连接到 AWS RDS 实例时出错 - Error connecting Rails 5 app database.yml to AWS RDS instance 部署Rails应用程序时使AWS S3与Heroku一起使用 - Getting AWS S3 to work with heroku when deploying rails app 将应用程序部署到Heroku时出错:Railsbridge Installfest-部署Rails应用程序 - Error When Deploying App to Heroku: Railsbridge Installfest—Deploy a Rails App 将Heroku Rails应用程序与Amazon RDS后端一起使用时,AWS Data Transfer会收费 - AWS Data Transfer charges when using Heroku Rails app with Amazon RDS backend 使用Capistrano在AWS EC2上部署Rails应用 - Deploying Rails App on AWS EC2 with Capistrano 在AWS Elastic Beanstalk上部署Rails / Ember应用程序 - Deploying a Rails / Ember app on AWS Elastic Beanstalk
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM