Coder Social home page Coder Social logo

Comments (10)

morgoth avatar morgoth commented on August 29, 2024

I'm using AWS registry and this way of getting token <%= %x(aws ecr get-login-password) %> works for me.
Is your command working whne invoked from irb console, ie %x(aws ecr get-login-password --region eu-west-1 --profile linked)

Anyway, this doesn't look like kamal issue but some local misconfiguration

from kamal.

dawidof avatar dawidof commented on August 29, 2024

Is your command working whne invoked from irb console, ie %x(aws ecr get-login-password --region eu-west-1 --profile linked)

yes, in irb token returns


kamal setup in verbose mode

kamal setup -v                                                                                                                                                                                                        ✭
  Finished all in 0.0 seconds
  ERROR (Errno::ENOENT): No such file or directory - aws
(erb):7:in ``'
(erb):7:in `<main>'
/usr/local/lib/ruby/3.2.0/erb.rb:429:in `eval'
/usr/local/lib/ruby/3.2.0/erb.rb:429:in `result'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:30:in `load_config_file'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `block in load_config_files'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `each'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `inject'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `load_config_files'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:16:in `create_from'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/commander.rb:14:in `config'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/commander.rb:121:in `hook'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/base.rb:144:in `run_hook'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/base.rb:85:in `mutating'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/main.rb:5:in `block in setup'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/base.rb:75:in `print_runtime'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/main.rb:4:in `setup'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
/usr/local/bundle/gems/kamal-1.3.1/bin/kamal:9:in `<top (required)>'
/usr/local/bundle/bin/kamal:25:in `load'
/usr/local/bundle/bin/kamal:25:in `<main>'

when I change my deploy.yml to

---
servers:
  - 192.168.1.100
registry:
  server: whatever
  username: AWS
  password: <%= %x(aws_test ecr get-login-password --region eu-west-1 --profile linked) %> # here aws_test not aws

it returns

kamal setup -v                                                                                                                                                                                                        ✭
  Finished all in 0.0 seconds
  ERROR (Errno::ENOENT): No such file or directory - aws_test
(erb):7:in ``'
(erb):7:in `<main>'
/usr/local/lib/ruby/3.2.0/erb.rb:429:in `eval'
/usr/local/lib/ruby/3.2.0/erb.rb:429:in `result'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:30:in `load_config_file'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `block in load_config_files'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `each'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `inject'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:23:in `load_config_files'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/configuration.rb:16:in `create_from'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/commander.rb:14:in `config'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/commander.rb:121:in `hook'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/base.rb:144:in `run_hook'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/base.rb:85:in `mutating'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/main.rb:5:in `block in setup'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/base.rb:75:in `print_runtime'
/usr/local/bundle/gems/kamal-1.3.1/lib/kamal/cli/main.rb:4:in `setup'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/bundle/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
/usr/local/bundle/gems/thor-1.3.0/lib/thor/base.rb:584:in `start'
/usr/local/bundle/gems/kamal-1.3.1/bin/kamal:9:in `<top (required)>'
/usr/local/bundle/bin/kamal:25:in `load'
/usr/local/bundle/bin/kamal:25:in `<main>'

from kamal.

dawidof avatar dawidof commented on August 29, 2024

Kamal::Cli::Main.new.setup works in rails c

3.2.2 :002 > Kamal::Cli::Main.new.setup
  INFO [616be28b] Running /usr/bin/env mkdir -p .kamal on 34.243.90.110
  INFO [616be28b] Finished in 1.066 seconds with exit status 0 (successful).
Acquiring the deploy lock...
Ensure Docker is installed...
  INFO [64a095cd] Running docker -v on 34.243.90.110
  INFO [64a095cd] Finished in 0.279 seconds with exit status 0 (successful).
  INFO [f96bc497] Running /usr/bin/env mkdir -p .kamal on 34.243.90.110
  INFO [f96bc497] Finished in 0.187 seconds with exit status 0 (successful).
Push env files...
  INFO [d99d2446] Running /usr/bin/env mkdir -p .kamal/env/roles on 34.243.90.110
  INFO [d99d2446] Finished in 0.176 seconds with exit status 0 (successful).

...

from kamal.

wenderjean avatar wenderjean commented on August 29, 2024

The error comes from %x() that's trying to execute a system command. The error suggests you don't have aws_cli installed or it is not visible somehow.

Look

$ irb
irb(main):002> %x(aws_test --version)
(irb):2:in ``': No such file or directory - aws_test (Errno::ENOENT)

irb(main):001> %x(aws --version)
"aws-cli/2.15.10 Python/3.11.6"

from kamal.

igor-alexandrov avatar igor-alexandrov commented on August 29, 2024

@dawidof are you getting this error in the GitHub Actions CI?

from kamal.

dawidof avatar dawidof commented on August 29, 2024

@dawidof are you getting this error in the GitHub Actions CI?

Refused from Kamal, in my case I'm using aws with load balancers, vpc and many other services from Amazon, and Kamal is not really made for such things, I'm using an old terraform and it works great, github actions also configured to build container and push to ECR.

from kamal.

igor-alexandrov avatar igor-alexandrov commented on August 29, 2024

It seems you do not understand how Kamal works. The configuration file is getting read locally in the environment where you executed the kamal deploy command. If you use GitHub Actions, then the aws command should exist on your runner. The correct way to pass secrets to the Kamal is by using environment variables:

password:
    - KAMAL_REGISTRY_PASSWORD

In this case, KAMAL_REGISTRY_PASSWORD can be set in the GitHub Actions workflow file by using https://github.com/aws-actions/amazon-ecr-login action.

from kamal.

morgoth avatar morgoth commented on August 29, 2024

@dawidof Can this issue be closed? Looks like it's not related to the kamal tool but the local setup.

from kamal.

dawidof avatar dawidof commented on August 29, 2024

@dawidof Can this issue be closed? Looks like it's not related to the kamal tool but the local setup.

As for me, it's related to Kamal, %x() is not being executed when trying to setup Kamal, but in irb works.

from kamal.

lucasmncastro avatar lucasmncastro commented on August 29, 2024

This happened with me because I was using kamal with docker and awscli wasn't there.

I fixed installing the gem.

from kamal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.