Difference between revisions of "Analytics"

From CoGepedia
Jump to: navigation, search
(Configuring Analytics to the Database)
Line 18: Line 18:
 
*Leingingen - [https://github.com/technomancy/leiningen Leiningen - Automate Clojure projects without setting your hair on fire.]
 
*Leingingen - [https://github.com/technomancy/leiningen Leiningen - Automate Clojure projects without setting your hair on fire.]
  
<br>
+
=== Configuring Analytics to the Database  ===
 +
 
 +
Once you have all the prerequisites installed, you need to get the Greentea (Analytics) repo from Github. Run:
 +
 
 +
  `$ git clone https://github.com/LyonsLab/Greentea.git`
 +
 
 +
TODO: Create a configuration file that allows for loading in settings from it so you don't have to fudge with the code.
 +
 
 +
Open "Greentea/src/greentea/db.clj" in your favorite text editor.
 +
 
 +
Modify from line 9:
 +
 
 +
  defdb cogedb                                                                 
 +
  (mysql {:db "&lt;DB&gt;"                                                           
 +
          &nbsp;:user "&lt;DB USER&gt;"                                                         
 +
          &nbsp;:host "&lt;DB HOST (probably localhost)&gt;"                                                   
 +
          &nbsp;:port "&lt;DB&nbsp;PORT (remove this line if default)&gt;"                                                         
 +
          &nbsp;:password "&lt;DB&nbsp;PASSWORD&gt;"})
 +
 
 +
Write to the file. Make sure not to push any sensitive information back to Github!
  
 
=== Get Analytics Running:  ===
 
=== Get Analytics Running:  ===
  
Once you have all the prerequisites installed, you need to get the Greentea (Analytics) repo from Github.
 
Run:
 
  `$ git clone https://github.com/LyonsLab/Greentea.git`
 
 
Inside the cloned directory run:  
 
Inside the cloned directory run:  
 +
 
   `$ lein run &amp;`
 
   `$ lein run &amp;`
it should pull in all the required dependencies'''*''' and start a Jetty servlet running on port 3456.
 
  
Check localhost:3456 to verify that the analytics platform is running.
+
it should pull in all the required dependencies'''*''' and start a Jetty servlet running on port 3456.
 +
 
 +
Check localhost:3456 to verify that the analytics platform is running.  
  
 
=== Configure Apache to Proxy the Servlet Port to the /analytics Endpoint  ===
 
=== Configure Apache to Proxy the Servlet Port to the /analytics Endpoint  ===
Line 49: Line 67:
 
  Allow from all                                                           
 
  Allow from all                                                           
 
  &lt;/Directory&gt;                                                                 
 
  &lt;/Directory&gt;                                                                 
                                                         
+
                                                       
 
  DocumentRoot &lt;PATH&gt;/Greentea/resources/public                     
 
  DocumentRoot &lt;PATH&gt;/Greentea/resources/public                     
                                                         
+
                                                       
 
  ProxyPass /analytics/ http://localhost:3456/analytics/                       
 
  ProxyPass /analytics/ http://localhost:3456/analytics/                       
 
  ProxyPassReverse /analytics/ http://localhost:3456/analytics/                 
 
  ProxyPassReverse /analytics/ http://localhost:3456/analytics/                 
                                                         
+
                                                       
 
  ProxyPass /analytics http://localhost:3456/analytics/                         
 
  ProxyPass /analytics http://localhost:3456/analytics/                         
 
  ProxyPassReverse /analytics http://localhost:3456/analytics/                 
 
  ProxyPassReverse /analytics http://localhost:3456/analytics/                 
                                                         
+
                                                       
 
  ProxyPass /greentea/ http://localhost:3456/greentea/                         
 
  ProxyPass /greentea/ http://localhost:3456/greentea/                         
 
  ProxyPassReverse /greentea/ http://localhost:3456/greentea/                   
 
  ProxyPassReverse /greentea/ http://localhost:3456/greentea/                   
                                                         
+
                                                       
 
  ProxyPass /greentea http://localhost:3456/greentea/                           
 
  ProxyPass /greentea http://localhost:3456/greentea/                           
 
  ProxyPassReverse /greentea http://localhost:3456/greentea/                   
 
  ProxyPassReverse /greentea http://localhost:3456/greentea/                   
 
  &lt;/VirtualHost&gt;  
 
  &lt;/VirtualHost&gt;  
  
Now run:
+
These lines proxy calls to /analytics and /analytics/ to port 3456/analytics so that we don't have to type any ugly numbers to reach our site.
 +
 
 +
Finally:  
  
 
   `sudo services apache2 restart`
 
   `sudo services apache2 restart`
  
If it says OK, it means the server should be started and you should be able to point a browser at localhost/analytics. However, we still need to configure the metrics to the database before we can get any useful information.
+
If it says OK, it means the server should be started and you should be able to point a browser at localhost/analytics.  
 
+
=== Configuring Analytics to the Database  ===
+
  
TODO: Create a configuration file that allows for loading in settings from it so you don't have to fudge with the code.
+
If everything was configured properly point your browser to &lt;DNS&gt;/analytics and Analytics should be up and running! <br> <br>
 
+
Open "Greentea/src/greentea/db.clj"
+
 
+
Modify from line 9:
+
 
+
  defdb cogedb                                                                 
+
    (mysql {:db "&lt;DB&gt;"                                                           
+
          &nbsp;:user "&lt;DB USER&gt;"                                                         
+
          &nbsp;:host "&lt;DB HOST (probably localhost)&gt;"                                                   
+
          &nbsp;:port "&lt;DB&nbsp;PORT (remove this line if default)&gt;"                                                         
+
          &nbsp;:password "&lt;DB&nbsp;PASSWORD&gt;"})
+
  
Write to the file. Make sure not to push sensitive information back to Github!
+
----
  
=== *In the case of a common dependency issue with iplant-clojure-commons: ===
+
=== *In the case of a common dependency issue with iplant-clojure-commons: ===
  
 
We need to point to the missing dependency manually: Run:  
 
We need to point to the missing dependency manually: Run:  

Revision as of 12:13, 12 February 2013

CoGe - Analytics

CoGe Analytics is a metrics and analytics engine for the CoGe platform written on Clojure's web framework Noir.


How To: Deploy on a Server via Apache Webserver

Prerequisites:

(You can install these CLI tools using your linux distributions preferred package manager)

Configuring Analytics to the Database

Once you have all the prerequisites installed, you need to get the Greentea (Analytics) repo from Github. Run:

 `$ git clone https://github.com/LyonsLab/Greentea.git`

TODO: Create a configuration file that allows for loading in settings from it so you don't have to fudge with the code.

Open "Greentea/src/greentea/db.clj" in your favorite text editor.

Modify from line 9:

 defdb cogedb                                                                   
  (mysql {:db "<DB>"                                                            
          :user "<DB USER>"                                                          
          :host "<DB HOST (probably localhost)>"                                                     
          :port "<DB PORT (remove this line if default)>"                                                          
          :password "<DB PASSWORD>"})

Write to the file. Make sure not to push any sensitive information back to Github!

Get Analytics Running:

Inside the cloned directory run:

 `$ lein run &`

it should pull in all the required dependencies* and start a Jetty servlet running on port 3456.

Check localhost:3456 to verify that the analytics platform is running.

Configure Apache to Proxy the Servlet Port to the /analytics Endpoint

Now to setup apache to point localhost/analytics/ to port 3456. Open '/etc/apache2/apache.conf' in your favorite editor and add these lines:

RewriteEngine On 
NameVirtualHost *:90 
Listen 90

<VirtualHost *:90> 
ServerAdmin coge.genome@gmail.com ServerName localhost 
#ServerAlias geco.com.analytics
ErrorLog /home/rchasman/logs/error.log CustomLog <PATH>/logs/access.log combined LogLevel warn

<Directory <PATH>/Greentea/resources/public/>                    
AllowOverride All                                                        
Order Allow,Deny                                                         
Allow from all                                                           
</Directory>                                                                 
                                                        
DocumentRoot <PATH>/Greentea/resources/public                    
                                                        
ProxyPass /analytics/ http://localhost:3456/analytics/                       
ProxyPassReverse /analytics/ http://localhost:3456/analytics/                
                                                        
ProxyPass /analytics http://localhost:3456/analytics/                        
ProxyPassReverse /analytics http://localhost:3456/analytics/                 
                                                        
ProxyPass /greentea/ http://localhost:3456/greentea/                         
ProxyPassReverse /greentea/ http://localhost:3456/greentea/                  
                                                        
ProxyPass /greentea http://localhost:3456/greentea/                          
ProxyPassReverse /greentea http://localhost:3456/greentea/                   
</VirtualHost> 

These lines proxy calls to /analytics and /analytics/ to port 3456/analytics so that we don't have to type any ugly numbers to reach our site.

Finally:

 `sudo services apache2 restart`

If it says OK, it means the server should be started and you should be able to point a browser at localhost/analytics.

If everything was configured properly point your browser to <DNS>/analytics and Analytics should be up and running!


*In the case of a common dependency issue with iplant-clojure-commons:

We need to point to the missing dependency manually: Run:

 `$ git clone https://github.com/iPlantCollaborativeOpenSource/iplant-clojure-commons.git`

In the iplant-clojure-commons directory, run:

 `$ lein uberjar` 

In lein 2.0 this will create a file at "<PATH>/iplant-clojure-commons/clojure-commons-1.3.3-SNAPSHOT-standalone.jar"

Replacing with appropriate <PATH>, run:

 `mvn install:install-file -DgroupId=org.iplantc -DartifactId=clojure-commons -Dversion=1.3.3-SNAPSHOT -Dpackaging=jar -Dfile=<PATH>/iplant-clojure-commons/clojure-commons-1.3.3-SNAPSHOT-standalone.jar`

Now try

 `$ lein clean` 

and then

 `$ lein run` 

The dependency issue should be resolved.