-
Notifications
You must be signed in to change notification settings - Fork 16
[DEPRECATED] 5. Deploying your KnetMiner server and client
First, the project has to be compiled into a package. In the root folder of your new project (in our example, “human”) there should be two folders you have now customised: “datasource” and “client”. Both can be built in one combined action, along with all their parent dependencies, by typing:
mvn install
The final output should contain “BUILD SUCCESS”.
Find the newly created “.war”-file in client/target/ and upload that in the “Select WAR file to upload” field under your_server/manager, i.e., localhost:8080/manager. In the Applications table on that page you will see a new Path, something like “KnetMinerHuman” based on what you entered in the pom.xml, which is your new web page.
You can also copy the “.war” file to the folder where tomcat stores all webapps - for example, /var/lib/tomcat/webapps - and tomcat should automatically unpack it and replace all older versions.
You can also deploy the client using Eclipse as described here by talking to Tomcat's manager (setup described above): https://github.com/KeywanHP/KnetMiner/wiki/KnetMiner-Development-Installation-Guide#how-to-use-automatically-deploy-a-war-file-to-a-remote-tomcat-server
You can also use any automatic deployment software such as Hudson, but that's not the focus of this guide.
Here are some tips to improving the speed and SSL score of the tomcat instance. The actual web server setup differs from place to place - some places prefer to run tomcat behind apache, some run tomcat directly, so the following tips may not be useful for everyone.
- Enable gzip compression. The majority of browsers nowadays support gzipped compressed content. In my experience this reduces the data the user's browser has to download from 3-4Mb to 0.5Mb. Here's how to do that in tomcat:
You need this block in your Connector:
compression="on"
compressableMimeType="text/html,text/xml,text/plain,application/json"
compressionMinSize="2048"
You also need to tell tomcat that the .tab files with the results count as "text/plain" files (in /etc/tomcat/web.xml, sometimes openweb.xml), somewhere around all the other mime-mappings:
<mime-mapping>
<extension>tab</extension>
<mime-type>text/plain</mime-type>
</mime-mapping>
- When the user visits the web page and enters a search term, a piece of JavaScript downloads the search results via a GET request in the background. Some modern browsers block this request if a) the URL of the data in
data_url
differs from the URL of the web page (even a different port causes a block - i.e., the user visits "http://knetminer.org/", but thedata_url
is at "http://knetminer.org:8080/data", the:8080
can cause problems) or b) the request is via HTTP, not via HTTPS. For that you have to set up HTTPS, there are many manuals out there on how to do that for apache, but not many for tomcat. Here's the tomcat SSL setup the Boleracea/Cicer instance has right now from inside the Connector block (from/etc/tomcat/server.xml
):
keystoreFile="/somewhere/MyDSKeyStore.jks" keystorePass="some_password"
maxhttpheadersize="8192" enablelookups="false" disableuploadtimeout="true" acceptCount="100" scheme="https" secure="true" clientAuth="false" SSLEnabled="true" sslEnabledProtocols="TLSv1,TLSv1.1,TLSv1.2"
keyAlias="tomcat" keyPass="some_password"
ciphers="TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA,TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA,
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA,
TLS_RSA_WITH_AES_128_CBC_SHA256,TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA256,
TLS_RSA_WITH_AES_256_CBC_SHA"
At the time of this writing (11th July 2016) this receives an A- at SSLLabs. The protocols and ciphers available on your system differ on different Java setups and installations, so not all of those may work on your end. Your SSL certificate provider should have a manual on how to create the keystoreFile using Java's keytool. The keyAlias variable may differ for you too depending on how you ran keytool.
After running mvn install
as above you will have built the new datasource but not a server for it.
-
Go to the
common
folder at the same level as the species folder and inws-example
edit thepom.xml
file. Add the new species as a dependency in thatpom.xml
file (replacing any that are already there) by editing the species names. Then from within thews-example
folder runmvn install
once more to compile the server for deployment.Once run, copy the generated WAR file from
ws-example/target
and deploy it into Tomcat as per the client above. This will deploy the server, containing your species' datasource, and make it ready for use by the client. -
Alternatively, use the individual species-specific code for server/ web services, e.g, run
mvn install
in thews
folder underwheat
to get server .war built for Wheat.
You should now be able to enter queries into the web-page, the server should create temporary files in your DataPath folder and results should be displayed.