Kamal with a rails 6.1 and ruby 3.0

Can i use Kamal with: ruby ‘~> 3.0.1’ and gem ‘rails’, ‘~> 6.1.7.1’

is Kamal only available for rails 7+ app ? I didn’t find info about this point on the doc. Thanks

i get an error when:
kamal init --bundle

Created configuration file in config/deploy.yml
Created sample hooks in .kamal/hooks
Adding Kamal to Gemfile and bundle...
  INFO [a57509ff] Running /usr/bin/env bundle add kamal as sebastien@localhost
  ERROR (SSHKit::Command::Failed): bundle exit status: 1536
bundle stdout: Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
bundle stderr: Could not find compatible versions

Because rails >= 6.1.7.1, < 6.1.7.2 depends on railties = 6.1.7.1
  and rails >= 6.1.7.2, < 6.1.7.3 depends on railties = 6.1.7.2,
  rails >= 6.1.7.1, < 6.1.7.3 requires railties = 6.1.7.1 OR = 6.1.7.2.
And because rails >= 6.1.7.3, < 6.1.7.4 depends on railties = 6.1.7.3,
rails >= 6.1.7.1, < 6.1.7.4 requires railties = 6.1.7.1 OR = 6.1.7.2 OR =
6.1.7.3.
And because rails >= 6.1.7.4, < 6.1.7.5 depends on railties = 6.1.7.4
  and rails >= 6.1.7.5, < 6.1.7.6 depends on railties = 6.1.7.5,
rails >= 6.1.7.1, < 6.1.7.6 requires railties = 6.1.7.1 OR = 6.1.7.2 OR =
6.1.7.3 OR = 6.1.7.4 OR = 6.1.7.5.
And because rails >= 6.1.7.6, < 7.0.0.alpha1 depends on railties = 6.1.7.6
  and railties >= 6.1.7.6, < 7.0.0 depends on activesupport = 6.1.7.6,
rails >= 6.1.7.1, < 7.0.0.alpha1 requires activesupport = 6.1.7.6 or railties
= 6.1.7.1 OR = 6.1.7.2 OR = 6.1.7.3 OR = 6.1.7.4 OR = 6.1.7.5.
And because railties >= 6.1.7.5, < 6.1.7.6 depends on activesupport = 6.1.7.5
  and railties >= 6.1.7.4, < 6.1.7.5 depends on activesupport = 6.1.7.4,
rails >= 6.1.7.1, < 7.0.0.alpha1 requires activesupport = 6.1.7.4 OR = 6.1.7.5
OR = 6.1.7.6 or railties = 6.1.7.1 OR = 6.1.7.2 OR = 6.1.7.3.
And because railties < 6.1.7.4 depends on activesupport = 6.1.7.3
  and every version of kamal depends on activesupport >= 7.0,
  every version of kamal is incompatible with rails >= 6.1.7.1, < 7.0.0.alpha1.
So, because Gemfile depends on rails ~> 6.1.7.1
  and Gemfile depends on kamal >= 0,
  version solving has failed.
1 Like

kamal requires Active Support 7.0 or higher. So Rails 6.1 or lower versions of Rails are not supported.

Thanks for your feedback!

You should NOT install Kamal in the application Gemfile. You can install Kamal as a global executable (gem install kamal) or use a another Gemfile for that (bundle install --gemfile kamal.gemfile). DHH deploys Rails 2.3 application with Kamal.

Interesting, i will give a try with my configuration. And give you a feedback.

my source is : https://greg.molnar.io/blog/deploying-a-rails-app-with-kamal/

Noticed your link says “gem install kamal” not “bundle install kamal”. The bundle version add Kamal to the Gemfile. Because it is with gem install, it won’t interfere with your app.

1 Like

I’m stuck around this error since a moment.

i use: ruby 3.0.1 rails 6.1.7.1

i get this error when i use ‘kamal setup’

and in production.rb, this line is commented # config.require_master_key = true

------
Dockerfile:39
--------------------
  37 |     
  38 |     # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
  39 | >>> RUN SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile
  40 |     
  41 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c SECRET_KEY_BASE_DUMMY=1 ./bin/rails assets:precompile" did not complete successfully: exit code: 1

i used EDITOR="code --wait" rails credentials:edit to be sure to have clean credentials.

i found some work around but it was for rails 7.0 &7.1

https://www.reddit.com/r/rails/comments/191n2cl/error_doing_a_kamal_deploy/

I’m not sure when SECRET_KEY_BASE_DUMMY has been added. Try to replace it with SECRET_KEY_BASE.

So, try:

RUN SECRET_KEY_BASE=1 ./bin/rails assets:precompile

Thanks for your help. The error is still the same.

#21 [linux/amd64 build 6/6] RUN SECRET_KEY_BASE=1 ./bin/rails assets:precompile
#21 ERROR: process "/bin/sh -c SECRET_KEY_BASE=1 ./bin/rails assets:precompile" did not complete successfully: exit code: 1

#19 [linux/arm64 build 1/6] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y build-essential git libpq-dev libvips pkg-config curl node-gyp
#19 CANCELED

#14 [linux/arm64 stage-2 1/4] RUN apt-get update -qq &&     apt-get install --no-install-recommends -y libvips postgresql-client curl &&     rm -rf /var/lib/apt/lists /var/cache/apt/archives
#14 120.0 Preparing to unpack .../58-libcairo2_1.16.0-4+deb10u1_arm64.deb ...
#14 120.0 Unpacking libcairo2:arm64 (1.16.0-4+deb10u1) ...
#14 CANCELED
------
 > [linux/amd64 build 6/6] RUN SECRET_KEY_BASE=1 ./bin/rails assets:precompile:
------
Dockerfile:39
--------------------
  37 |     
  38 |     # Precompiling assets for production without requiring secret RAILS_MASTER_KEY
  39 | >>> RUN SECRET_KEY_BASE=1 ./bin/rails assets:precompile
  40 |     
  41 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c SECRET_KEY_BASE=1 ./bin/rails assets:precompile" did not complete successfully: exit code: 1