Development Tips

Leonardo Crauss Daronco edited this page Apr 6, 2017 · 8 revisions

Sending emails in development

E-mails are sent by resque and scheduled by resque-scheduler, so you must run the scheduler and (at least) one resque worker:

$ QUEUE="*" bundle exec rake resque:work
$ bundle exec rake resque:scheduler

Don't forget to set your SMTP configurations in the application. And when you modify it, don't forget to restart the web server and all resque processes.

Testing and modifying emails: MailCatcher

MailCatcher is a gem used to "capture" emails and shows them in a simple interface. Very useful when modifying emails in development.

Install it:

$ bundle install
$ rbenv rehash

Run it:

$ mailcatcher

From inside a VM set up with Vagrant, run it with:

$ mailcatcher --http-ip=0.0.0.0

Configure the application with the following SMTP configurations:

  • SMTP sender: anything, as long as it's a valid e-mail
  • SMTP domain: localhost
  • SMTP port: 1025
  • Leave all the other SMTP options blank.

Run the resque workers and the scheduler as described in this section.

Now all emails sent by Mconf-Web will go to the SMTP server created by MailCatcher and will be available on its interface at http://localhost:1080/.

Updating the list of meetings:

Meetings in Mconf-Web are instances of the model BigbluebuttonMeeting.

BigbluebuttonRails uses resque to schedule workers that will created meetings when a user joins a room. These workers run in background, and need resque to be triggered for then to actually work:

$ rake resque:work QUEUE='*'

Read more at BigbluebuttonRails README.

Using a fake LDAP server on development

There's a rake task called ldap:server which after invoked starts a LDAP server in localhost with the same config options as the ones in your database.

$ bundle exec rake ldap:setup_site # configure the LDAP attributes in your site
$ bundle exec rake ldap:server

By default there's only one registered user with login mconf-user and password mconf.

You can supply a port number with:

$ bundle exec rake ldap:server[4141]

If not present it will use the port configured for the website or 1389.

Recommended site configurations:

  • LDAP: Enable authentication: --check--
  • LDAP: Server IP or domain: localhost
  • LDAP: Server port: 1389
  • LDAP: Full DN or user to bind: cn=admin,cn=TOPLEVEL,dc=example,dc=com
  • LDAP: Password to connect: admin
  • LDAP: Full DN for the users tree: ou=USERS,dc=example,dc=com
  • LDAP: Field to obtain the username: uid
  • LDAP: Field for principal name (unique ID): mail
  • LDAP: Field to obtain the user's email: mail
  • LDAP: Field to obtain the user's full name: cn

Using ruby with rbenv

You can easily replace RVM by rbenv.

First make sure you remove RVM (rvm implode) and all references to it. Then install rbenv following the guide at their GitHub page.

Install the target ruby (check on .ruby-version the version you should install):

$ rbenv install 1.9.2-p290
$ rbenv rehash

Install bundler:

$ gem install bundler

And then use bundle exec always when running ruby commands, for example:

$ bundle exec rake db:migrate
$ bundle exec rails server

rbenv has no gemsets as used in RVM, so you bundler is used to keep track of the gems and the versions that should be used.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.