Skip to content
This repository has been archived by the owner on Oct 10, 2021. It is now read-only.

Commit

Permalink
Add CI Testing (#5)
Browse files Browse the repository at this point in the history
* Add CI Testing

* Update tests

* Revert file changed in logging
  • Loading branch information
jonathangreen authored and whikloj committed Mar 2, 2018
1 parent d9cad3e commit 6b42119
Show file tree
Hide file tree
Showing 11 changed files with 276 additions and 18 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
tests/test.sh
*.retry
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
services: docker

env:
# - distro: centos7
- distro=ubuntu1604 playbook=web_xml.yml
- distro=ubuntu1604 playbook=java_opts.yml

script:
# Download test shim.
- wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/geerlingguy/73ef1e5ee45d8694570f334be385e181/raw/
- chmod +x ${PWD}/tests/test.sh

# Run tests.
- ${PWD}/tests/test.sh
20 changes: 14 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Ansible Role: Blazegraph
# Ansible Role: Blazegraph [![Build Status](https://travis-ci.org/Islandora-Devops/ansible-role-blazegraph.svg?branch=master)](https://travis-ci.org/Islandora-Devops/ansible-role-blazegraph)

An Ansible role that installs [Blazegraph](https://www.blazegraph.com/) in a Karaf container on:

Expand Down Expand Up @@ -32,18 +32,26 @@ There are additional configuration options available and documented in [defaults

## Dependencies

This expects an Apache Tomcat container to install into. This role should also handle a notification "restart tomcat8". We recommend the following.
This expects an Apache Tomcat container to install into.

This role should also handle a notification "restart tomcat8".

We recommend the following:
* Islandora-Devops.tomcat8
* [Github](https://github.com/Islandora-Devops/ansible-role-tomcat8)
* [Galaxy](https://galaxy.ansible.com/Islandora-Devops/tomcat8/)

In order for blazegraph to find its configuration files you have two options:
* Specify it in the blazegraph web.xml file:
* This can be done automatically the role be specifying `blazegraph_webxml_template: yes` (default)
* Set the blazegraph options in your `JAVA_OPTS` environment variable. How to do this depends on the role. An example using Islandora-Devops.tomcat8 can be found [here](tests/java_opts.yml).

## Example Playbook

- hosts: webservers
roles:
- { role: Islandora-Devops.blazegraph }
There are two examples depending how the configuration infomration is passed to blazegraph:
* [Using JAVA_OPTS](tests/java_opts.yml)
* [Using web.xml](tests/web_xml.yml)

## License

MIT
MIT
2 changes: 2 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ blazegraph_war_path: "{{ tomcat8_home }}/webapps/bigdata.war"
blazegraph_log4j_template: log4j.properties
blazegraph_log_dir: /var/log/tomcat8/blazegraph
blazegraph_log4j_path: "{{ tomcat8_home }}/webapps/bigdata/WEB-INF/classes/log4j.properties"
blazegraph_webxml_path: "{{ tomcat8_home }}/webapps/bigdata/WEB-INF/web.xml"
blazegraph_webxml_template: yes

# -- All of these are properties that go into RWStore.properties
##
Expand Down
9 changes: 9 additions & 0 deletions tasks/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,12 @@
- blazegraph.properties
- inference.nt
notify: restart tomcat8

- name: Drop in templated web.xml file
template:
src: web.xml.j2
dest: "{{ blazegraph_webxml_path }}"
owner: "{{ blazegraph_user }}"
group: "{{ blazegraph_user }}"
notify: restart tomcat8
when: blazegraph_webxml_template
10 changes: 5 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
- blazegraph
- blazegraph-install

- include: config.yml
tags:
- blazegraph
- blazegraph-config

- include: download.yml
tags:
- blazegraph
Expand All @@ -20,6 +15,11 @@
- blazegraph
- blazegraph-logging

- include: config.yml
tags:
- blazegraph
- blazegraph-config

- include: namespace.yml
tags:
- blazegraph
Expand Down
12 changes: 5 additions & 7 deletions tasks/namespace.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
---

# Need to make sure Blazegraph is up and running before applying config changes
- debug: msg="restart Tomcat"
notify: restart tomcat8
changed_when: true

# By default, ansible will run handlers at the end, here we are forcing ansible to restart tomcat
- meta: flush_handlers
# This is needed so blazegraph will startup. Otherwise our handlers
# would fire too late and blazegraph wouldn't start to register the
# namespaces we need.
- name: Fire handlers
meta: flush_handlers

- name: "Wait for Blazegraph to come up"
uri:
Expand Down
203 changes: 203 additions & 0 deletions templates/web.xml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
<?xml version="1.0" encoding="UTF-8"?>

<!-- ### This file is managed by Ansible ### -->

<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<display-name>Bigdata</display-name>
<description>Bigdata</description>
<context-param>
<description>The property file (for a standalone database instance) or the
jini configuration file (for a federation). The file MUST end with either
".properties" or ".config". This path is relative to the directory from
which you start the servlet container so you may have to edit it for your
installation, e.g., by specifying an absolution path. Also, it is a good
idea to review the RWStore.properties file as well and specify the location
of the database file on which it will persist your data.

Note: You MAY override this parameter using
"-Dcom.bigdata.rdf.sail.webapp.ConfigParams.propertyFile=FILE"
when starting the servlet container.
</description>
<!-- Note: This path is relative to the directory in which you start -->
<!-- the servlet container or within the classpath as a resource. -->
<!-- For the IDE, this is generally the root -->
<!-- of the bigdata project. For the WAR, it depends where you start -->
<!-- the servlet container. The "ant war" target rewrites this to be -->
<!-- relative to the root of the servlet container by default. -->
<param-name>propertyFile</param-name>
<param-value>{{ blazegraph_home_dir }}/conf/RWStore.properties</param-value>
</context-param>
<context-param>
<description>The default bigdata namespace of for the triple or quad store
instance to be exposed.</description>
<param-name>namespace</param-name>
<param-value>kb</param-value>
</context-param>
<context-param>
<description>When true a new triple or quads store instance will be created
if none is found at that namespace.</description>
<param-name>create</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<description>The size of the thread pool used to service SPARQL queries -OR-
ZERO (0) for an unbounded thread pool.</description>
<param-name>queryThreadPoolSize</param-name>
<param-value>16</param-value>
</context-param>
<context-param>
<description>When true, the REST API will not permit mutation operations.</description>
<param-name>readOnly</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<description>When non-zero, the timeout for queries (milliseconds).</description>
<param-name>queryTimeout</param-name>
<param-value>0</param-value>
</context-param>
<context-param>
<description>When non-zero, the timeout for the warmup period (milliseconds). The warmup period pulls in the non-leaf index pages and reduces the impact of sudden heavy query workloads on the disk and on GC. The end points are not available during the warmup period.</description>
<param-name>warmupTimeout</param-name>
<param-value>0</param-value>
</context-param>
<context-param>
<description>A list of the namespaces to be exercised during the warmup period (optional). When the list is empty, all namespaces will be warmed up.</description>
<param-name>warmupNamespaceList</param-name>
<param-value></param-value>
</context-param>
<context-param>
<description>The number of parallel threads to use for the warmup period. At most one thread will be used per index.</description>
<param-name>warmupThreadPoolSize</param-name>
<param-value>20</param-value>
</context-param>
<!-- <context-param>
<description>List of allowed services.</description>
<param-name>serviceWhitelist</param-name>
<param-value>http://www.bigdata.com/rdf/search#search,http://www.bigdata.com/rdf#describe</param-value>
</context-param> -->
<context-param>
<description>The name of the class to use for the Blueprints Servlet instance</description>
<param-name>blueprintsServletProvider</param-name>
<param-value>com.bigdata.blueprints.webapp.BlueprintsServlet</param-value>
</context-param>
<listener>
<listener-class>com.bigdata.rdf.sail.webapp.BigdataRDFServletContextListener</listener-class>
</listener>
<servlet>
<servlet-name>REST API</servlet-name>
<display-name>REST API</display-name>
<description>The REST API, including a SPARQL end point, as described at
https://wiki.blazegraph.com/wiki/index.php/NanoSparqlServer
</description>
<servlet-class>com.bigdata.rdf.sail.webapp.RESTServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>Multi-Tenancy API</servlet-name>
<display-name>Multi-Tenancy API</display-name>
<description>The REST API for managing multiple KBs in a single Journal
or Federation.
</description>
<servlet-class>com.bigdata.rdf.sail.webapp.MultiTenancyServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>DataLoader</servlet-name>
<display-name>DataLoader Servlet</display-name>
<description>Servlet providing DataLoader functionality for bulk loading into
a namespace.</description>
<servlet-class>com.bigdata.rdf.sail.webapp.DataLoaderServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>Backup</servlet-name>
<display-name>Backup Servlet</display-name>
<description>Servlet providing a REST API for creating online backups.</description>
<servlet-class>com.bigdata.rdf.sail.webapp.BackupServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>Transaction Management API</servlet-name>
<display-name>Transaction Management API</display-name>
<description>The REST API for managing transactions for a Journal.
</description>
<servlet-class>com.bigdata.rdf.sail.webapp.TxServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>Status</servlet-name>
<display-name>Status</display-name>
<description>A status page.</description>
<servlet-class>com.bigdata.rdf.sail.webapp.StatusServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<servlet>
<servlet-name>Counters</servlet-name>
<display-name>Performance counters</display-name>
<description>Performance counters.</description>
<servlet-class>com.bigdata.rdf.sail.webapp.CountersServlet</servlet-class>
<async-supported>true</async-supported>
</servlet>
<!-- Note: The HALoadBalancerServlet is deployed from override-web.xml -->
<!-- Serve anything under /html/* as a simple file. -->
<servlet-mapping>
<servlet-name>default</servlet-name>
<url-pattern>/html/*</url-pattern>
</servlet-mapping>
<!-- Mapping for the default KB namespace (as configured above). -->
<servlet-mapping>
<servlet-name>REST API</servlet-name>
<url-pattern>/sparql</url-pattern>
</servlet-mapping>
<!-- Mapping for access to non-default KB namespaces.
<servlet-mapping>
<servlet-name>REST API</servlet-name>
<url-pattern>/sparql/*</url-pattern>
</servlet-mapping> -->
<!-- Mappings for the multi-tenancy API. -->
<servlet-mapping>
<servlet-name>Multi-Tenancy API</servlet-name>
<url-pattern>/namespace</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Multi-Tenancy API</servlet-name>
<url-pattern>/namespace/*</url-pattern>
</servlet-mapping>
<!-- Mappings for the DataLoader Servlet API. -->
<servlet-mapping>
<servlet-name>DataLoader</servlet-name>
<url-pattern>/dataloader</url-pattern>
</servlet-mapping>
<!-- Mappings for the Backup Servlet API. -->
<servlet-mapping>
<servlet-name>Backup</servlet-name>
<url-pattern>/backup</url-pattern>
</servlet-mapping>
<!-- Mappings for the TX API. -->
<servlet-mapping>
<servlet-name>Transaction Management API</servlet-name>
<url-pattern>/tx</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Transaction Management API</servlet-name>
<url-pattern>/tx/*</url-pattern>
</servlet-mapping>
<!-- Mapping for the status page. -->
<servlet-mapping>
<servlet-name>Status</servlet-name>
<url-pattern>/status</url-pattern>
</servlet-mapping>
<!-- Mapping for the performance counters page. -->
<servlet-mapping>
<servlet-name>Counters</servlet-name>
<url-pattern>/counters</url-pattern>
</servlet-mapping>
<!-- Map the initial request into the UI. -->
<welcome-file-list>
<welcome-file>html/index.html</welcome-file>
</welcome-file-list>
</web-app>
12 changes: 12 additions & 0 deletions tests/java_opts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
- hosts: all

roles:
- role: Islandora-Devops.tomcat8
tomcat8_java_opts:
- -Djava.awt.headless=true
- -Xmx128m
- -XX:+UseConcMarkSweepGC
- -Dcom.bigdata.rdf.sail.webapp.ConfigParams.propertyFile={{ blazegraph_home_dir }}/conf/RWStore.properties
- role: role_under_test
blazegraph_webxml_template: no
3 changes: 3 additions & 0 deletions tests/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---

- Islandora-Devops.tomcat8
6 changes: 6 additions & 0 deletions tests/web_xml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- hosts: all

roles:
- Islandora-Devops.tomcat8
- role_under_test

0 comments on commit 6b42119

Please sign in to comment.