Installing - dwilkie/nuntium GitHub Wiki

Installing

These installation instructions detail installing Nuntium both in a Development and Production Environment. The examples shown are for a Debian/Ubuntu installation.

Dependencies

Nuntium runs only on unix-based systems.

Ruby

Currently Nuntium only works with Ruby 1.8.7.

MySQL

Currently Nuntium only works with MySQL as the database server.

Ensure that you install the following:

sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev

RVM

To avoid problems issues with different versions of Ruby, it's recommended to use RVM

If you are installing Nuntium in a production environment you may want to also want to uninstall system ruby to avoid conflicts:

sudo apt-get remove ruby1.8

Nokogiri

Nuntium requires Nokogiri. Ensure that Nokigiri's dependencies are installed.

sudo apt-get install libxslt-dev libxml2-dev

RabbitMQ

Nuntium uses RabbitMQ for it's queuing server. To install it add the following to your /etc/apt/sources.list:

deb http://www.rabbitmq.com/debian/ testing main

Then add the public key, update the repositories and install RabbitMQ

wget http://www.rabbitmq.com/rabbitmq-signing-key-public.asc
sudo apt-key add rabbitmq-signing-key-public.asc
sudo apt-get update
sudo apt-get install rabbitmq-server

Follow the installation instructions on the RabbitMQ site for alternative installation instructions.

Once you have it installed, run the following command in your Nuntium directory:

rvmsudo bundle exec rake rabbit:prepare

This will create the RabbitMQ user and vhost specified in the config/amqp.yml file for the current environment.

To check that the rake task ran succesfully inspect the output of the following commands:

sudo rabbitmqctl list_users
sudo rabbitmqctl list_vhosts
sudo rabbitmqctl -p /nuntium/development list_permissions

Repeat the steps above for your production environment e.g.

rvmsudo bundle exec rake rabbit:prepare RAILS_ENV=production

Make sure you have RabbitMQ running before running Nuntium. You can restart the RabbitMQ server by issuing this command:

sudo /etc/init.d/rabbitmq-server restart

Memcached

Nuntium also depends on Memcached. To install it run:

sudo apt-get install memcached

Follow the installation instructions on the Memcached site for alternative installation instructions.

Installing Nuntium

Once the dependencies are installed you can download and install Nuntium:

git clone git://github.com/dwilkie/nuntium.git
cd path/to/nuntium
bundle install --path vendor

Set up the database

# mysql -u root -p
mysql> create database nuntium;
mysql> create database nuntium_development;
mysql> create database nuntium_test;
mysql> create user 'nuntium'@'localhost';
mysql> set password for 'nuntium'@'localhost' = PASSWORD('secret');
mysql> grant all on nuntium_test.* to 'nuntium'@'localhost';
mysql> grant all on nuntium_development.* to 'nuntium'@'localhost';
mysql> grant all on nuntium.* to 'nuntium'@'localhost';

Configure you Rails to access the database

Ensure your config/database.yml file matches the settings above

development:
  adapter: mysql
  database: nuntium_development
  username: nuntium
  password: secret
  pool: 5
  timeout: 5000
  reconnect: true

test:
  adapter: mysql
  database: nuntium_test
  username: nuntium
  password: secret
  pool: 5
  timeout: 5000

production:
  adapter: mysql
  database: nuntium
  username: nuntium
  password: secret
  pool: 5
  timeout: 5000
  reconnect: true

Prepare the database

cd path/to/nuntium
bundle exec rake db:schema:load
bundle exec rake db:seed

Repeat as neccessary for the production environment. For example:

bundle exec rake db:schema:load RAILS_ENV=production
bundle exec rake db:seed RAILS_ENV=production

Compile Javascript and CSS

cd path/to/nuntium
bundle exec smart_asset

If you get any errors try installing Sun-Java

Running the tests

If you run the tests and they pass there is a very high chance that Nuntium is correctly installed on your system. ;-)

Prepare for testing:

Run the RabbitMQ rake task for test environment:

rvmsudo bundle exec rake rabbit:prepare RAILS_ENV=test

Prepare the database for testing:

bundle exec rake db:test:prepare

Run the tests:

bundle exec rake test

Nuntium in Development

Boot the Rails server as normal:

bundle exec rails s

Nuntium Services

For full functionality, Nuntium requires a number of services to be running along side the Rails server.

You can use the service runner in script/nuntium_service.sh to start the Nuntium services in daemon mode e.g.

cd <<nuntium_clone_dir>>
./script/nuntium_service.sh cron_daemon_ctl.rb start development
./script/nuntium_service.sh cron_daemon_ctl.rb start development
./script/nuntium_service.sh generic_worker_daemon_ctl.rb start development slow 1
./script/nuntium_service.sh generic_worker_daemon_ctl.rb start development fast 1
./script/nuntium_service.sh managed_processes_daemon_ctl.rb start development
./script/nuntium_service.sh scheduled_jobs_service_daemon_ctl.rb start development

To start the services in the foreground (useful for debugging)

cd <<nuntium clone dir>>
bundle exec ruby ./lib/services/cron_daemon.rb
bundle exec ruby ./lib/services/generic_worker_daemon.rb development slow 1
bundle exec ruby ./lib/services/generic_worker_daemon.rb development fast 1
bundle exec ruby ./lib/services/managed_processes_daemon.rb development
bundle exec rails server

Nuntium in Production

Nuntium comes with a Production branch which just .gitignores your configuration files such as config/database.yml and monit.yml. Check it out on your Production machine:

git clone git://github.com/dwilkie/nuntium.git
cd nuntium
git checkout production

Then copy the relevant config files over and fill in your production settings e.g.

cp config/database.yml.example config/database.yml
cp config/monit.yml.example config/monit.yml

Passenger

Follow the installation instructions on the Passenger site

Put the Virtual Host configuration (instructions given when installing passenger) in /etc/apache2/sites-enabled/nuntium.conf e.g.

<VirtualHost *:80>
  ServerName your_elastic_ip_or_dns
  DocumentRoot path/to/nuntium/public
  PassengerSpawnMethod conservative
  <Directory path/to/nuntium/public>
    AllowOverride all
    Options -MultiViews
  </Directory>
</VirtualHost>

Remember to restart apache sudo apachectl restart Test it out by pointing your browser to your_elastic_ip

RabbitMQ Management Plugin

Follow these instructions to set up the RabbitMQ Management Plugin

Monit

Follow these instructions to set up Monit for Nuntium

Installing on EC2

Follow these instructions to set up Nuntium on EC2 with SSL

Configuring a VPN connection

Follow these instructions to set up a VPN connection for Nuntium

FAQ

You get eventmachine not initialized: evma_install_oneshot_timer

That probably means you don't have RabbitMQ up and running.

More help

Please send a message to our mailing list.

⚠️ **GitHub.com Fallback** ⚠️