mbohun
11/17/2014 - 1:58 AM

ala-install add dashboard patch

ala-install add dashboard patch

diff --git a/.gitignore b/.gitignore
index 6be3615..518bec9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
+*~
 *.class
 
 # Package Files #
diff --git a/ansible/dashboard-standalone.yml b/ansible/dashboard-standalone.yml
new file mode 100644
index 0000000..c604136
--- /dev/null
+++ b/ansible/dashboard-standalone.yml
@@ -0,0 +1,7 @@
+- hosts: dashboard-service
+  roles:
+    - common
+    - java
+    - tomcat
+    - apache
+    - dashboard
diff --git a/ansible/inventories/vagrant b/ansible/inventories/vagrant
index 1dd051c..d7df1a2 100644
--- a/ansible/inventories/vagrant
+++ b/ansible/inventories/vagrant
@@ -57,6 +57,9 @@
 [alerts-service]
 10.1.1.2
 
+[dashboard-service]
+10.1.1.2
+
 [ala-demo]
 10.1.1.2
 
@@ -106,3 +109,7 @@ images_context_path = /images
 alerts_url = http://10.1.1.2/alerts
 alerts_base_url = http://10.1.1.2
 alerts_context_path = /alerts
+
+dashboard_url = http://10.1.1.2/dashboard
+dashboard_base_url = http://10.1.1.2
+dashboard_context_path = /dashboard
diff --git a/ansible/roles/dashboard/files/dashboard-apache.conf b/ansible/roles/dashboard/files/dashboard-apache.conf
new file mode 100644
index 0000000..77af083
--- /dev/null
+++ b/ansible/roles/dashboard/files/dashboard-apache.conf
@@ -0,0 +1,44 @@
+<VirtualHost *:80>
+    ServerAdmin webmaster@localhost
+
+    DocumentRoot /var/www
+    <Directory />
+	Options FollowSymLinks
+	AllowOverride None
+    </Directory>
+    <Directory /var/www/>
+	Options Indexes FollowSymLinks MultiViews
+	AllowOverride None
+	Order allow,deny
+	allow from all
+    </Directory>
+
+    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
+    <Directory "/usr/lib/cgi-bin">
+	AllowOverride None
+	Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
+	Order allow,deny
+	Allow from all
+    </Directory>
+
+    ErrorLog ${APACHE_LOG_DIR}/error.log
+
+    # Possible values include: debug, info, notice, warn, error, crit,
+    # alert, emerg.
+    LogLevel warn
+
+    CustomLog ${APACHE_LOG_DIR}/access.log combined
+
+
+    ProxyPreserveHost On
+    ProxyVia full
+
+    <proxy>
+	Order deny,allow
+	Allow from all
+    </proxy>
+
+    ProxyPass        /dashboard  http://127.0.0.1:8080/dashboard
+    ProxyPassReverse /dashboard  http://127.0.0.1:8080/dashboard
+
+</VirtualHost>
diff --git a/ansible/roles/dashboard/tasks/main.yml b/ansible/roles/dashboard/tasks/main.yml
new file mode 100644
index 0000000..5e80940
--- /dev/null
+++ b/ansible/roles/dashboard/tasks/main.yml
@@ -0,0 +1,41 @@
+- include: ../../common/tasks/setfacts.yml
+
+- name: download from maven repo
+  command: "wget {{dashboard_war_url}} --output-document={{tomcat_webapps}}dashboard.war"
+
+- name: ensure target directories exist [data subdirectories etc.]
+  file: path={{item}} state=directory owner={{tomcat_user}} group={{tomcat_user}}
+  with_items:
+    - "{{data_dir}}/dashboard/config"
+
+- name: copy all config.properties
+  template: src=dashboard-config.properties dest={{data_dir}}/dashboard/config/dashboard-config.properties
+
+- name: copy data.json
+  template: src=data.json dest={{data_dir}}/dashboard/data.json
+
+- name: set data ownership
+  file: path={{data_dir}}/dashboard owner={{tomcat_user}} group={{tomcat_user}} recurse=true
+  notify: 
+    - restart tomcat
+
+- name: Copy proxy config to conf.d (Redhat)
+  copy: src=centos-proxies.conf dest=/etc/httpd/conf.d/
+  when: ansible_os_family == "RedHat" 
+
+- name: Copy proxy config to sites-available (Debian)
+  copy: src=dashboard-apache.conf dest=/etc/apache2/sites-available/ owner=root group=root
+  when: ansible_os_family == "Debian" 
+
+- name: Create symlink to sites-enabled (Debian)
+  command: "find /etc/apache2/sites-enabled/ -type l -delete" 
+  ignore_errors: yes
+  when: ansible_os_family == "Debian" 
+
+- name: Create symlink to sites-enabled (Debian)
+  command: "ln -sf /etc/apache2/sites-available/dashboard-apache.conf /etc/apache2/sites-enabled/dashboard" 
+  ignore_errors: yes
+  when: ansible_os_family == "Debian" 
+
+- name: Start Apache2
+  service: name={{apache}} state=restarted
diff --git a/ansible/roles/dashboard/templates/dashboard-config.properties b/ansible/roles/dashboard/templates/dashboard-config.properties
new file mode 100644
index 0000000..dab8a63
--- /dev/null
+++ b/ansible/roles/dashboard/templates/dashboard-config.properties
@@ -0,0 +1,12 @@
+# CAS Config
+casProperties=casServerLoginUrl,serverName,centralServer,casServerName,uriFilterPattern,uriExclusionFilter,authenticateOnlyIfLoggedInFilterPattern,casServerLoginUrlPrefix,gateway,casServerUrlPrefix,contextPath
+serverName={{dashboard_base_url}}
+contextPath={{dashboard_context_path}}
+grails.serverURL={{dashboard_base_url}}{{dashboard_context_path}}
+casServerName=https://auth.ala.org.au
+uriExclusionFilterPattern=/images.*,/css.*,/js.*,/less.*
+casServerLoginUrl=https://auth.ala.org.au/cas/login
+gateway=false
+casServerUrlPrefix=https://auth.ala.org.au/cas
+security.cas.logoutUrl=https://auth.ala.org.au/cas/logout
+uriFilterPattern=
diff --git a/ansible/roles/dashboard/templates/data.json b/ansible/roles/dashboard/templates/data.json
new file mode 100644
index 0000000..972bc3f
--- /dev/null
+++ b/ansible/roles/dashboard/templates/data.json
@@ -0,0 +1,37 @@
+{
+"taxaCounts": {
+	"acceptedNames": "195424",
+	"acceptedSpeciesNames": "152080",
+	"synonymNames": "146974",
+	"speciesWithRecords": "111566"
+	},
+"collections": {
+	"total": 147,
+	"plants": 43,
+	"micro": 31,
+	"insects": 25,
+	"otherFauna": 59
+	},
+"bhlCounts": {
+	"pages": 39184197,
+	"titles": 56175,
+	"volumes": 106715,
+	"publishers": 1695
+	},
+"boldCounts": {
+	"records": 606922,
+	"species": 37557,
+	"countries": 220,
+	"institutions": 790
+	},
+"identifyLife": {
+	"keys": 532
+	},
+ "volunteerPortalCounts": {
+ 	"recordsTranscribed": 11890,
+ 	"pagesTranscribed": 295,
+ 	"volunteers": 147,
+ 	"activeProjects": 5,
+ 	"completedProjects": 6
+ 	}
+}
\ No newline at end of file
diff --git a/ansible/roles/dashboard/vars/main.yml b/ansible/roles/dashboard/vars/main.yml
new file mode 100644
index 0000000..12335c1
--- /dev/null
+++ b/ansible/roles/dashboard/vars/main.yml
@@ -0,0 +1,2 @@
+# assets
+dashboard_war_url: "{{maven_repo}}/au/org/ala/dashboard/dashboard.war"