The following cap commands are available now, but I am unable to start unicorn using unicorn:start.
cap -vT
cap bundle:install # Install the current Bundler environment.
cap deploy # Deploys your project.
cap deploy:assets:clean # Run the asset clean rake task.
cap deploy:assets:clean_expired # Clean up any assets that haven't been...
cap deploy:assets:precompile # Run the asset precompilation rake task.
cap deploy:assets:rollback # to shared/assets/manifest.yml, and fi...
cap deploy:assets:symlink # [internal] This task will set up a sy...
cap deploy:assets:update_asset_mtimes # [internal] Updates the mtimes for ass...
cap deploy:check # Test deployment dependencies.
cap deploy:cleanup # Clean up old releases.
cap deploy:cold # Deploys and starts a `cold' application.
cap deploy:create_symlink # Updates the symlink to the most recen...
cap deploy:finalize_update # [internal] Touches up the released code.
cap deploy:migrate # Run the migrate rake task.
cap deploy:migrations # Deploy and run pending migrations.
cap deploy:pending # Displays the commits since your last ...
cap deploy:pending:diff # Displays the `diff' since your last d...
cap deploy:restart # Blank task exists as a hook into whic...
cap deploy:rollback # Rolls back to a previous version and ...
cap deploy:rollback:cleanup # [internal] Removes the most recently ...
cap deploy:rollback:code # Rolls back to the previously deployed...
cap deploy:rollback:revision # [internal] Points the current symlink...
cap deploy:setup # Prepares one or more servers for depl...
cap deploy:start # Blank task exists as a hook into whic...
cap deploy:stop # Blank task exists as a hook into whic...
cap deploy:symlink # Deprecated API.
cap deploy:update # Copies your project and updates the s...
cap deploy:update_code # Copies your project to the remote ser...
cap deploy:upload # Copy files to the currently deployed ...
cap development # Set the target stage to `development'.
cap invoke # Invoke a single command on the remote...
cap multistage:ensure # [internal] Ensure that a stage has be...
cap multistage:prepare # Stub out the staging config files.
cap production # Set the target stage to `production'.
cap rvm:create_gemset # Create gemset
cap rvm:install_gem # Install a gem, 'cap rvm:install_gem G...
cap rvm:install_ruby # Install RVM ruby to the server, creat...
cap rvm:install_rvm # Install RVM of the given choice to th...
cap rvm:uninstall_gem # Uninstall a gem, 'cap rvm:uninstall_g...
cap shell # Begin an interactive Capistrano session.
cap staging # Set the target stage to `staging'.
Extended help may be available for these tasks.
Type `cap -e taskname' to view it.
Following gems are available
gem list --local | grep cap
capistrano (2.14.1)
capistrano-ext (1.2.1)
capistrano-unicorn (0.1.6)
rvm-capistrano (1.2.7)
It seems that you haven't required it in your deploy.rb.
require 'capistrano-unicorn'
Related
So I have a rails 6 app that doesn't load any css or javascript assets when I run cap production deploy.
So what I do is after I run cap production deploy, I ssh into my server, navigate to myapp/current/ and run bin/webpack and then everything works. So I'd like my deployment process to do this for me so that I don't have to go into my server and run this everytime.
I've looked on how to run custom capistrano "tasks," but all the tutorials show you only how to run custom rake tasks, but this isn't a rake task.
I don't run rake bin/webpack, i just run bin/webpack.
So how I would go about implementing this in my capistrano setup? I assume I have to enter some sort of capistrano command in my deploy.rb.
Any ideas?
Capistrano at its core is just ssh. It's doing something similar to what you're doing when you ssh (although slightly different because it's not typically an interactive session).
You could write a custom task to run Webpack.
To do that you need to load them first if they're not already being loaded.
Check for this line in your Capfile or add it yourself. This will load your custom tasks which come in the form of rake tasks:
# Load custom tasks from `lib/capistrano/tasks` if you have any defined
Dir.glob("lib/capistrano/tasks/*.rake").each { |r| import r }
Then, create a task in that folder. Call it something like lib/capistrano/tasks/webpack.rake
namespace :webpack do
task :build do
on roles(:app) do
within release_path do
# https://github.com/capistrano/sshkit#the-command-map
with path: "#{release_path}/bin:$PATH" do
execute :webpack
end
end
end
end
end
Now, you need to tell Capistrano when to execute it. I usually do this with before/after hooks. For more info check out Capistrano flow
after the namespace block add:
# lib/capistrano/tasks/webpack.rake
# ...
after "deploy:updated", "webpack:build"
you can test out task execution with bundle exec cap production deploy --dry-run
A coworker is getting different results for cap -vT unicorn compared to me, for the same version of capistrano, and the same Rails app:
app_name coworker$ cap -vT unicorn
cap unicorn:add_worker # Add a new worker
cap unicorn:duplicate # Duplicate Unicorn
cap unicorn:reload # Reload Unicorn
cap unicorn:remove_worker # Remove amount of workers
cap unicorn:restart # Restart Unicorn
cap unicorn:show_vars # Debug Unicorn variables
cap unicorn:shutdown # Immediately shutdown Unicorn
cap unicorn:start # Start Unicorn master process
cap unicorn:stop # Stop Unicorn
me:
app_name agrimm$ cap -vT unicorn
cap unicorn:graceful_stop # Unicorn graceful shutdown
cap unicorn:reload # Reload Unicorn
cap unicorn:start # Start Unicorn
cap unicorn:stop # Stop Unicorn
Extended help may be available for these tasks.
Type `cap -e taskname' to view it.
config/deploy.rb has require 'capistrano-unicorn'
My suspicion is that I'm not getting the tasks from capistrano unicorn, but what's going wrong? How do I diagnose the problem?
I have two resque commands that I'd like to implement into capistrano so I can run it successfully on the server. I've checked by running these manually that they both work, however if I'm to keep these continuously running I'll end up with a broken pipe.
I'd like to be able to start resque:
queue=* rake environment resque:work
and start resque-scheduler:
rake environment resque:scheduler
anybody know how I can implement this into my deploy.rb file?
Try the capistrano-resque gem which should do exactly this (it includes support for resque-scheduler).
After setting it up, you'll get these Capistrano tasks:
➔ cap -vT | grep resque
cap resque:status # Check workers status
cap resque:start # Start Resque workers
cap resque:stop # Quit running Resque workers
cap resque:restart # Restart running Resque workers
cap resque:scheduler:restart #
cap resque:scheduler:start # Starts Resque Scheduler with default configs
cap resque:scheduler:stop # Stops Resque Schedule
(I currently help maintain this gem, so if you have any trouble with it just file an issue and I'll take a look).
Deploying rails app throw Capistrano first time: I deployed my rails app on another machine (server)
File structure for rails app ## this is my server
akshay#akshay:/var/www/model_demo$ ls
current releases repo revisions.log shared
cap -T ## showing a lots of rake task
like
cap deploy:migrate # Runs rake db:migrate if migrations are set
If I run this task it is not working saying
Stage not set, please call something such as `cap production deploy`, where production is a stage you have defined.
But when I run
cap production deploy # It works
Among all the listed task only cap production deploy
1: what exactly going on under the hood?
2: How might i run rake task which is provided by cap?
Any help would be appreciated !!!
Capistrano recepies are meant to run on local system.
Run it locally.
I catch my mistake. And as I followed Railscasts Capistrano screencasts, stackoverflow Capistrano Tags and deploying-rails-apps-to-a-vps-with-capistrano-v3.
As all cap tasks run locally.
cap production deploy:migrate # Worked for me
Thanks to #maxd !!!
I'm get a Capistrano recipe to work with Bundler and a Rails (3.0.3) app but having trouble with some basic functionality.
Following the Bundler docs for "Automatic deployment with Capistrano", I'm trying to get more info on a task but for some reason it "doesn't exist"...
$ cap -e bundle:install
The task `bundle:install' does not exist.
The Capistrano (2.5.19) gem is installed and I'm trying to execute that command from the root of my project on the client (not the server).
in fact cap -T doesn't show anything related to 'bundle' or 'install'
$ cap -T
cap deploy # Deploys your project.
cap deploy:check # Test deployment dependencies.
cap deploy:cleanup # Clean up old releases.
cap deploy:cold # Deploys and starts a `cold' application.
cap deploy:migrate # Run the migrate rake task.
cap deploy:migrations # Deploy and run pending migrations.
cap deploy:pending # Displays the commits since your last deploy.
cap deploy:pending:diff # Displays the `diff' since your last deploy.
cap deploy:restart # Restarts your application.
cap deploy:rollback # Rolls back to a previous version and restarts.
cap deploy:rollback:code # Rolls back to the previously deployed version.
cap deploy:setup # Prepares one or more servers for deployment.
cap deploy:start # Start the application servers.
cap deploy:stop # Stop the application servers.
cap deploy:symlink # Updates the symlink to the most recently deployed ...
cap deploy:update # Copies your project and updates the symlink.
cap deploy:update_code # Copies your project to the remote servers.
cap deploy:upload # Copy files to the currently deployed version.
cap deploy:web:disable # Present a maintenance page to visitors.
cap deploy:web:enable # Makes the application web-accessible again.
cap invoke # Invoke a single command on the remote servers.
cap shell # Begin an interactive Capistrano session.
What am I doing wrong?
Did you include the recipe in your deploy.rb file?
require "bundler/capistrano"