Skip to content

Open-source group discussion platform. Written in Ruby (Padrino), hosted via dokku/Heroku (web app) and a VPS (mail server)

License

Notifications You must be signed in to change notification settings

nanangsyaifudin/lumen

 
 

Repository files navigation

Lumen

Code Climate

For a live preview of Lumen, feel free to join the previewers group on lumenapp.com.

Lumen started life as a group discussion platform akin to Google Groups, GroupServer, Mailman or Sympa. Since then, it's gained some powerful extras. An outline of its features:

  • Open-source (under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported)
  • Hosted using dokku/Heroku (web app), a VPS (mail sever) and Amazon S3 (file attachments)
  • You can run dokku and the mail server on the same VPS
  • Designed for custom domains (group email addresses of the form [email protected])
  • Sends and receives mail via regular SMTP and IMAP accounts
  • Dual web/email access
  • Extensible member profiles
  • Flexible digest engine
  • Events calendar
  • Maps placing people, organisations and venues
  • Google Docs integration
  • Facebook-style walls

Lumen is written in Ruby using the Padrino framework. It was originally created for the New Economy Organisers Network (hosted by the New Economics Foundation) who kindly agreed to open source the project and continue to sponsor its development.

## How the mailing lists work, in brief

  1. Your mail server receives a mail to [email protected]
  2. The mail triggers a simple notification script on the mail server that in turn alerts your web app to the fact there's a new message for the group
  3. Your web app connects to the mail server via IMAP to fetch the new mail
  4. Your web app distributes the message to group members via SMTP

Installation instructions for DigitalOcean/dokku

  • Register a domain $DOMAIN. In this simple setup, $DOMAIN = $MAIL_DOMAIN = $MAIL_SERVER_ADDRESS

  • Create a 2GB (or greater) droplet with the hostname $MAIL_SERVER_ADDRESS and select the image 'Dokku 0.5.6 on 14.04'

  • Install fail2ban: apt-get install fail2ban

  • Create certificates:

    openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/mail.key -out /etc/ssl/certs/mailcert.pem
    

    (You can hit enter a bunch of times to leave the fields empty)

  • Install mail packages (make sure you replace $MAIL_SERVER_ADDRESS and $MAIL_DOMAIN with your domain). When dovecot-core asks whether you want to create a self-signed SSL certificate, answer no:

    aptitude install postfix dovecot-core dovecot-imapd opendkim opendkim-tools; mkdir /etc/opendkim; mkdir /etc/opendkim/keys; wget https://raw.github.com/wordsandwriting/lumen/master/script/lumen-install.sh; chmod +x lumen-install.sh; ./lumen-install.sh $MAIL_SERVER_ADDRESS $MAIL_DOMAIN; newaliases; service postfix restart; service dovecot restart; service opendkim restart
    
  • Get DKIM key with nano -$ /etc/opendkim/keys/$MAIL_DOMAIN/mail.txt and add DNS records:

    $MAIL_DOMAIN MX $MAIL_SERVER_ADDRESS   
    $MAIL_SERVER_ADDRESS A $MAIL_SERVER_IP  
    $MAIL_DOMAIN TXT "v=spf1 a mx a:$MAIL_DOMAIN ip4:$MAIL_SERVER_IP ?all"  
    mail._domainkey.$MAIL_DOMAIN TXT "v=DKIM1; k=rsa; p=..."
    
  • Visit $DOMAIN. Enter $DOMAIN as the hostname and check 'Use virtualhost naming for apps'

  • Create the dokku app and add the mongo plugin:

    dokku apps:create $APP_NAME
    dokku plugin:install https://github.com/dokku/dokku-mongo.git mongo
    dokku mongo:create $MONGO_SERVICE_NAME
    dokku mongo:link $MONGO_SERVICE_NAME $APP_NAME
    
  • From your own machine run:

    git clone https://github.com/wordsandwriting/lumen.git; cd lumen; git remote add $APP_NAME dokku@$DOMAIN:$APP_NAME; git push $APP_NAME master
    
  • Set configuration variables. You can get secrets for $DRAGONFLY_SECRET and $SESSION_SECRET by running dokku run $APP_NAME rake secret. If you didn't obtain a password for the root user, enable password authentication and set one with: nano /etc/ssh/sshd_config; uncomment PasswordAuthentication yes; restart ssh; passwd:

    dokku config:set $APP_NAME APP_NAME=$APP_NAME DOMAIN=$DOMAIN MAIL_DOMAIN=$MAIL_DOMAIN MAIL_SERVER_ADDRESS=$MAIL_SERVER_ADDRESS MAIL_SERVER_USERNAME=root MAIL_SERVER_PASSWORD=$MAIL_SERVER_PASSWORD S3_BUCKET_NAME=$S3_BUCKET_NAME S3_ACCESS_KEY=$S3_ACCESS_KEY S3_SECRET=$S3_SECRET S3_REGION=$S3_REGION SESSION_SECRET=$SESSION_SECRET DRAGONFLY_SECRET=$DRAGONFLY_SECRET
    
  • Start a worker process: dokku ps:scale $APP_NAME web=1 worker=1

  • Create default language and database indexes: dokku run $APP_NAME rake languages:default[English,en]; dokku run $APP_NAME rake mi:create_indexes

  • Set cron tasks with crontab -e:

    0 4 * * * /usr/local/bin/dokku run $APP_NAME rake cleanup  
    0 8 * * * /usr/local/bin/dokku run $APP_NAME rake digests:daily  
    0 0 * * 0 /usr/local/bin/dokku run $APP_NAME rake digests:weekly
    
  • Visit $DOMAIN. (You should be automatically logged in as an administrator. If not, sign in with the email address [email protected] and the password lumen.) Change the admin name, email address and password.

  • Visit /config and click 'Create notification script'. Add additional configuration variables via dokku config:set $APP_NAME VAR=$VAR. You're done!

Switching mail servers

If you switch your mail server, you'll need to re-setup the group mail accounts on the new server. Fire up a console (padrino c) and run:

Group.each { |group| group.setup_mail_accounts_and_forwarder }
ConversationPost.update_all(imap_uid: nil)

About

Open-source group discussion platform. Written in Ruby (Padrino), hosted via dokku/Heroku (web app) and a VPS (mail server)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 49.7%
  • HTML 45.0%
  • CSS 2.7%
  • JavaScript 1.7%
  • Shell 0.9%