Rails docker app stops working after some time

时间:2019-03-17 22:44:42

标签: ruby-on-rails docker puma

I use the following Dockerfile to create an image for my Rails 4.2 webapp:

FROM ruby:2.3.4

ENV LANG C.UTF-8

WORKDIR /usr/src/page

COPY Gemfile .
COPY Gemfile.lock .
RUN bundle install

COPY . .

EXPOSE 3000
ENV CERT_PATH ssl://0.0.0.0:3000?key=certificate.key&cert=certificate.crt
CMD rails server -b $CERT_PATH -e production

The Rails app uses the puma (version 3.9.1) webserver.

I create a docker image an run this image as a container on a webserver, which works fine. I can access the webapp via a domain test.example.com or direct via the IP of the server. I use https to access the webapp.

Now the problem: After visiting a few sites the webapp stops responding (timeout error in browser). I think this happens only when visiting the site via the IP address (https://255.255.255.255/login etc.). However accessing via test.example.com does not work after that.

I have to add the SSL cert is self created.

In the rails logs in the container I see that the last request (which did not work) wasn't even logged, so my guess is it could be a docker problem?

However sudo journalctl -fu docker.service does not seem to show errors.

So my questions: Are there errors in my Dockerfile, are there some known bugs in one of the used software, does anybody know what my problem is, what are some docker commands to find error logs?

1 个答案:

答案 0 :(得分:0)

我做了以下事情来解决这个问题:

1) Used newest ruby version
2) Used newest puma version
3) Used puma workers
4) Made a config file for puma

目前看来,这些东西可以解决问题。 看来docker从未出现任何问题。

相关问题