Rails Backend

Application Server#

The primary Codeburner application is a ruby 2/rails 4 service that provides the REST API and manages the asynchronous workers for scanning and notifications.

It uses Sidekiq with a redis queue for the asynchronous work.


Ruby Environment#

Codeburner was developed primarily on OSX with ruby 2.2 using the Homebrew packages for MySQL and Redis.


Database#

MySQL is the database of choice, and MySQL 5.6+ is recommended for use with paper_trail, which is used to generate statistics.


Caching#

Caching is done via Redis. In addition to being used for the standard rails transaction caching, Codeburner also pre-renders the results to the most common API queries (GET /api/stats for example) and updates the cache whenever the models change.


Sidekiq#

Codeburner uses Sidekiq for asynchronous work. It must be started as a separate process from the main application server as noted in the Startup Guide.

You can pull up the GUI for sidekiq with the URL http://localhost:8080/sidekiq. Here you can view the queue status and see what your workers are up to.

If you've installed the sidekiq-failures gem, you can also get detailed information on failures complete with log snippets useful for debugging purposes.


Unit Tests#

Tests are in the /test directory. They're written in minitest/unit using Mocha mocks.

If you submit patches to Codeburner, please ensure a 'rake test' comes back clean:

bundle exec rake test
Running via Spring preloader in process 49701
Started with run options --seed 33780

  80/80: [================================================================] 100% Time: 00:00:01, Time: 00:00:01

Finished in 1.60502s
80 tests, 213 assertions, 0 failures, 0 errors, 0 skips
Coverage report generated for MiniTest to ~/codeburner/coverage. 574 / 574 LOC (100.0%) covered.

When adding new functionality, make sure to add tests for that functionality to the appropriate /test directory.