Reputation: 386
I am trying to deploy a Rails 6 app to 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
Gemfile
gem 'rails', '~> 6.0.0'
gem 'mysql2'
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.
You may need to install a package such as libmariadb-dev, libmysqlclient-dev, mysql-devel, or default-libmysqlclient-dev; refer to your distribution's package guide to find the particular 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.
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.
Upvotes: 0
Views: 177
Reputation: 386
The error was related to the DB address format.
To make it work, I removed the http://
prefix and the trailing /
to the DB address env variable.
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
Upvotes: 0