Error volta: command not found when deploy Rails api

Hi, I have a problem when deploy Rails api.

#11 0.255 /bin/bash: line 1: volta: command not found
I know little about docker, does it mean that volta is not installed on docker?

Can anyone help me to find out that? Thank you !!

source code is here:

$ fly deploy
==> Verifying app config
--> Verified app config
==> Building image
Remote builder fly-builder-holy-cloud-3637 ready
==> Creating build context
--> Creating build context done
==> Building image with Docker
--> docker host: 20.10.12 linux x86_64
Sending build context to Docker daemon  55.63kB
[+] Building 3.8s (11/26)                                                                                                                                     
 => CACHED [internal] load remote build context                                                                                                          0.0s
 => CACHED copy /context /                                                                                                                               0.0s
 => resolve image config for docker.io/docker/dockerfile:experimental                                                                                    2.1s
 => CACHED docker-image://docker.io/docker/dockerfile:experimental@sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c02aa468e78496ff5               0.0s
 => [internal] load metadata for quay.io/evl.ms/fullstaq-ruby:3.1.2-jemalloc-bullseye-slim                                                               1.3s
 => [base 1/6] FROM quay.io/evl.ms/fullstaq-ruby:3.1.2-jemalloc-bullseye-slim@sha256:6a18708ef1cbc3dfa8c14a1fa3942d8b13c2ed2eebf5caa30e7099b11f2ae120    0.0s
 => CACHED [base 2/6] RUN mkdir /app                                                                                                                     0.0s
 => CACHED [base 3/6] WORKDIR /app                                                                                                                       0.0s
 => CACHED [base 4/6] RUN mkdir -p tmp/pids                                                                                                              0.0s
 => CACHED [base 5/6] RUN curl https://get.volta.sh | bash                                                                                               0.0s
 => ERROR [base 6/6] RUN volta install node@16.14.2 yarn@1.22.19 &&     gem update --system --no-document &&     gem install -N bundler -v 2.3.7         0.3s
------                                                                                                                                                        
 > [base 6/6] RUN volta install node@16.14.2 yarn@1.22.19 &&     gem update --system --no-document &&     gem install -N bundler -v 2.3.7:
#11 0.255 /bin/bash: line 1: volta: command not found
------
Error failed to fetch an image or build from source: error building: executor failed running [/bin/bash -o pipefail -c volta install node@${NODE_VERSION} yarn@${YARN_VERSION} &&     gem update --system --no-document &&     gem install -N bundler -v ${BUNDLER_VERSION}]: exit code: 127
=> CACHED [base 5/6] RUN curl https://get.volta.sh | bash                                                                                               0.0s
 => ERROR [base 6/6] RUN volta install node@16.14.2 yarn@1.22.19

That’s odd. The call to install volta worked [base 5/6], but it doesn’t appear to be installed when the build process reaches the next step.

I will say that it looks like you are using a Dockerfile that was either generated at least a few weeks ago, or was generated with an old version of flyctl. We’ve made a lot of improvements since then in handling of Rails API-only applications.

If you haven’t invested too much time into this yes, deleting your fly application as well as Dockerfile, fly.toml, and lib/tasks/fly.rake; updating flyctl to the latest version and rerunning fly launch will likely produce a much better first experience.

Otherwise, you can generate a newer Dockerfile with the following commands:

bundle add dockerfile-rails --optimistic --group development
bin/rails generate dockerfile --postgresql --force

I’m guessing that you are using PostgreSQL as most do. But change this flag if you are using something different. Review the Dockerfiles and fly.toml · Fly Docs to see if you want to make other changes.

And you will need to make the following changes to your fly.toml:

  • Delete the [deploy] section, including the release_command
  • Change /app to /rails as the value of guest_path in the [[statics]] section.
1 Like

Thanks very much!

Generate a newer Dockerfile worked!

Deploy worked well one week ago, I don’t know why it gets odd today.

Anyway solved!