Matheus
Matheus

Reputation: 83

Capistrano failing at deploy:assets:precompile with SSHKit::Command::Failed: rake exit status: 1

Thanks for checking this out.

I've run into this recently. I would appreciate any idea on how to solve it.

I should note I'm pretty new to deploying Rails apps on private servers. I just happened to be opening a business with one of these apps and now I am stuck at this.

Here is the problem: Capistrano doesn't get past the task of deploy:assets:precompile giving the following error SSHKit::Command::Failed: rake exit status: 1

Check out log samples below

    ** Execute deploy:updated
                ** Invoke deploy:compile_assets (first_time)
                ** Invoke deploy:set_rails_env 
                ** Execute deploy:compile_assets
                ** Invoke deploy:assets:precompile (first_time)
                ** Execute deploy:assets:precompile
                00:22 deploy:assets:precompile
                      01 $HOME/.rbenv/bin/rbenv exec bundle exec rake assets:precompile
                      01 rake aborted!
                      01 Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1
                      01 

                (...) /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:29:in `block in parse'
                      01 /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:26:in `each'
                      01 /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:26:in `each_with_object'

            (...)

            #<Thread:0x00007fd8daf941c8@/home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:10 run> terminated with exception (report_on_exception is true):
            Traceback (most recent call last):
                1: from /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'
            /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute': Exception while executing as deploy@(SERVER IP): rake exit status: 1 (SSHKit::Runner::ExecuteError)
            rake stdout: Nothing written
            rake stderr: rake aborted!
            Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1

            (...)

            /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:29:in `block in parse'
            /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:26:in `each'

    (...)

        /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:15:in `rescue in block (2 levels) in execute'
        /home/deploy/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/sshkit-1.17.0/lib/sshkit/runners/parallel.rb:11:in `block (2 levels) in execute'

        Caused by:
        SSHKit::Command::Failed: rake exit status: 1
        rake stdout: Nothing written
        rake stderr: rake aborted!
        Psych::SyntaxError: (<unknown>): found character that cannot start any token while scanning for the next token at line 2 column 1

(...)    (See full trace by running task with --trace)
    ** Invoke deploy:failed (first_time)
    ** Execute deploy:failed


    ** DEPLOY FAILED

It's horrible because it's pretty big. I thought I would manage to fix it if it was smaller.

Upvotes: 3

Views: 1625

Answers (2)

Matheus
Matheus

Reputation: 83

I really managed to precompile assets on that precise capistrano task and now it went past it. The problem was that I had no secrets.yml at /parthumps/config but rather there was one only at /parthumps/shared/config.

Upvotes: 1

ac_8
ac_8

Reputation: 11

You're getting a Psych::SyntaxError when reading secrets (the stacktrace points to /home/deploy/parthumps/shared/bundle/ruby/2.5.0/gems/railties-5.2.1/lib/rails/secrets.rb:29)

Check that the secrets file (config/secrets.yml) is correct. Also try to run assets:precompile locally first to check if it's just a problem on the server.

Upvotes: 1

Related Questions