Home>

Hello! I'm studying Ruby and Rails by myself.
I was able to publish the Rails application on EC2 on AWS safely, but the following error occurred when I set up automatic deployment with Capistrano.
I couldn't understand even after searching, so I will ask you a question.
The app is deployed in the AWS EC2 "/ var/www/book_list/book_list-server" location.
What does the following error mean? Thank you in advance.
* S3_ACCESS_KEY and S3_SECRET_KEY are AWS S3 keys.

(Backtrace restricted to imported tasks)
cap aborted!
Don't know how to build task 'unicorn: restart' (see --tasks)
Tasks: TOP =>deploy: restart
(See full trace by running task with --trace)
The deploy has failed with an error: Don't know how to build task 'unicorn: restart' (see --tasks)

** DEPLOY FAILED
** Refer to log/capistrano.log for details. Here are the last 20 lines:

 DEBUG [9e3f9022] Running/usr/bin/env ls /var/www/book_list/releases/20180828135951/public/assets/.sprockets-manifest* as ec2-admin-user @ ip address
 DEBUG [9e3f9022] Command: cd/var/www/book_list/releases/20180828135951&&(export S3_ACCESS_KEY = "" S3_SECRET_KEY = "" RBENV_ROOT = "$HOME/.rbenv" RBENV_VERSION = "2.3.4";/usr/bin/env ls /var/www/book_list/releases/20180828135951/public/assets/.sprockets-manifest*)
 DEBUG [ef0158ca] /var/www/book_list/releases/20180828135951/public/assets/.sprockets-manifest-5979c1e5c7fd9762fcdb7db115c8391e.json
 DEBUG [ef0158ca] Finished in 0.264 seconds with exit status 0 (successful).
  INFO [24606236] Running/usr/bin/env cp /var/www/book_list/releases/20180828135951/public/assets/.sprockets-manifest-5979c1e5c7fd9762fcdb7db115c8391e.json/var/www/book_list/releases/20180828135951/assets_manifestbackup admin-user @ ip address
 DEBUG [24606236] Command: cd/var/www/book_list/releases/20180828135951&&(export S3_ACCESS_KEY = "" S3_SECRET_KEY = "" RBENV_ROOT = "$HOME/.rbenv" RBENV_VERSION = "2.3.4";/usr/bin/env cp /var/www/book_list/releases/20180828135951/public/assets/.sprockets-manifest-5979c1e5c7fd9762fcdb7db115c8391e.json/var/www/book_list/releases/20180828135951/assets_manifest_backup)
  INFO [9d1d9225] Finished in 0.293 seconds with exit status 0 (successful).
  INFO [deploy: migrate] Run `rake db: migrate`
 DEBUG [2c574870] Running if test! -D/var/www/book_list/releases/20180828135951;then echo "Directory does not exist '/ var/www/book_list/releases/20180828135951'" 1>&2;false;fi as ec2-admin-user @ ip address
 DEBUG [2c574870] Command: if test! -D/var/www/book_list/releases/20180828135951;then echo "Directory does not exist '/ var/www/book_list/releases/20180828135951'" 1>&2;false;fi
 DEBUG [3b389d45] Finished in 0.285 seconds with exit status 0 (successful).
  INFO [033ff39d] Running $HOME/.rbenv/bin/rbenv exec bundle exec rake db: migrate as ec2-admin-user @ ip address
 DEBUG [033ff39d] Command: cd/var/www/book_list/releases/20180828135951&&(export S3_ACCESS_KEY = "" S3_SECRET_KEY = "" RBENV_ROOT = "$HOME/.rbenv" RBENV_VERSION = "2.3.4" RAILS_ENV = " production ";$HOME/.rbenv/bin/rbenv exec bundle exec rake db: migrate)
  INFO [7a8aa5dd] Finished in 3.425 seconds with exit status 0 (successful).
  INFO [e9f28ae0] Running/usr/bin/env ln -s/var/www/book_list/releases/20180828135951/var/www/book_list/releases/current as ec2-admin-user @ ip address
 DEBUG [e9f28ae0] Command: (export S3_ACCESS_KEY = "" S3_SECRET_KEY = "" RBENV_ROOT = "$HOME/.rbenv" RBENV_VERSION = "2.3.4";/usr/bin/env ln -s/var/www/book_list/releases/20180828135951/var/www/book_list/releases/current)
  INFO [6fbb68c8] Finished in 0.236 seconds with exit status 0 (successful).
  INFO [a279d43f] Running/usr/bin/env mv/var/www/book_list/releases/current/var/www/book_list as ec2-admin-user @ ip address
 DEBUG [a279d43f] Command: (export S3_ACCESS_KEY = "" S3_SECRET_KEY = "" RBENV_ROOT = "$HOME/.rbenv" RBENV_VERSION = "2.3.4";/usr/bin/env mv/var/www/book_list/releases/current/var/www/book_list)
  INFO [3d063709] Finished in 0.240 seconds with exit status 0 (successful).</Code></pre>
<p>The execution result of bundle exec cap -T is as follows.</p>
<pre><code>cap bundler: clean # Remove unused gems installed by bundler
cap bundler: install # Install the current Bundler environment
cap bundler: map_bins # Maps all binaries to use `bundle exec` by default
cap deploy # Deploy a new release
cap deploy: check # Check required files and directories existcap deploy: check: directories # Check shared and release directories exist
cap deploy: check: linked_dirs # Check directories to be linked exist in shared
cap deploy: check: linked_files # Check files to be linked exist in shared
cap deploy: check: make_linked_dirs # Check directories of files to be linked exist in shared
cap deploy: cleanup # Clean up old releases
cap deploy: cleanup_assets # Cleanup expired assets
cap deploy: cleanup_rollback # Remove and archive rolled-back release
cap deploy: clobber_assets # Clobber assets
cap deploy: compile_assets # Compile assets
cap deploy: db_create # Create database
cap deploy: finished # Finished
cap deploy: finishing # Finish the deployment, clean up server (s)
cap deploy: finishing_rollback # Finish the rollback, clean up server (s)
cap deploy: log_revision # Log details of the deploy
cap deploy: migrate # Runs rake db: migrate if migrations are set
cap deploy: migrating # Runs rake db: migrate
cap deploy: normalize_assets # Normalize asset timestamps
cap deploy: published # Published
cap deploy: publishing # Publish the release
cap deploy: restart # Restart application
cap deploy: revert_release # Revert to previous release timestamp
cap deploy: reverted # Reverted
cap deploy: reverting # Revert server (s) to previous release
cap deploy: rollback # Rollback to previous release
cap deploy: rollback_assets # Rollback assets
cap deploy: seed # Run seed
cap deploy: set_current_revision # Place a REVISION file with the current revision SHA in the current release path
cap deploy: started # Started
cap deploy: starting # Start a deployment, make sure server (s) ready
cap deploy: symlink: linked_dirs # Symlink linked directories
cap deploy: symlink: linked_files # Symlink linked files
cap deploy: symlink: release # Symlink release to current
cap deploy: symlink: shared # Symlink files and directories from shared to release
cap deploy: updated # Updated
cap deploy: updating # Update server (s) by setting up a new release
cap doctor # Display a Capistrano troubleshooting report (all doctor: tasks)
cap doctor: environment # Display Ruby environment details
cap doctor: gems # Display Capistrano gem versions
cap doctor: servers # Display the effective servers configuration
cap doctor: variables # Display the values ​​of all Capistrano variables
cap install # Install Capistrano, cap install STAGES = staging, production
  • Answer # 1

      

    Don't know how to build task'unicorn: restart'(see --tasks)

    The error message

    means that the taskunicorn: restartis not defined. Certainly not as far as looking at capistrano tasks.
    Probably it is because unicorn: restart is called in deploy: restart, and it is an error because it does not exist.

    The solution is

    Use Capistrano3 Unicorn

    Use Capistrano :: UnicornNginx

    Write your own task Reference: https://qiita.com/yu_0105/items/087055eaabfef022142f

    etc.