Error: Don't know how to build task 'resque:restart'

Hi guys,

I am a member of a foodcoop in Gießen (Germany) and we would like to use foodsoft :wink:
After I set up the server for rails, I cloned the code from Git and adjusted the deploy.rb and the other stuff.
The ``bundle exec cap staging deploy:check -command gives the error-message:

Don’t know how to build task ‘resque:restart’ (see --tasks)
config/deploy.rb:42:in block in <top (required)>' config/deploy.rb:32:in <top (required)>’
/home/deploy/.rbenv/versions/2.2.3/bin/cap:23:in load' /home/deploy/.rbenv/versions/2.2.3/bin/cap:23:in
Tasks: TOP => staging
(See full trace by running task with --trace)

I tried to require ‘resque’ in the capfile, but this didn’t work.
Does anyone know how to fix it?

Cheers,
Maxi

Hi,

Nice you hear you’re getting started! As you’ve probably found, deployment documentation is a little sparse. Glad you’ve found the mailing-list.

At least in the past, capistrano included this at the end of the generated Capfile (iirc):

# Loads custom tasks from lib/capistrano/tasks’ if you have any defined. Dir.glob(‘lib/capistrano/tasks/*.{cap,rake}’).each { |r| import r }`

This should include the resque tasks in lib/capistrano/tasks/resque.rb.
Does that help?

Regards,

  • Willem

Thank you very much! That worked! The last line of the created Capfile was
Dir.glob(‘lib/capistrano/tasks/*.rake’).each { |r| import r }

Now, there is the next problem :wink: Thank you again for your help :slight_smile:
I didn’t get how to adjust the production.rb and staging.rb
Is this all I need?
role :web, %w{deploy@biomio-giessen.de :3000}

Yours,
Maxi

INFO [fbbdb1a8] Running /usr/bin/env mkdir -p /tmp/foodsoft/ as
deploy@example.com
Net::SSH::ConnectionTimeout: Net::SSH::ConnectionTimeout
Did you configure everything in config/deploy.rb and config/deploy/*
correctly? It’s a bit odd that example.com appears here.

Errno::ETIMEDOUT: Connection timed out - connect(2) for
[2a01:238:20a:202:1070::]:22
I’m not sure where this ip-address comes from.

Hi, thank you for your quick response.

Yes, I forgot to adjust the staging.rb, but there is still the same error…
What do I need to adjust exactly in production.rb and staging.rb?
I just added a # before each line and so there is just this
role :web, %w{deploy@biomio-giessen.de :3000}
over in each file. I think thats not everything :wink:

Yours,
Maxi

Hmm, it’s been a while that I’ve configured capistrano.
My production.rb contains something like this

server ‘foo.example.com’, roles: [:web, :app, :resque, :db]

I’m not 100% sure if adding a port like you do works. You may try to
configure the host with port in your ~/.ssh/config instead.

This worked for me :wink:

  • deleted -

I tried to configurate Nginx and Unicorn, but In my environment is no index.html…

Rails doesn’t work with an index.html. Since you’re mentioning Unicorn, I suppose you’d like to run the Rails app with that and have Nginx act as a reverse proxy. There are many tutorials on the internet about this.
Most of my production deployments are using Passenger, where you configure a specific directory to be a Rack app. It then runs config.ru in a Ruby environment, without the need to setup a separate server.
Both will work, when setup correctly.

  • Willem

Ok, thank you! After wasting some ours on Unicorn, I tried to use passenger…
I adjusted Nginx for phusion passenger and they are working now, but the app doesn’t work…
When I stop Nginx and try to execute passenger, passenger is freezing…

me@h2540559:~/foodsoft$ exec passenger start --user deploy --environment production
=============== Phusion Passenger Standalone web server started ===============
PID file: /home/deploy/foodsoft/tmp/pids/passenger.3000.pid
Log file: /home/deploy/foodsoft/log/passenger.3000.log
Environment: production
Accessible via: http://0.0.0.0:3000/

You can stop Phusion Passenger Standalone by pressing Ctrl-C.
Problems? Check https://www.phusionpassenger.com/library/admin/standalone/troubleshooting/

App 18278 stdout:
I, [2016-03-02T20:38:53.872351 #18278] INFO – : Loading app configuration from config/app_config.yml

Easiest would be to run passenger from within nginx. With passenger
standalone it should also work - are you sure it’s freezing, or merely
waiting for connections?

I hope you’ve found this already (including next steps):
https://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/install_language_runtime.html

Yes I run passenger from within nginx, but there is just no output and no error…
I tested my phusion-passenger/nginx configuration on the rails testapp and everything worked fine…

The log from passenger is:
[ 2016-03-02 22:39:23.7420 27086/7fa0b89a9700 age/Cor/CoreMain.cpp:532 ]: Signal received. Gracefully shutting down… (send signal 2 more time(s) to force shutdown)
[ 2016-03-02 22:39:23.7421 27086/7fa0bf37c7c0 age/Cor/CoreMain.cpp:901 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected…
[ 2016-03-02 22:39:23.7421 27086/7fa0bf37c7c0 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 27143, application /home/deploy/foodsoft/public (production)
[ 2016-03-02 22:39:23.7423 27086/7fa0b7fa8700 Ser/Server.h:817 ]: [ServerThr.2] Freed 128 spare client objects
[ 2016-03-02 22:39:23.7424 27086/7fa0b7fa8700 Ser/Server.h:464 ]: [ServerThr.2] Shutdown finished
[ 2016-03-02 22:39:23.7425 27086/7fa0b89a9700 Ser/Server.h:817 ]: [ServerThr.1] Freed 128 spare client objects
[ 2016-03-02 22:39:23.7425 27086/7fa0b89a9700 Ser/Server.h:464 ]: [ServerThr.1] Shutdown finished
[ 2016-03-02 22:39:23.7426 27086/7fa0b7526700 Ser/Server.h:817 ]: [ApiServer] Freed 0 spare client objects
[ 2016-03-02 22:39:23.7426 27086/7fa0b7526700 Ser/Server.h:464 ]: [ApiServer] Shutdown finished
[ 2016-03-02 22:39:23.7426 27086/7fa0bf37c7c0 age/Cor/CoreMain.cpp:819 ]: Checking whether to disconnect long-running connections for process 27143, application /home/deploy/foodsoft/public (production)

[ 2016-03-02 22:39:23.7538 27091/7f7d9af9a700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down… (send signal 2 more time(s) to force shutdown)
[ 2016-03-02 22:39:23.7539 27091/7f7da17a87c0 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected…
[ 2016-03-02 22:39:23.7539 27091/7f7d9a599700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2016-03-02 22:39:23.7539 27091/7f7d9a599700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2016-03-02 22:39:23.7542 27091/7f7d9af9a700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2016-03-02 22:39:23.7543 27091/7f7da17a87c0 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2016-03-02 22:39:24.3609 27086/7fa0bf37c7c0 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished

And the nginx log

[ 2016-03-02 22:38:08.6037 26192/7f3bc82be700 age/Ust/UstRouterMain.cpp:422 ]: Signal received. Gracefully shutting down… (send signal 2 more time(s) to force shutdown)
[ 2016-03-02 22:38:08.6038 26192/7f3bceacc7c0 age/Ust/UstRouterMain.cpp:492 ]: Received command to shutdown gracefully. Waiting until all clients have disconnected…
[ 2016-03-02 22:38:08.6038 26192/7f3bc78bd700 Ser/Server.h:817 ]: [UstRouterApiServer] Freed 0 spare client objects
[ 2016-03-02 22:38:08.6038 26192/7f3bc78bd700 Ser/Server.h:464 ]: [UstRouterApiServer] Shutdown finished
[ 2016-03-02 22:38:08.6040 26192/7f3bc82be700 Ser/Server.h:464 ]: [UstRouter] Shutdown finished
[ 2016-03-02 22:38:08.6042 26192/7f3bceacc7c0 age/Ust/UstRouterMain.cpp:523 ]: Passenger UstRouter shutdown finished
[ 2016-03-02 22:38:09.2648 26185/7fb57079d7c0 age/Cor/CoreMain.cpp:967 ]: Passenger core shutdown finished
2016/03/02 22:46:21 [info] 27379#0: Using 32768KiB of shared memory for push module in /etc/nginx/nginx.conf:73
[ 2016-03-02 22:46:29.0813 27396/7fd4dc2797c0 age/Wat/WatchdogMain.cpp:1276 ]: Starting Passenger watchdog…
[ 2016-03-02 22:46:29.0884 27399/7f2a57dee7c0 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core…
[ 2016-03-02 22:46:29.0886 27399/7f2a57dee7c0 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2016-03-02 22:46:29.0902 27399/7f2a57dee7c0 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 27399
[ 2016-03-02 22:46:29.1545 27404/7f87614987c0 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter…
[ 2016-03-02 22:46:29.1555 27404/7f87614987c0 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 27404
App 27430 stdout:
App 27526 stdout:

I found some freezing issues with passenger in the internet, but thats really hard to debug.

Hi,

on what system are you running your deployment?
rvm or rbenv and which ruby version are you using? I tried reset the server and deploy it again with rvm but there is still no progress…

Yours,
Maxi

My setup is (mostly) described on
https://github.com/foodcoop-adam/foodsoft/wiki/Deployment-(Debian)
Current versions:
RVM 1.26.9
Ruby 2.1.5p273
Apache 2.2.22 with mpm-worker
Passenger 5.0.0.beta2 (oops, really? I should upgrade)

I’ve never had much problems with RVM, Ruby or Apache versions. Having
used different versions of Passenger, mostly I didn’t find any problem.
Hope this helps a bit.

Something that may be a problem is permissions: what user are your Ruby
processes running as, and as what user did you deploy Foodsoft? The
easiest is to run as the deployment user (though a little bit less
secure). Passenger has options to configure the user.

  • Willem