Skip to content

TanookiLabs/mongo-sales-demo

Repository files navigation

PROJECT_NAME

Dependencies

  • ruby, bundler
  • node, yarn
  • postgresql
  • redis (when using sidekiq)
  • jemalloc brew install jemalloc
  • chromedriver brew cask install chromedriver

Setup

bin/setup

Tests

bin/rspec

For javascript integration testing, we use Google Chromedriver. You may need to brew install chromedriver to get this working!

Heroku configuration

This project is served from Heroku. It uses jemalloc to more efficiently allocate memory. You must run the following to setup jemalloc:

heroku buildpacks:add --index 1 https://github.com/mojodna/heroku-buildpack-jemalloc.git

Deployment Information

Sidekiq

This project uses Sidekiq to run background jobs and ActiveJob is configured to use Sidekiq. It is recommended to use ActiveJob to create jobs for simplicity, unless the performance overhead of ActiveJob is an issue.

Remember to follow the Sidekiq Best Practices, especially making jobs idempotent and transactional. If you are using ActiveJob, the first best practice is less relevant because of Rails GlobalID.

Email

This project is configured with the mta-settings gem for transparent configuration of e-mail based on Heroku environment variables. This supports Sendgrid, Mandrill, Postmark, Mailgun, and Mailtrap ENV variables.

Note that this means that if you do not want emails to be sent out, you should not have any of these environment variables set (except for Mailtrap).

Coding Style

This projects uses RuboCop and ESLint to catch errors and keep style consistent.

It also uses lefthook to manage git hooks. Use git commit --no-verify to skip checks, or see ./lefthook.yml for info on how to change its setup.

Making changes to the linter setup? Please share your fixes and make a PR to the Tanooki template so future projects may benefit.

Important rake tasks

Scheduled tasks

Important ENV variables

Configuring Servers:

WEB_CONCURRENCY - Number of Puma workers
RAILS_MAX_THREADS - Number of threads per Puma worker
SIDEKIQ_CONCURRENCY - Number of Sidekiq workers

rack-timeout:

RACK_TIMEOUT_SERVICE_TIMEOUT
RACK_TIMEOUT_WAIT_TIMEOUT
RACK_TIMEOUT_WAIT_OVERTIME
RACK_TIMEOUT_SERVICE_PAST_WAIT

refer to rack-timeout for default values

Note that this project uses dotenv to load .env files. Use .env.development and .env.test to setup shared ENV variables for development and test, and use .env files ending in .local for variables specific to you.