Quick Start for Cassandra backend

The goal of the document is to allow anyone to start with James on Docker as an operational mail server.

The method described bellow should not be used in production.

Step 0: Requirements
####################

  * Java 8 SDK
  * 512MB RAM (launches with -Xmx512M - can use less, can need more, depending on load)
  * Docker 1.7.1+
  * Maven 3.3

Step 1: Download
#################

  * Clone the James git repository

$ git clone git://git.apache.org/james-project.git

Step 3: Compile
###############

  * Compile the Guice Cassandra project
  
$ mvn package -DskipTests -am -pl server/container/guice/cassandra-guice

Step 3: Deploy
##############

3.1. Deploy Cassandra (optional)
You may skip this part if you already have a running Cassandra on your network.

$ docker run --name=cassandra cassandra:2.2.3

3.2. Deploy ElasticSearch (optional)
You may skip this part if you already have a running ElasticSearch on your network.

$ docker run --name=elasticsearch elasticsearch:2.2.1

Step 4: Configure
#################

  * Follow the Cassandra guice configuration documentation.
  * We need to provide the key we will use for TLS. For obvious reasons, this is not provided in this git.

Copy your TSL keys to ./conf/keystore or generate it using :

$ keytool -genkey -alias james -keyalg RSA -keystore ./conf/keystore

You will have to put the keystore password in the right xml files (imapserver.xml, pop3server.xml, smtpserver.xml)

Step 5: Start
#############

  * Run James

$ java -Dworking.directory=WORKING_PATH -jar server/container/cassandra-guice/target/james-server-cassandra-guice-beta5-SNAPSHOT.jar

Where :
- WORKING_PATH is the path where are located your configuration file folder.

Step 6: Create Domains and Users
################################

Time to add domains and users.

$ java -jar server/container/cli/target/james-server-cli-3.0.0-beta5-SNAPSHOT.jar -h 127.0.0.1 -p 9999  adddomain DOMAIN

$ java -jar server/container/cli/target/james-server-cli-3.0.0-beta5-SNAPSHOT.jar -h 127.0.0.1 -p 9999  adduser USER_MAIL_ADDRESS PASSWORD

Where :
- DOMAIN is the domain you want to handle with this server.
- USER_MAIL_ADDRESS is the mail address that will be used by this user.
- PASSWORD is the password that will be used by this user.

Step 8: Test
############

$ telnet HOSTNAME 25
Trying HOSTNAME...
Connected to HOSTNAME.
Escape character is '^]'.
220 172.16.1.131 SMTP Server (JAMES SMTP Server 3.0-beta4) ready Sat, 6 Nov 2010 17:31:33 +0100 (CET)
ehlo test
250-172.16.1.131 Hello test (aoscommunity.com [127.0.0.1])
250-PIPELINING
250-ENHANCEDSTATUSCODES
250 8BITMIME
mail from:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.0 Sender <YOUR_NAME@YOUR_DOMAIN> OK
rcpt to:<YOUR_NAME@YOUR_DOMAIN>
250 2.1.5 Recipient <YOUR_NAME@YOUR_DOMAIN> OK
data
354 Ok Send data ending with <CRLF>.<CRLF>
subject: test

this is a test
.
250 2.6.0 Message received
quit
Connection closed by foreign host.

Step 8: Manage
##############

8.1. Manage via james-cli

  usage: 
$ java -jar server/container/cli/target/james-server-cli-3.0.0-beta5-SNAPSHOT.jar -h 127.0.0.1 -p 9999

  Available commands:
    adduser </username> </password>
    removeuser </username>
    listusers
    adddomain </domainname>
    removedomain </domainname>
    listdomains

8.2. Manage via JMX

  * Launch jconsole (or any other JMX client) and connect on URL=service:jmx:rmi:///jndi/rmi://localhost:HOSTNAME/jmxrmi
  * Select the MBeans tab and open the org.apache.james node to view attributes and execute operations.

Step 9: Monitor
###############

  * Monitor the ./log/james-server.log log file.

  * Monitor via JMX (launch any JMX client and connect to URL=service:jmx:rmi:///jndi/rmi://HOSTNAME:9999/jmxrmi)

  * Check ./var folder usage
  
    mail
    +-error
    +-address-error
    +-relay-denied
    +-spam

    store
    +-maildir
    +-derby
    +-jackrabbit
    +-activemq
      +-brokers
        +-james
      +-blob-transfer
        +-outgoing
        +-spool

  * Check /tmp folder usage