Switch to production mode and backup/reset


#1

Hello,

I installed Dradis from git for the first time (on Debian stretch). After a bit of fiddling out I could manage it and put nginx as TLS reverse proxy in front of it. I installed it following the GIT install instructions here: https://dradisframework.com/ce/documentation/install_git.html It runs on development mode using bundle exec rails server but I could not find a way to switch to production mode.

I tried the following:

/opt/dradis/dradis-ce$ RAILS_ENV=production bundle exec rails server
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <top (required)> at /opt/dradis/dradis-ce/config/application.rb:12)
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <top (required)> at /opt/dradis/dradis-ce/config/application.rb:12)
=> Booting WEBrick
=> Rails 5.0.1 application starting in production on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
Exiting
/opt/dradis/dradis-ce/app/channels/application_cable/channel.rb:2:in `<module:ApplicationCable>': uninitialized constant ApplicationCable::ActionCable (NameError)
        from /opt/dradis/dradis-ce/app/channels/application_cable/channel.rb:1:in `<top (required)>'
        from /var/lib/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:12:in `block in loading'
        from /var/lib/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/concurrency/share_lock.rb:150:in `exclusive'
        from /var/lib/gems/2.3.0/gems/activesupport-5.0.1/lib/active_support/dependencies/interlock.rb:11:in `loading'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/engine.rb:476:in `block (2 levels) in eager_load!'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/engine.rb:475:in `each'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/engine.rb:475:in `block in eager_load!'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/engine.rb:473:in `each'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/engine.rb:473:in `eager_load!'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/engine.rb:354:in `eager_load!'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/application/finisher.rb:59:in `each'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/application/finisher.rb:59:in `block in <module:Finisher>'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `instance_exec'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:30:in `run'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:55:in `block in run_initializers'
        from /usr/lib/ruby/2.3.0/tsort.rb:228:in `block in tsort_each'
        from /usr/lib/ruby/2.3.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
        from /usr/lib/ruby/2.3.0/tsort.rb:431:in `each_strongly_connected_component_from'
        from /usr/lib/ruby/2.3.0/tsort.rb:349:in `block in each_strongly_connected_component'
        from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each'
        from /usr/lib/ruby/2.3.0/tsort.rb:347:in `call'
        from /usr/lib/ruby/2.3.0/tsort.rb:347:in `each_strongly_connected_component'
        from /usr/lib/ruby/2.3.0/tsort.rb:226:in `tsort_each'
        from /usr/lib/ruby/2.3.0/tsort.rb:205:in `tsort_each'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/initializable.rb:54:in `run_initializers'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/application.rb:352:in `initialize!'
        from /opt/dradis/dradis-ce/config/environment.rb:5:in `<top (required)>'
        from /opt/dradis/dradis-ce/config.ru:3:in `require_relative'
        from /opt/dradis/dradis-ce/config.ru:3:in `block in <main>'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `instance_eval'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:55:in `initialize'
        from /opt/dradis/dradis-ce/config.ru:in `new'
        from /opt/dradis/dradis-ce/config.ru:in `<main>'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `eval'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:49:in `new_from_string'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/builder.rb:40:in `parse_file'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:318:in `build_app_and_options_from_config'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:218:in `app'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/server.rb:59:in `app'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:353:in `wrapped_app'
        from /var/lib/gems/2.3.0/gems/rack-2.0.1/lib/rack/server.rb:282:in `start'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/server.rb:79:in `start'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:90:in `block in server'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `tap'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:85:in `server'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
        from /var/lib/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
        from bin/rails:4:in `require'
        from bin/rails:4:in `<main>'

Any clue? And bonus question, I also could not find out how to reset and backup the environment. I found an old post listing thor tasks but it fails as well:

/opt/dradis/dradis-ce$ bundle exec thor dradis:reset
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <top (required)> at /opt/dradis/dradis-ce/config/application.rb:12)
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from <top (required)> at /opt/dradis/dradis-ce/config/application.rb:12)
Loaded add-ons:
        acunetix - Processes Acunetix XML format
        api - Dradis REST HTTP API
        brakeman - Processes Brakeman JSON output, use: brakeman -f json -o results.json
        burp - Processes Burp Scanner XML output
        csv - Export results in CSV format
        cvss - Provides a CVSS score calculator under /calculators/cvss
        dread - Provides a DREAD score calculator under /calculators/dread
        html_export - Generate advanced HTML reports
        metasploit - Processes Metasploit XML output, use: db_export
        nessus - Processes Nessus XML v2 format (.nessus)
        nexpose - Processes Nexpose XML format
        nikto - Processes Nikto output
        nmap - Processes Nmap output
        nto_spider - Processes NTOSpider reports
        open_vas - Processes OpenVAS XML v6 or v7 format
        projects - Save and restore project information
        qualys - Processes Qualys output
        zap - Processes ZAP XML format
** Checking database migrations...                                    [  DONE  ]
** Saving backup...                                                   /opt/dradis/dradis-ce/lib/tasks/thorfile.rb:26:in `backup': uninitialized constant DradisTasks::ProjectExport (NameError)
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:115:in `invoke'
        from /opt/dradis/dradis-ce/lib/tasks/thorfile.rb:50:in `reset'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:27:in `run'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/runner.rb:44:in `method_missing'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:29:in `run'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/command.rb:126:in `run'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/invocation.rb:126:in `invoke_command'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor.rb:369:in `dispatch'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/lib/thor/base.rb:444:in `start'
        from /var/lib/gems/2.3.0/gems/thor-0.19.4/bin/thor:6:in `<top (required)>'
        from /usr/local/bin/thor:22:in `load'
        from /usr/local/bin/thor:22:in `<main>'

#2

@trolli101 good news bad news situation

The Good news

the first problem (re: production) is due to an incomplete migration to Rails 5, you can see more here:

https://github.com/dradis/dradis-ce/pull/71

I trust that if you manually make these changes (that affect application.rb only), the app server will be able to start:

https://github.com/dradis/dradis-ce/pull/71/files#diff-b1fe55db50c712fef0673345e5b9c0d9

The Bad news

It would seem that dradis:reset is broken at the moment, can I ask you to create an item in the issue tracker so we can fix it?

Many thanks,
Daniel


#3

Did dradis:reset get fixed and if so, how can I implement the fix.

Thanks…


#4

Could you subscribe to this GitHub issue tracker entry for updates on this? https://github.com/dradis/dradis-ce/issues/76 That will be the best way to get information on the fix once it’s available. Thanks @baka!