Deployment taking very long on singapore servers

Hey, this is my first time using fly to deploy.
The deployment seems to be taking over 45m+ as im writing this and the server keeps switching to a suspended state. Is there any way I could fix this?

This is what I see in the monitor tab.

Thanks!


2023-11-13T19:42:36.331 proxy[148e435bdd1589] sin [info] Starting machine

2023-11-13T19:42:36.480 app[148e435bdd1589] sin [info] [ 0.033178] PCI: Fatal: No config space access function found

2023-11-13T19:42:36.638 app[148e435bdd1589] sin [info] INFO Starting init (commit: 15238e9)…

2023-11-13T19:42:36.650 app[148e435bdd1589] sin [info] INFO starting statics vsock server

2023-11-13T19:42:36.651 app[148e435bdd1589] sin [info] INFO Preparing to run: /rails/bin/docker-entrypoint ./bin/rails server as rails

2023-11-13T19:42:36.655 app[148e435bdd1589] sin [info] ERROR Error: failed to spawn command: /rails/bin/docker-entrypoint ./bin/rails server: Permission denied (os error 13)

2023-11-13T19:42:36.656 app[148e435bdd1589] sin [info] does /rails/bin/docker-entrypoint exist and is it executable?

This is my current logs. Using the Dockerfile written below. Not sure what I could change for this to work?

syntax = docker/dockerfile:1

Make sure RUBY_VERSION matches the Ruby version in .ruby-version and Gemfile

ARG RUBY_VERSION=3.2.1
FROM ruby:$RUBY_VERSION-slim as base

LABEL fly_launch_runtime=“rails”

Rails app lives here

WORKDIR /rails

Set production environment

ENV RAILS_ENV=“production”
BUNDLE_WITHOUT=“development:test”
BUNDLE_DEPLOYMENT=“1”

Update gems and bundler

RUN gem update --system --no-document &&
gem install -N bundler

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

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/

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 useradd rails --create-home --shell /bin/bash &&
chown -R rails:rails db log storage tmp
USER rails:rails

Entrypoint prepares the database.

CMD chmod +x /rails/bin/*
ENTRYPOINT [“/rails/bin/docker-entrypoint”]

Start the server by default, this can be overwritten at runtime

EXPOSE 3000
CMD [“./bin/rails”, “server”]

Just a guess, but are you deploying from Microsoft Windows? If so, try:

ruby bin\rails generate dockerfile --windows

This will prompt you to see if you want to accept changes that will set permissions.

Hey, thanks for your response. I am deploying from a Macbook Intel chip.
I figured out the issue and it was this line in the Dockerfile

USER rails:rails .

Removing this line allowed me to run the server.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.