Skip to content
Bjarni Rúnar Einarsson edited this page Apr 3, 2014 · 19 revisions

General FAQ

What is a FAQ?

This is a FAQ!

Production deployment FAQs

Basic rails production setup

You need to run the following commands in the root of the web application:

RAILS_ENV=production bundle exec rake db:schema:load
RAILS_ENV=production bundle exec rake db:seed
bundle install --deployment
RAILS_ENV=production bundle exec rake assets:precompile

What are the external dependencies?

You need the following external services running:

  • postgresql
  • memcache
  • redis
  • sidekiq (part of the yrpri bundle, see Procfile for a command line)
  • sphinx

How do I setup search?

You need to install Sphinx from http://sphinxsearch.com/ (or apt-get install sphinxsearch)

To setup search for the first time and run the daemon

bundle exec rake ts:rebuild

The relation between domain names, sub-instances and instances, and how to resolve redirect loops and get things running the first time

There always needs to be a SubInstance called default. The code uses the host part of the url to identify what sub instance to load.

What background jobs should run aside from the main web app

You need to run sidekiq and redis to handle for example sending out status emails when the official status of an idea has been changed.

You also need to run those two tasks from you cron on regular intervals every 10 minutes or so

bundle exec rake schedule:idea_ranker  
bundle exec rake ts:index  

How to tell the app that it is behind an SSL load balancer (pound) and should behave as if all connections were secure without redirecting

In pound you need to do something like:

ListenHttps
   HeadRemove "X-Forwarded-Proto"
   AddHeader "X-Forwarded-Proto: https"
   ...

How is mail sent? How do we tweak it?

Mail is currently setup for sendgrid or localhost, you can change this functionality here: config/initializers/sendgrid.rb (probably should rename to something more general)

In the Root Configuration admin settings (in the UI) you need to upload an email header image that is attached to each outgoing mail. The mailer code is in app/mailers/users_mailer.rb.