Skip to content
Kyriakos Chatzidimitriou edited this page Jul 15, 2016 · 13 revisions

The following steps will help you installing the cassandra platform on your system:

  1. Install MongoDB on your system. Perhaps the Developers-quickstart-guide could be of help.
  2. Install Tomcat on your system (The platform was developed using Tomcat 7).
  • Make sure that you start Tomcat using Java 7. A solution to accomplish this create a setenv.sh file in CATALINA_HOME adding JRE_HOME=/path/to/your/java7/installation. Add also: export JAVA_OPTS="-Xms512m -Xmx1024m" Then make it executable chmod 755 setenv.sh. Check-out http://localhost:8080 to test if Tomcat is working.
  1. Secure Tomcat (see next section in the current page)
  2. Download the Cassandra platform bundle (Add link)
  3. Configure the environment variables in the application's web.xml mongo.host.address and mongo.db and set them to the MongoDB host address and the MongoDB database name to use.
  4. Build the platform using ant. The CASSANDRA Ant page describes the specifics of the build process.
  5. Optionally one can download a demo MongoDB database for quick-startup and demo purposes and restore it using mongorestore.
  6. Start the Tomcat server. (./startup.sh)
  7. Drop the cassandra.war file, found in the created dist directory of the built Cassandra platfrom bundle after using ant, in the webapps directory of the tomcat installation. The war archive will self-extract and create the webapp directory. Alternatively you can use the Tomcat manager app at https://localhost:8443/manager/html
  8. Go to https://localhost:8443/cassandra and enjoy!
  9. To shutdown Tomcat: ./shutdown.sh

Securing Tomcat

In this section we will secure Tomcat to listen only via https on port 8443:

  1. Create a key: keytool -genkey -keyalg RSA -alias host -keystore keystore.jks -validity 999 -keysize 2048

  2. Add the following connector to Tomcat server.xml configuration file:

     <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
            maxThreads="150" scheme="https" secure="true"
            clientAuth="false" sslProtocol="TLS" 
            keystoreFile="path/to/keystore.jks" keystorePass="changeit"/>
    
  3. Make sure port 8080 redirect to 8443 (server.xml again):

     <Connector connectionTimeout="20000" port="8080" protocol="HTTP/1.1" redirectPort="8443"/>
    
  4. Add the following xml snippet into Tomcat's web.xml configuration file:

     <!-- SSL settings. only allow HTTPS access to tomcat -->
     <security-constraint>
       <web-resource-collection>
         <web-resource-name>Entire Application</web-resource-name>
           <url-pattern>/*</url-pattern>
       </web-resource-collection>
       <user-data-constraint>
         <transport-guarantee>CONFIDENTIAL</transport-guarantee>
       </user-data-constraint>
     </security-constraint>
    

Adding Users

The procedure for adding users is as follows:

  1. Insert a user document in the database (collection users) through the console interface of MongoDB or any other UI MongoDB client (for example rockmongo):

     { "username": "demo"}
    
  2. This document will have an ObjecID (for example "123")

  3. Run the tool md5hashgen.jar located under the folder tools:

     java –jar md5hashgen.jar secret 123
    

    where secret is the chosen password and 123 the ObjectID.

  4. The tool will output a password in the console (for example "a1s2d3f4")

  5. Update the document in the MongoDB:

    {
          "username": "demo",
          "password": "a1s2d3f4"
    }
    
  6. Using the steps above insert a user with username: cassandralibrary and password: password. This will enable the cassandra library functionality.

Now the user can login with credentials demo and secret.

Clone this wiki locally