Skip to content

Sometimes, set :unicorn_exec not working... #60

@sizer

Description

@sizer

deploy.rb

lock '3.11.0'
....
set :unicorn_exec, :unicorn_rails
...
namespace :unicorn do
  before :start, :logging

  task :logging do
    on roles :app do
      execute :echo, fetch(:unicorn_exec)
    end
  end
end

and execute log is below.

sizer@geb:~/capistrano3-unicorn-test
$ bundle exec cap staging unicorn:start
00:00 unicorn:logging
      01 echo unicorn_rails
      01 unicorn_rails
    ✔ 01 centos@staging 0.178s
00:00 unicorn:start
      01 RBENV_ROOT=~/.rbenv/ RBENV_VERSION=2.4.5 ~/.rbenv/bin/rbenv exec bundle exec unicorn -c ./config/unicorn.rb -E staging -D 
    ✔ 01 centos@staging 9.317s

echo returns 'unicorn_rails' correctly, but unicorn:start returns default value... 🤔

execute() has a subtle behaviour. When calling within './directory' { execute(:bundle, :install) } for example, the first argument to execute() is a Stringish with no whitespace. This allows the command to pass through the SSHKit::CommandMap which enables a number of powerful features.
https://capistranorb.com/documentation/getting-started/tasks/

I recommend that removing whitespace from tasks/unicorn.rake .

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions