Skip to content

Commit 0477614

Browse files
committed
Refactored debian packaging - Switched to jdeb maven plugin.
1 parent 41a7f49 commit 0477614

File tree

52 files changed

+1611
-159
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1611
-159
lines changed

pom.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646

4747
<module>sparqlify-web-admin-client</module>
4848
<module>sparqlify-web-admin-server</module>
49+
50+
<module>sparqlify-debian-tomcat-common</module>
4951
<module>sparqlify-debian-tomcat7</module>
5052
</modules>
5153

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Sparqlify Web Admin Deployment Guide for Tomcat 7 on Ubuntu
2+
3+
## Prerequisites
4+
5+
Although Sparqlify Web Admin comes packaged as a Debian package, you need to adjust a few system settings before it will work.
6+
7+
Important: Before installing the Sparqlify Web Admin Debian package, please make sure you have a Java JDK installed and that your Tomcat configuration is adjusted according to the following instructions.
8+
Otherwise, you may be left with a non-functional deployed war file.
9+
10+
* If you have not done already, install a JDK using one of the commands below. Be aware that if you have `openjdk-6-jre` (just the runtime!) installed and you additionally install `openjdk-7-jdk`, you have 2 versions of Java on your system. If `openjdk-6-jre` is then still set as the default Java, upon launching the Sparqlify Web Admin in your browser you will see an exception that a JDK is required to run this web application.
11+
12+
# Pick a jdk if you need one.
13+
# sudo apt-get install openjdk-6-jdk
14+
# sudo apt-get install openjdk-7-jdk
15+
16+
# Fixing your Java configuration is out of scope for this guide,
17+
# but this command lists the installed Java versions and may help you
18+
# on your decision on which jdk to install:
19+
20+
dpkg --get-selections | grep openjdk-
21+
22+
* Make sure that there is an approriate JDBC driver in tomcat's lib folder. If not, you can install one using the command below. Note that we sucessfully tested version 8.4-701 against Postgresql 9.* databases, however we had issues related to incompatible datatype mappings with the 9.* JDBC drivers.
23+
24+
sudo wget -P /usr/share/tomcat7/lib/ http://repo1.maven.org/maven2/postgresql/postgresql/8.4-701.jdbc4/postgresql-8.4-701.jdbc4.jar
25+
26+
* For running the Sparqlify Web Admin, Tomcat needs to be configured to at least 512MB or RAM.
27+
A common recommendation to achieve this is to set `JAVA_HOME` or `CATALINA_HOME`, however this may have no effect - at least on some Ubuntu distributions, such as 12.04 - as their values may be overwriten, such as seen in the snippet below.
28+
Edit the file `/etc/default/tomcat7` and perform the following change.
29+
30+
# The original options look something like this:
31+
# JAVA_OPTS="-Djava.awt.headless=true -Xmx128m -XX:+UseConcMarkSweepGC"
32+
33+
JAVA_OPTS="-Djava.awt.headless=true -Xmx512m -XX:+UseConcMarkSweepGC"
34+
35+
If you followed about recommendations, your chances of getting a working deployment have increased drastically.
36+
37+
38+
* If you install the Sparqlify Web Admin from file - rather than a repository - you first need to install the following dependencies manually:
39+
40+
sudo apt-get install tomcat7 dbconfig-common xsltproc postgresql
41+
42+
* The Sparqlify Web Admin debian package is available at:
43+
44+
[http://cstadler.aksw.org/repos/apt/pool/main/s/sparqlify-tomcat7/](http://cstadler.aksw.org/repos/apt/pool/main/s/sparqlify-tomcat7/)
45+
46+
* Download the sparqlify-tomcat7 package and install it with (fill out `${version}` appropriately):
47+
48+
sudo dpkg -i sparqlify-tomcat7_${version}.deb
49+
50+
* When prompted for the database password, enter one. Important note: Currently there is a character escaping issue - do not use characters that have special meaning in XML in the password, otherwise you need to manually fix the file `/etc/tomcat7/Catalina/localhost/sparqlify.xml`.
51+
52+
* Visiting the following URL with your browser should show the Sparqlify Web Admin dashboard
53+
54+
[http://localhost:8080/sparqlify](http://localhost:8080/sparqlify)
55+
56+
* If this is the case: Congratulations! Otherwise, check out the trouble shooting guide.
57+
58+
## A Quick Mapping Example
59+
60+
The Sparqlify Web Admin uses a relational database for data storage.
61+
So you can test your setup by mapping this database.
62+
63+
* Click on "Add New Service" and use the following settings:
64+
65+
path: test
66+
hostname: localhost
67+
database: sparqlifytomcat7
68+
username: sparqlifytomcat7
69+
password: (whatever you entered when you were prompted for a password during the install of the debian package)
70+
71+
* Paste the following statement into the text area for the mapping:
72+
73+
Prefix o: <http://example.org/ontology/>
74+
Prefix r: <http://example.org/resource/>
75+
76+
Create View rdb2rdfExecution As
77+
Construct {
78+
?s
79+
a o:Rdb2RdfExecution ;
80+
a o:ServiceExecution ;
81+
o:id ?i ;
82+
o:status ?st ; .
83+
}
84+
With
85+
?s = uri(r:, 'serviceExecution', ?id)
86+
?i = typedLiteral(?id, xsd:int)
87+
?st = plainLiteral(?status)
88+
From
89+
[[SELECT id, status FROM configtoexecution WHERE configclassname='org.aksw.sparqlify.admin.model.Rdb2RdfConfig']]
90+
91+
* The table in the dashboard should now show an entry. In the column "Path" click on the link "test". A new tab with the HTML view of the SPARQL endpoint should open. Runnig the default query should show some RDF data.
92+
93+
## Trouble Shooting
94+
* In the browser I see an exception that I need a full JDK installed.
95+
* Check the prerequisites about the notes about the JDK.
96+
* In the browser I see a blank page.
97+
* Check `/var/log/tomcat7/catalina.out` for exceptions.
98+
* In `catalina.out`, I see an exception mentioning `Heap space`
99+
* Probably Tomcat does not have enough memory. Check the prerequisites section.
100+
* In `catalina.out`, I see `java.lang.NoSuchMethodError: org.postgresql.core.BaseConnection.getLargeObjectAPI()Lorg/postgresql/largeobject/LargeObjectManager;`
101+
* Place the PostgreSQL JDBC driver into `/usr/share/tomcat7/lib`. Check the prerequisites section.
102+
103+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/sh
2+
3+
# Save the current working directory (cwd)
4+
cwd=`pwd`
5+
6+
cd ..
7+
mvn clean install
8+
9+
cd "$cwd"
10+
mvn -e clean install war:war deb:package
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
# Save the current working directory (cwd)
4+
cwd=`pwd`
5+
6+
cd ../sparqlify-web-admin-server
7+
mvn clean install
8+
9+
cd "$cwd"
10+
mvn -e clean install war:war deb:package
11+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
mvn -e clean install war:war deb:package
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/sh
2+
3+
debFile=`find target -name 'sparqlify*.deb'`
4+
sudo dpkg -i "$debFile"
Lines changed: 213 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,213 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
5+
<parent>
6+
<groupId>org.aksw.sparqlify</groupId>
7+
<artifactId>sparqlify-parent</artifactId>
8+
<version>0.6.5-SNAPSHOT</version>
9+
</parent>
10+
11+
<artifactId>sparqlify-debian-tomcat-common</artifactId>
12+
<packaging>jar</packaging>
13+
14+
15+
<name>Sparqlify - Debian Packaging - Tomcat Common</name>
16+
17+
18+
<properties>
19+
<deb.packageName>sparqlify-tomcat-common</deb.packageName>
20+
<tomcat.context.name>sparqlify</tomcat.context.name>
21+
</properties>
22+
23+
<profiles>
24+
<profile>
25+
<id>tomcat</id>
26+
<activation>
27+
<activeByDefault>true</activeByDefault>
28+
</activation>
29+
<properties>
30+
<project.description>A web application for working with SPARQL accessible data.</project.description>
31+
</properties>
32+
</profile>
33+
<profile>
34+
<id>tomcat-lod2</id>
35+
<properties>
36+
<project.description>A web application for working with SPARQL accessible data.
37+
.
38+
LOD2 is a large-scale integrating project co-funded by the European
39+
Commission within the FP7 Information and Communication Technologies
40+
Work Programme (Grant Agreement No. 257943). Commencing in September
41+
2010, this 4-year project comprises leading Linked Open Data technology
42+
researchers, companies, and service providers from across 7 European
43+
countries and is coordinated by the AKSW research group at the
44+
University of Leipzig.</project.description>
45+
</properties>
46+
</profile>
47+
</profiles>
48+
49+
<description>${project.description}</description>
50+
51+
<build>
52+
<plugins>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-war-plugin</artifactId>
56+
<version>2.3</version>
57+
<configuration>
58+
<failOnMissingWebXml>false</failOnMissingWebXml>
59+
</configuration>
60+
</plugin>
61+
62+
63+
<plugin>
64+
<!-- This plugin's configuration must come *before* the Debian Maven
65+
Plugin. -->
66+
<artifactId>maven-resources-plugin</artifactId>
67+
<version>2.4</version>
68+
<executions>
69+
<execution>
70+
<id>copy-deb-resources</id>
71+
<phase>process-resources</phase>
72+
<goals>
73+
<goal>copy-resources</goal>
74+
</goals>
75+
<configuration>
76+
<overwrite>true</overwrite>
77+
<!-- <includeEmptyDirs>true</includeEmptyDirs> -->
78+
<outputDirectory>${project.build.directory}/deb</outputDirectory>
79+
<resources>
80+
<resource>
81+
<directory>${basedir}/src/deb/resources</directory>
82+
<!-- Uncomment the following line to enable Velocity filtering. -->
83+
<!-- <filtering>true</filtering> -->
84+
</resource>
85+
</resources>
86+
</configuration>
87+
</execution>
88+
</executions>
89+
</plugin>
90+
91+
92+
<plugin>
93+
<!-- This plugin's configuration must come *after* the Maven Resources
94+
Plugin, and *before* the Debian Maven Plugin. -->
95+
<groupId>org.apache.maven.plugins</groupId>
96+
<artifactId>maven-antrun-plugin</artifactId>
97+
<version>1.6</version>
98+
<executions>
99+
100+
101+
<execution>
102+
<id>create-symlinks</id>
103+
<phase>package</phase>
104+
<configuration>
105+
<target>
106+
<mkdir dir="${project.build.directory}/deb/usr/share/lib/${deb.packageName}/" />
107+
108+
<!-- ${project.packaging} -->
109+
<copy
110+
file="${project.build.directory}/${project.build.finalName}.${project.packaging}"
111+
tofile="${project.build.directory}/deb/usr/share/lib/${deb.packageName}/${project.build.finalName}.war" />
112+
113+
</target>
114+
</configuration>
115+
<goals>
116+
<goal>run</goal>
117+
</goals>
118+
</execution>
119+
120+
121+
<!-- <execution> -->
122+
<!-- <id>merge-control</id> -->
123+
<!-- <phase>package</phase> -->
124+
<!-- <configuration> -->
125+
<!-- <target> -->
126+
<!-- <exec dir="${basedir}/src/deb/bin" executable="${basedir}/src/deb/bin/merge-control-file.sh" -->
127+
<!-- failonerror="true"> -->
128+
<!-- </exec> -->
129+
<!-- </target> -->
130+
<!-- </configuration> -->
131+
<!-- <goals> -->
132+
<!-- <goal>run</goal> -->
133+
<!-- </goals> -->
134+
<!-- </execution> -->
135+
136+
<execution>
137+
<id>fix-permissions</id>
138+
<phase>package</phase>
139+
<configuration>
140+
<target>
141+
<chmod perm="ugo+x">
142+
<fileset dir="${project.build.directory}/deb">
143+
<include name="**/bin/**" />
144+
<include name="**/sbin/**" />
145+
<include name="DEBIAN/post*" />
146+
<include name="DEBIAN/pre*" />
147+
<include name="DEBIAN/rules" />
148+
<include name="DEBIAN/config" />
149+
</fileset>
150+
</chmod>
151+
</target>
152+
</configuration>
153+
<goals>
154+
<goal>run</goal>
155+
</goals>
156+
</execution>
157+
158+
<!-- A hacky execution for making the DEBIAN directory lower case -->
159+
<!-- NOTE The maven plugin creates a deb, so this is fine at this stage, -->
160+
<!-- Renaming to lower case is done in the continuous integration server -->
161+
<!-- <execution> -->
162+
<!-- <phase>verify</phase> -->
163+
<!-- <goals> -->
164+
<!-- <goal>run</goal> -->
165+
<!-- </goals> -->
166+
<!-- <configuration> -->
167+
<!-- <tasks> -->
168+
<!-- <copy todir="${project.build.directory}/deb/debian"> -->
169+
<!-- <fileset dir="${project.build.directory}/deb/DEBIAN"> -->
170+
<!-- <include name="**" /> -->
171+
<!-- </fileset> -->
172+
<!-- </copy> -->
173+
<!-- <delete dir="${project.build.directory}/deb/DEBIAN" /> -->
174+
<!-- </tasks> -->
175+
<!-- </configuration> -->
176+
<!-- </execution> -->
177+
</executions>
178+
</plugin>
179+
180+
<plugin>
181+
<groupId>net.sf.debian-maven</groupId>
182+
<artifactId>debian-maven-plugin</artifactId>
183+
<version>1.0.5</version>
184+
<configuration>
185+
<packageName>${deb.packageName}</packageName>
186+
<packagePriority>extra</packagePriority>
187+
<packageSection>web</packageSection>
188+
<packageDependencies>
189+
<packageDependency>dbconfig-common</packageDependency>
190+
<packageDependency>xsltproc</packageDependency>
191+
<packageDependency>postgresql</packageDependency>
192+
</packageDependencies>
193+
<maintainerName>${project.parent.developers[0].name}</maintainerName>
194+
<maintainerEmail>${project.parent.developers[0].email}</maintainerEmail>
195+
<!-- <packageName>my-package</packageName> <packageVersion>1.0.0</packageVersion>
196+
... -->
197+
</configuration>
198+
</plugin>
199+
200+
201+
</plugins>
202+
</build>
203+
204+
205+
<dependencies>
206+
<dependency>
207+
<groupId>org.aksw.sparqlify</groupId>
208+
<artifactId>sparqlify-web-admin-server</artifactId>
209+
<type>war</type>
210+
</dependency>
211+
</dependencies>
212+
</project>
213+

0 commit comments

Comments
 (0)