Is there a way to use capistrano (or similar) to remotely interact with rails console

后端 未结 6 631
情话喂你
情话喂你 2021-02-03 11:50

I\'m loving how capistrano has simplified my deployment workflow, but often times a pushed change will run into issues that I need to log into the server to troubleshoot via the

6条回答
  •  臣服心动
    2021-02-03 12:31

    cap -T

    cap invoke                        # Invoke a single command on the remote ser...
    cap shell                         # Begin an interactive Capistrano session.
    

    cap -e invoke

    ------------------------------------------------------------
    cap invoke
    ------------------------------------------------------------
    Invoke a single command on the remote servers. This is useful for performing
    one-off commands that may not require a full task to be written for them. Simply
    specify the command to execute via the COMMAND environment variable. To execute
    the command only on certain roles, specify the ROLES environment variable as a
    comma-delimited list of role names. Alternatively, you can specify the HOSTS
    environment variable as a comma-delimited list of hostnames to execute the task
    on those hosts, explicitly. Lastly, if you want to execute the command via sudo,
    specify a non-empty value for the SUDO environment variable.
    
    Sample usage:
    
      $ cap COMMAND=uptime HOSTS=foo.capistano.test invoke
      $ cap ROLES=app,web SUDO=1 COMMAND="tail -f /var/log/messages" invoke
    

提交回复
热议问题