Set up your befdata platform

Karl W edited this page May 30, 2013 · 3 revisions

Rails application setup

Now the application has to be placed in the given directory /var/www/production/fundiv in this case. For our production system this is done as befdata-prod user.

git clone git:// fundiv


The database config file has to be set up (only a dist file is checked into the repository) and the database has to be created (of course one has to set up a user and password for the database. Also remember to setup the database to use plpgsql -> CREATE LANGUAGE plpgsql;)

cp database.yml.dist database.yml
nano database.yml

... edit config as needed (username befdata-prod)

To let the system email notification to users you need to have an email address with smtp sending enabled. Then you need to change the configuration for email:

cp mailers.yml.dist mailers.yml
nano mailers.yml

If you don't want to have your instance of befdata to end emails, you can include these two lines into config/environments/production.rb:

config.action_mailer.perform_deliveries = false
config.action_mailer.raise_delivery_errors = false

Same has to be done for the configuration file which contains site specific configs (layout etc.) For instance for fundiv you may want to uncomment the layout = 'fundiv' statement.

cp configuration.yml.dist configuration.yml
nano configuration.yml

... If wanted one can setup newrelic

cp newrelic.yml.dist newrelic.yml

and edit configuration as neede (license key, application name)


Load the additional gems, if not already done, through the console

bundle install

Compile the assets

Compile assets(javascripts, stylesheets, and images) into public/assets folder

rake assets:precompile

Setup background workers

whenever --write-crontab --set 'environment=production'

(use whenever --update-crontab if crontab already contains entries??). This sets up checking for Datasets downloads to be regenerated every 60 seconds.

For the actual background worker (a delayed_job process) installation instruction is found under ext/startup-scripts/befdata_delayed_job for setting up a init script on a ubuntu server (10.04).

sudo nano /etc/init.d/befdata_delayed_job
sudo chmod a+x /etc/init.d/befdata_delayed_job
sudo update-rc.d befdata_delayed_job defaults

Now the delayed_job background process will be started automatically on a reboot etc. call startup script once to activate the background worker directly

sudo /etc/init.d/befdata_delayed_job start

The script can also be called directly from the app directory (as user who serves app)

script/delayed_job start (start|stop|restart)

Activate Site for Apache to serve

sudo a2ensite fundiv
sudo /etc/init.d/apache2 reload

Using the system

After calling rake db:setup or db:seed a administrative user is avaible Login: admin Password: test