Hi!
I am Japanese. I am not good at English, so I apologize if my writing is poor.
I created my own Dockerfilet and docker-compose.yml and created a Rails 7.0.4 app with a Docker built environment.
I got a message that fly deploy
was successful, but when I fly open
, I get an error and I am not able to deploy!
Log on fly.io side ↓
2023-05-06T00:02:55.597 runner[be5a64ec] nrt [info] Starting instance
2023-05-06T00:02:55.679 runner[be5a64ec] nrt [info] Configuring virtual machine
2023-05-06T00:02:55.680 runner[be5a64ec] nrt [info] Pulling container image
2023-05-06T00:03:06.341 runner[be5a64ec] nrt [info] Unpacking image
2023-05-06T00:03:16.059 runner[be5a64ec] nrt [info] Preparing kernel init
2023-05-06T00:03:16.444 runner[be5a64ec] nrt [info] Configuring firecracker
2023-05-06T00:03:16.808 runner[be5a64ec] nrt [info] Starting virtual machine
2023-05-06T00:03:17.036 app[be5a64ec] nrt [info] Starting init (commit: 083df78)...
2023-05-06T00:03:17.061 app[be5a64ec] nrt [info] Preparing to run: `entrypoint.sh rails server -b 0.0.0.0 -e production` as root
2023-05-06T00:03:17.085 app[be5a64ec] nrt [info] 2023/05/06 09:03:17 listening on [fdaa:1:a422:a7b:fc:be5a:64ec:2]:22 (DNS: [fdaa::3]:53)
2023-05-06T00:03:20.802 app[be5a64ec] nrt [info] => Booting Puma
2023-05-06T00:03:20.802 app[be5a64ec] nrt [info] => Rails 7.0.4.2 application starting in production
2023-05-06T00:03:20.802 app[be5a64ec] nrt [info] => Run `bin/rails server --help` for more startup options
2023-05-06T00:03:22.936 app[be5a64ec] nrt [info] Puma starting in single mode...
2023-05-06T00:03:22.936 app[be5a64ec] nrt [info] * Puma version: 5.6.5 (ruby 3.1.2-p20) ("Birdie's Version")
2023-05-06T00:03:22.936 app[be5a64ec] nrt [info] * Min threads: 5
2023-05-06T00:03:22.936 app[be5a64ec] nrt [info] * Max threads: 5
2023-05-06T00:03:22.936 app[be5a64ec] nrt [info] * Environment: production
2023-05-06T00:03:22.936 app[be5a64ec] nrt [info] * PID: 520
2023-05-06T00:03:22.937 app[be5a64ec] nrt [info] * Listening on http://0.0.0.0:3000
2023-05-06T00:03:22.941 app[be5a64ec] nrt [info] Use Ctrl-C to stop
2023-05-06T00:03:23.181 health[be5a64ec] nrt [error] Health check on port 3000 has failed. Your app is not responding properly. Services exposed on ports [80, 443] will have intermittent failures until the health check passes.
2023-05-06T00:03:38.197 health[be5a64ec] nrt [info] Health check on port 3000 is now passing.
I got a message that the deployment was successful, but I am not able to display it on the screen because of the following error.
Health check on port 3000 has failed. Your app is not responding properly. Services exposed on ports [80, 443] will have intermittent failures until the health check passes.
I referred to the Reference Articles but could not find a solution.
I would like to know if there are any possible causes.
Is there anything in the following code that needs to be corrected?
- Dockerfile
FROM ruby:3.1.2
ENV TZ Asia/Tokyo
RUN apt-get update -qq && apt-get install -y build-essential libpq-dev nodejs && apt-get install -y vim
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update \
&& apt-get install -y yarn
WORKDIR /myapp
COPY Gemfile Gemfile.lock /myapp/
RUN bundle install
COPY . /myapp
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
CMD ["rails", "server", "-b", "0.0.0.0", "-e", "production"]
- fly.toml
# fly.toml app configuration file generated for sample_app on 2023-05-06T08:58:43+09:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = "sample_app"
kill_signal = "SIGINT"
kill_timeout = 5
primary_region = "nrt"
processes = []
[build]
[env]
[experimental]
auto_rollback = true
[[services]]
http_checks = []
internal_port = 3000
processes = ["app"]
protocol = "tcp"
script_checks = []
[services.concurrency]
hard_limit = 25
soft_limit = 20
type = "connections"
[[services.ports]]
force_https = true
handlers = ["http"]
port = 80
[[services.ports]]
handlers = ["tls", "http"]
port = 443
[[services.tcp_checks]]
grace_period = "1s"
interval = "15s"
restart_limit = 0
timeout = "2s"
[[statics]]
guest_path = "/myapp/public"
url_prefix = "/"