Hi guys!
I faced with one problem during deploy (fly deploy) of my small app. Maybe somebody knows how to fix it.
The log of deployment is next:
--> Building image done
==> Pushing image to fly
The push refers to repository [registry.fly.io/sewcon]
79a2d0cdc077: Pushed
a2b42218d512: Pushed
f9325ba5b5f3: Pushed
8ffe22cf8b14: Layer already exists
b61a41ba0c13: Layer already exists
cf09198a83b8: Layer already exists
242dc5346dec: Layer already exists
f87696163903: Layer already exists
214d39b6280a: Layer already exists
138afe438ab3: Layer already exists
959e4e92bf39: Layer already exists
67c6b910abbc: Layer already exists
7292cf786aa8: Layer already exists
deployment-01HJT6ZBDZ65QB07Q0GW636S9Z: digest: sha256:5476e55c16e19ec717aae398883cce4b8df2bdc9b4d7da451ff7447f98ee9c5a size: 3055
--> Pushing image done
image: registry.fly.io/sewcon:deployment-01HJT6ZBDZ65QB07Q0GW636S9Z
image size: 609 MB
Watch your deployment at https://fly.io/apps/sewcon/monitoring
Running sewcon release_command: ./bin/rails db:prepare
-------
✖ release_command failed
-------
Error release_command failed running on machine 5683623ae3708e with exit code 1.
Check its logs: here's the last 100 lines below, or run 'fly logs -i 5683623ae3708e':
Pulling container image registry.fly.io/sewcon:deployment-01HJT6ZBDZ65QB07Q0GW636S9Z
Successfully prepared image registry.fly.io/sewcon:deployment-01HJT6ZBDZ65QB07Q0GW636S9Z (8.991958793s)
Configuring firecracker
[ 0.038995] PCI: Fatal: No config space access function found
INFO Starting init (commit: 15238e9)...
INFO Preparing to run: `/rails/bin/docker-entrypoint ./bin/rails db:prepare` as 1000
INFO [fly api proxy] listening at /.fly/api
2023/12/29 07:20:29 listening on [fdaa:4:8b67:a7b:c8:4fcc:334:2]:22 (DNS: [fdaa::3]:53)
/rails/bin/rails:5:in `require_relative': cannot load such file -- /rails/config/boot (LoadError)
from /rails/bin/rails:5:in `<main>'
INFO Main child exited normally with code: 1
INFO Starting clean up.
WARN hallpass exited, pid: 315, status: signal: 15 (SIGTERM)
2023/12/29 07:20:30 listening on [fdaa:4:8b67:a7b:c8:4fcc:334:2]:22 (DNS: [fdaa::3]:53)
[ 2.354197] reboot: Restarting system
machine restart policy set to 'no', not restarting
-------
Error: release command failed - aborting deployment. error release_command machine 5683623ae3708e exited with non-zero status of 1
artemzybin@Air-Artem-TOKO sewcon %
My fly.toml
# fly.toml app configuration file generated for sewcon on 2023-12-28T16:14:34+02:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#
app = "sewcon"
primary_region = "waw"
console_command = "/rails/bin/rails console"
[build]
[deploy]
release_command = "./bin/rails db:prepare"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ["app"]
[[vm]]
cpu_kind = "shared"
cpus = 1
memory_mb = 256
[[statics]]
guest_path = "/rails/public"
url_prefix = "/"
My Dockerfile:
# syntax = docker/dockerfile:1
# Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile
ARG RUBY_VERSION=3.2.2
FROM ruby:$RUBY_VERSION-slim as base
LABEL fly_launch_runtime="rails"
# Rails app lives here
WORKDIR /rails
# Set production environment
ENV BUNDLE_DEPLOYMENT="1" \
BUNDLE_PATH="/usr/local/bundle" \
BUNDLE_WITHOUT="development:test" \
RAILS_ENV="production"
# Update gems and bundler
RUN gem update --system --no-document && \
gem install -N bundler
# Install packages needed to install nodejs
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Install Node.js
ARG NODE_VERSION=18.18.1
ENV PATH=/usr/local/node/bin:$PATH
RUN curl -sL https://github.com/nodenv/node-build/archive/master.tar.gz | tar xz -C /tmp/ && \
/tmp/node-build-master/bin/node-build "${NODE_VERSION}" /usr/local/node && \
rm -rf /tmp/node-build-master
# Throw-away build stage to reduce size of final image
FROM base as build
# Install packages needed to build gems
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y build-essential libpq-dev
# Build options
ENV PATH="/usr/local/node/bin:$PATH"
# Install application gems
COPY --link Gemfile Gemfile.lock ./
RUN bundle install && \
bundle exec bootsnap precompile --gemfile && \
rm -rf ~/.bundle/ "${BUNDLE_PATH}"/ruby/*/cache "${BUNDLE_PATH}"/ruby/*/bundler/gems/*/.git
# Copy application code
COPY --link . .
# Precompile bootsnap code for faster boot times
RUN bundle exec bootsnap precompile app/ lib/
# Precompiling assets for production without requiring secret RAILS_MASTER_KEY
RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
# Final stage for app image
FROM base
# Install packages needed for deployment
RUN apt-get update -qq && \
apt-get install --no-install-recommends -y curl postgresql-client && \
rm -rf /var/lib/apt/lists /var/cache/apt/archives
# Copy built artifacts: gems, application
COPY --from=build /usr/local/bundle /usr/local/bundle
COPY --from=build /rails /rails
# Run and own only the runtime files as a non-root user for security
RUN groupadd --system --gid 1000 rails && \
useradd rails --uid 1000 --gid 1000 --create-home --shell /bin/bash && \
chown -R 1000:1000 db log storage tmp
USER 1000:1000
# Entrypoint sets up the container.
ENTRYPOINT ["/rails/bin/docker-entrypoint"]
# Start the server by default, this can be overwritten at runtime
EXPOSE 3000
CMD ["./bin/rails", "server"]
I’m grateful in advance to everyone who will not pass by and try to help me