I'm trying to install Discourse in macOS for development, following the steps mentioned here: https://meta.discourse.org/t/beginners-guide-to-install-discourse-on-macos-for-development/15772
After following the steps mentioned here: https://community.unix.com/t/macos-catalina-discourse-development-environment-notes/378448 to run bundle install, I tried to use bundle exec rake db:migrate (as stated in installation instructions), and it showed me this error:
% bundle exec rake db:migrate
rake aborted!
ArgumentError: wrong number of arguments (given 1, expected 0; required keywords: site_setting_name, title, raw)
/Users/jonathanhung/discourse/lib/seed_data/topics.rb:126:in `create_topic'
/Users/jonathanhung/discourse/lib/seed_data/topics.rb:16:in `block (2 levels) in create'
/Users/jonathanhung/discourse/lib/seed_data/topics.rb:15:in `each'
/Users/jonathanhung/discourse/lib/seed_data/topics.rb:15:in `block in create'
/Users/Tim/bin/gems/i18n-1.8.10/lib/i18n.rb:314:in `with_locale'
/Users/jonathanhung/discourse/lib/seed_data/topics.rb:14:in `create'
(eval):14:in `block (2 levels) in run_file'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:46:in `eval'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:46:in `block (2 levels) in run_file'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:58:in `block in open'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:57:in `open'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:57:in `open'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:36:in `block in run_file'
/Users/Tim/bin/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `block in transaction'
/Users/Tim/bin/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:310:in `block in within_new_transaction'
/Users/Tim/bin/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
/Users/Tim/bin/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
/Users/Tim/bin/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
/Users/Tim/bin/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
/Users/Tim/bin/gems/activesupport-6.1.3.2/lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
/Users/Tim/bin/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/transaction.rb:308:in `within_new_transaction'
/Users/Tim/bin/gems/activerecord-6.1.3.2/lib/active_record/connection_adapters/abstract/database_statements.rb:320:in `transaction'
/Users/Tim/bin/gems/activerecord-6.1.3.2/lib/active_record/transactions.rb:209:in `transaction'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:35:in `run_file'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:26:in `block in run'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:25:in `each'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu/runner.rb:25:in `run'
/Users/Tim/bin/gems/seed-fu-2.3.9/lib/seed-fu.rb:29:in `seed'
/Users/jonathanhung/discourse/lib/tasks/db.rake:222:in `block in <main>'
/Users/Tim/bin/gems/rake-13.0.3/exe/rake:27:in `<top (required)>'
/Users/jonathanhung/.rbenv/versions/3.0.1/bin/bundle:23:in `load'
/Users/jonathanhung/.rbenv/versions/3.0.1/bin/bundle:23:in `<main>'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Does anyone know what I could do to fix it? Thank you for your feedback.
Note: I'm using macOS version 11.4
Downgrading ruby from 3.0.0 to 2.7.2 solves the issue
https://meta.discourse.org/t/discourse-installation-fails-on-database-migration/194867/5
Or you can change create_topic(params) to create_topic(**params) (update_topic as well)
Related
I'm trying to install webpacker on an older Rails app that has been upgraded to Rails 6.0
This command throws an error:
bundle exec rake webpacker:install
rake aborted!
ArgumentError: wrong number of arguments (given 2, expected 1)
Any suggestions on how to troubleshoot?
Thanks!
Ben
More info:
bundle exec rake webpacker:install --trace
** Invoke webpacker:install (first_time)
** Invoke webpacker:check_node (first_time)
** Execute webpacker:check_node
rake aborted!
ArgumentError: wrong number of arguments (given 2, expected 1)
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/json-1.8.6/lib/json/common.rb:155:in initialize' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/json-1.8.6/lib/json/common.rb:155:in new'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/json-1.8.6/lib/json/common.rb:155:in parse' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/webpacker-5.4.3/lib/tasks/webpacker/check_node.rake:10:in block (2 levels) in <top (required)>'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in block in execute' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in each'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:281:in execute' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:219:in block in invoke_with_call_chain'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in synchronize' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in invoke_with_call_chain'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:243:in block in invoke_prerequisites' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in each'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:241:in invoke_prerequisites' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:218:in block in invoke_with_call_chain'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in synchronize' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:199:in invoke_with_call_chain'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/task.rb:188:in invoke' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:160:in invoke_task'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in block (2 levels) in top_level' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in each'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:116:in block in top_level' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:125:in run_with_threads'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:110:in top_level' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:83:in block in run'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:186:in standard_exception_handling' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/lib/rake/application.rb:80:in run'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/rake-13.0.6/exe/rake:27:in <top (required)>' /Users/bcarr/.rbenv/versions/3.0.3/bin/rake:25:in load'
/Users/bcarr/.rbenv/versions/3.0.3/bin/rake:25:in <top (required)>' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in load'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/cli/exec.rb:58:in kernel_load' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/cli/exec.rb:23:in run'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/cli.rb:478:in exec' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/command.rb:27:in run'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/invocation.rb:127:in invoke_command' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor.rb:392:in dispatch'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/cli.rb:31:in dispatch' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/vendor/thor/lib/thor/base.rb:485:in start'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/cli.rb:25:in start' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:49:in block in <top (required)>'
/Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/3.0.0/bundler/friendly_errors.rb:103:in with_friendly_errors' /Users/bcarr/.rbenv/versions/3.0.3/lib/ruby/gems/3.0.0/gems/bundler-2.2.32/libexec/bundle:37:in <top (required)>'
/Users/bcarr/.rbenv/versions/3.0.3/bin/bundle:23:in load' /Users/bcarr/.rbenv/versions/3.0.3/bin/bundle:23:in '
Tasks: TOP => webpacker:install => webpacker:check_node
Something strange is happening with my application when I boot the jobs server with rake jobs:work. The rails webserver boots fine. I've noticed threads such as this one, however 1) it's not quite the same error message, that one seems more straightforward and 2) the answer did not yield any different results.
Here's my stacktrace -
rake aborted!
Psych::BadAlias: Unknown alias: 1
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:77:in `visit_Psych_Nodes_Mapping'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:35:in `visit_Psych_Nodes_Mapping'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:35:in `visit_Psych_Nodes_Mapping'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/psych_ext.rb:17:in `load_dj'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:85:in `payload_object'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/backend/base.rb:74:in `name'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:245:in `job_say'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:272:in `handle_failed_job'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:213:in `block in run'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:213:in `rescue in run'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:202:in `run'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:280:in `block in reserve_and_run_one_job'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:280:in `reserve_and_run_one_job'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:187:in `block in work_off'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:186:in `times'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:186:in `work_off'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:150:in `block (4 levels) in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:149:in `block (3 levels) in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:148:in `block (2 levels) in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:147:in `loop'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:147:in `block in start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/plugins/clear_locks.rb:7:in `block (2 levels) in <class:ClearLocks>'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `block (2 levels) in add'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:61:in `block in initialize'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:79:in `block in add'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:66:in `execute'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/lifecycle.rb:40:in `run_callbacks'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/worker.rb:146:in `start'
/Users/ccromar/.rvm/gems/ruby-2.4.0/gems/delayed_job-4.0.6/lib/delayed/tasks.rb:9:in `block (2 levels) in <top (required)>'
I got the same issue after ruby upgrade from 2.1.5 to 2.3.8. Thats latest ruby version that could be run with rails 4.1.8.
Upgrading to the latest version of delayed_job did not help. Also tried to specify downgraded version of psych gem in my Gemfile. This did work not as well.
The real issue is that if error appears on job parsing stage then delayed_job does not update last_error column.
So I just went though all the jobs and checked if it could be parsed or not:
failing_jobs = []
Delayed::Job.find_each do |job|
begin
# this code is from dj source https://github.com/collectiveidea/delayed_job/blob/master/lib/delayed/psych_ext.rb#L15
yaml = job.handler
result = Psych.parse(yaml)
result ? Delayed::PsychExt::ToRuby.create.accept(result) : result
rescue Psych::BadAlias => e
failing_jobs << job
end
end
In my case it were 6 jobs out of ~3k that could be deleted safely so I got lucky :)
Refs:
https://github.com/collectiveidea/delayed_job/pull/867
https://github.com/collectiveidea/delayed_job_mongoid/pull/65
My tests used to work, but now they all fail with the following error and stack trace :
TypeError: no implicit conversion of nil into String
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/utils.rb:24:in `quote_ident'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/utils.rb:24:in `quoted'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/quoting.rb:31:in `quote_table_name'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql_adapter.rb:738:in `column_definitions'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/schema_statements.rb:186:in `columns'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:750:in `column_names'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:742:in `timestamp_column_names'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:627:in `block in table_rows'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:621:in `each'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:621:in `map'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:621:in `table_rows'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:526:in `block (3 levels) in create_fixtures'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:524:in `each'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:524:in `block (2 levels) in create_fixtures'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `block in transaction'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/transaction.rb:184:in `within_new_transaction'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/abstract/database_statements.rb:213:in `transaction'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:523:in `block in create_fixtures'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/connection_adapters/postgresql/referential_integrity.rb:17:in `disable_referential_integrity'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:508:in `create_fixtures'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:979:in `load_fixtures'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:941:in `setup_fixtures'
vendor/bundle/gems/activerecord-4.2.5.1/lib/active_record/fixtures.rb:826:in `before_setup'
vendor/bundle/gems/minitest-5.9.1/lib/minitest/test.rb:105:in `block (3 levels) in run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest/test.rb:204:in `capture_exceptions'
vendor/bundle/gems/minitest-5.9.1/lib/minitest/test.rb:104:in `block (2 levels) in run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest/test.rb:255:in `time_it'
vendor/bundle/gems/minitest-5.9.1/lib/minitest/test.rb:103:in `block in run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:348:in `on_signal'
vendor/bundle/gems/minitest-5.9.1/lib/minitest/test.rb:275:in `with_info_handler'
vendor/bundle/gems/minitest-5.9.1/lib/minitest/test.rb:102:in `run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:799:in `run_one_method'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:322:in `run_one_method'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:310:in `block (2 levels) in run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:309:in `each'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:309:in `block in run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:348:in `on_signal'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:335:in `with_info_handler'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:308:in `run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:158:in `block in __run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:158:in `map'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:158:in `__run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:135:in `run'
vendor/bundle/gems/minitest-5.9.1/lib/minitest.rb:62:in `block in autorun'
I ran be rake db:drop && be rake db:create && be rake db:migrate && be rake db:schema:dump && be rake db:test:prepare to make sure my database is clean (where be is an alias for bundle exec)
How can I make my tests run correctly again?
EDIT : please tell me how I can improve my question if you're downvoting it.
I solved my problem. I had added an abstract model :
class AbstractModel < ActiveRecord::Base
self.abstract_class = true
# some methods ...
end
By removing the automatically generated file in my fixtures test/fixtures/abstract_model.yml, my tests succeeded again.
Yesterday an unwelcomed visitor was mucking around my server. I since rebooted ubuntu and changed passwords. Now I try to deploy my rails application and I am getting an error.
Here is the important part:
** [out :: 172.27.12.xxx] /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p392/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
** [out :: 172.27.12.xxx] /usr/local/rvm/rubies/ruby-1.9.3-p327/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p327/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
** [out :: 172.27.12.xxx] /usr/local/rvm/rubies/ruby-1.9.3-p327/bin/ruby /usr/local/rvm/gems/ruby-1.9.3-p327#global/bin/rake assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
*** [deploy:update_code] rolling back
* executing "rm -rf /home/guarddog/public_html/guarddog.com/releases/20131220150214; true"
servers: ["172.27.12.xxx", "172.27.12.xxx", "172.27.12.xxx"]
** [deploy:update_code] exception while rolling back: IOError, closed stream
This is stack trace of error:
Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.2/lib/net/ssh/buffered_io.rb:65:in `recv': Operation timed out - recvfrom(2) (Errno::ETIMEDOUT)
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.2/lib/net/ssh/buffered_io.rb:65:in `fill'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.2/lib/net/ssh/connection/session.rb:228:in `block in postprocess'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.2/lib/net/ssh/connection/session.rb:224:in `each'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/net-ssh-2.6.2/lib/net/ssh/connection/session.rb:224:in `postprocess'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/processable.rb:31:in `block in process_iteration'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/processable.rb:43:in `block in ensure_each_session'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/processable.rb:41:in `each'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/processable.rb:41:in `ensure_each_session'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/processable.rb:29:in `process_iteration'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/command.rb:165:in `block (2 levels) in process!'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/command.rb:164:in `loop'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/command.rb:164:in `block in process!'
from /Users/guarddog/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:295:in `realtime'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/command.rb:163:in `process!'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/command.rb:134:in `process'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/actions/invocation.rb:185:in `block in run_tree'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/connections.rb:198:in `block in execute_on_servers'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/connections.rb:186:in `each'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/connections.rb:186:in `each_slice'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/connections.rb:186:in `execute_on_servers'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/actions/invocation.rb:183:in `run_tree'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/actions/invocation.rb:155:in `run'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from ./config/deploy.rb:77:in `block (2 levels) in load'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/callback.rb:38:in `call'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/callbacks.rb:141:in `block in trigger'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/callbacks.rb:141:in `each'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/callbacks.rb:141:in `trigger'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/callbacks.rb:27:in `invoke_task_directly_with_callbacks'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/recipes/deploy.rb:228:in `block (3 levels) in load'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:56:in `transaction'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/recipes/deploy.rb:227:in `block (2 levels) in load'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/namespaces.rb:191:in `method_missing'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/namespaces.rb:110:in `block in define_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/recipes/deploy.rb:195:in `block (2 levels) in load'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:138:in `instance_eval'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:138:in `invoke_task_directly'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/callbacks.rb:25:in `invoke_task_directly_with_callbacks'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:89:in `execute_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/configuration/execution.rb:101:in `find_and_execute_task'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:46:in `block in execute_requested_actions'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:45:in `each'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:45:in `execute_requested_actions'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/cli/help.rb:19:in `execute_requested_actions_with_help'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:34:in `execute!'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/lib/capistrano/cli/execute.rb:14:in `execute'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/gems/capistrano-2.13.5/bin/cap:4:in `<top (required)>'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/bin/cap:19:in `load'
from /Users/guarddog/.rvm/gems/ruby-1.9.3-p0/bin/cap:19:in `<main>'
I think the notable part is this line:
from ./config/deploy.rb:77:in `block (2 levels) in load'
That's actual code in my deploy.rb file:
task :precompile, :role => :app do
run "cd #{release_path}/ && RAILS_ENV=production bundle exec rake assets:precompile"
end
which is executed because of this line in my deploy.rb:
after "deploy:update_code", "deploy:precompile"
Note the deploys were working fine until the incident happened yesterday. He seemed to clone the git repository and copy it somewhere. But he didn't seem to delete any files.
Any idea why deploy:precompile gives the error?
It sounds like your remote codebase may have been compromised. I suggest using
cap deploy:check
cap deploy:cleanup
cap deploy:cold
to redeploy a fresh copy of your original codebase.
This will not modify your remote database, but it will restart the remote httpd server so, as with any deploy, you should wait until a suitable maintenance window to try it.
I am having difficulties troubleshooting the following and figuring out why my assets are failing to precompile at slug compilation... the odd thing is, is that the assets compile fine at runtime when I check the live logs... any ideas? Is it trying to connect to the database?
Preparing app for Rails asset pipeline
Running: rake assets:precompile
rake aborted!
undefined method `match' for nil:NilClass
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/mongo_uri.rb:49:in `initialize'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:104:in `new'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:104:in `parse'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:62:in `create_session'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions/factory.rb:43:in `default'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/sessions.rb:109:in `default'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid.rb:129:in `default_session'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/mongoid-3.1.4/lib/mongoid/railtie.rb:131:in `block (2 levels) in <class:Railtie>'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `call'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:34:in `execute_hook'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:43:in `block in run_load_hooks'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `each'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/lazy_load_hooks.rb:42:in `run_load_hooks'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/config/environment.rb:5:in `<top (required)>'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `block in require'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:236:in `load_dependency'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.13/lib/active_support/dependencies.rb:251:in `require'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:103:in `require_environment!'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:297:in `block (2 levels) in initialize_tasks'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:93:in `block (2 levels) in <top (required)>'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:60:in `block (3 levels) in <top (required)>'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:23:in `invoke_or_reboot_rake_task'
/tmp/build_27348f41-abb7-46f0-a7ac-6f66bf0feff7/vendor/bundle/ruby/1.9.1/gems/actionpack-3.2.13/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
Tasks: TOP => environment
(See full trace by running task with --trace)
Check whether your asset precompile requires access to ENV variables during when its run. Its hard to tell from your stack trace, but this might be a good resource to check out: https://devcenter.heroku.com/articles/rails-asset-pipeline
Essentially, you can enable the user-env-compile labs feature on heroku to give your app instance access to ENV vars during your precompile.
heroku labs:enable user-env-compile -a myapp
more information about that here: https://devcenter.heroku.com/articles/labs-user-env-compile
I had just added Unicorn, I added the following to my application.rb in config and was able to precompile:
config.assets.initialize_on_precompile = false