-
Notifications
You must be signed in to change notification settings - Fork 0
/
queryNotes.txt
139 lines (104 loc) · 6.9 KB
/
queryNotes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# Built using example from http://crunchify.com/how-to-build-restful-service-with-java-using-jax-rs-and-jersey/
# Installing tomcat from https://www.digitalocean.com/community/tutorials/how-to-install-apache-tomcat-7-on-centos-7-via-yum
# Setting up digest authentication https://techannotation.wordpress.com/2012/07/02/tomcat-digestauthentication/
# To build in Eclipse,
1) Check that the WebContent/WEB-INFO/web.xml is pointing to the deployment or testing param set you want
2) Ditto src/main.resources/log4j2.properties
2) Right click pom.xml, Run As, Maven Build, "clean, install"
# Launch server in Eclipse with the Server View
Need to start tomcat twice after cleaning, first time errors out, second attempt works, check console for errors, did you correctly modify the log4j and web.xml docs?
# Testing the GQuery in eclipse:
1) Set the WEB-INFO/web.xml <param-name>authorizationEnabled</param-name> to false to disable authentication
2) Edit edu.utah.hci.query.test.SearchRequestTests setting the url String to match your running instance
3) Right click SearchRequestTests, Run As -> JUnit Test
# Testing authorization in eclipse:
1) Check the WebContent/WEB-INFO/userGroup.txt is set correctly for testing
2) Set authorizationEnabled to true in the web.xml.
3) Configure the tomcat server to use MemoryRealm, see https://techannotation.wordpress.com/2012/07/02/tomcat-digestauthentication/
4) Restart Tomcat, check the log4j logs.
5) Right click edu.utah.hci.query.test.AuthenticationRequestTests, Run As -> JUnit test
# Building an appropriate chrNameLenBed bed file
1) For all the species you are going to be serving, trim off any 'chr' txt and take the maximum length, for example, an entry for chromosome 19 to cover B38(19:0-58617616), hg19(chr19:0-59128983), MM10 (19:0-61431566) would be 19:0-61431566
If present, chr is trimmed off all chromosome names, this a search for chr1:123-124 is converted to 1:123-124, likewise for the chrom index used to instantiate the lookup index, this is done to enable both B37 and hg19 nomenclature
# Making digested passwords:
User names must be unique!
/Applications/Tomcat/apache-tomcat-7.0.99/bin/digest.sh -a md5 Admin:GQuery:goRunAddie
Admin:GQuery:goRunAddie:0d63b298576d229208d15c48cf9aa488
/Applications/Tomcat/apache-tomcat-7.0.99/bin/digest.sh -a md5 Obama:GQuery:thankYou
Obama:GQuery:thankYou:15e22d1122b938d84b2920e246a2e095
/Applications/Tomcat/apache-tomcat-7.0.99/bin/digest.sh -a md5 QueryAll:GQuery: see https://ri-confluence.hci.utah.edu/x/WIBLAw for pw
# Modify the apache-tomcat-7.xxx/conf/tomcat-users.xml file
<tomcat-users>
<role rolename="queryUser"/>
<user username="Admin" password="0d63b298576d229208d15c48cf9aa488" roles="queryUser"/>
<user username="Obama" password="15e22d1122b938d84b2920e246a2e095" roles="queryUser"/>
</tomcat-users>
# Pulling the header from a digest authentication request:
curl --user Dave:goSkiDave --digest http://localhost:8080/Query/fetchKey -D header.txt
curl --user Obama:thankYou --digest http://localhost:8080/GQuery/fetchKey -D header.txt
################## Misc Eclipse troubleshooting tips ###################
# If the server fails to start up in eclipse and throw missing class errors say for log4j fix it with:
##I'm working with Eclipse and I had same problem every time I made changes to my pom.xml. I don't know why but Eclipse delete the Maven Dependencies.
##Solution: right click on project, select Properties, choose Deployment Assembly and verify in column "Source" a row called "Maven Dependencies".
##If it isn't there, click on Add..., Java Build Path Entries and click on Maven Dependencies. Finally Apply and close.
# More server problems Try 1) Project->Clean 2) RightClick GQuery Project->Maven->Update Project... 3) RightClick pom.xml->RunAs->Maven build-> clean and install
# Can't see git views or perspectives? Reset them. Window->Perspective->Close All Perspectives
# Problems with log4j? Add -Dlog4j.debug to the Tomcat args launch configuration in eclipse, double click the server in the Server view.
# Starting and stopping tomcat scripts on laptop
/Applications/Tomcat/apache-tomcat-7.0.99/bin/startup.sh
/Applications/Tomcat/apache-tomcat-7.0.99/bin/shutdown.sh
################## Example deployment of a new WAR ################
# On laptop
scp ~/Code/GQuery/target/GQuery_0.1.war u0028003@hci-clingen1:~/
# On hci-clingen1
mkdir /Data01/Repository/GQuery/Wars/NewGQuery
cd /Data01/Repository/GQuery/Wars/NewGQuery
mv /home/u0028003/GQuery_*.war .
unzip GQuery.war
# Modify WEB-INF/web.xml
path2DataDir /Data01/Repository/GQuery/WorkingGQuery/Data
tempDir /Repository/AnalysisData/NixTransfers/QueryAPI/Temp
userGroup /usr/share/apache-tomcat-7.0.79/webapps/GQuery/WEB-INF/userGroup.txt
# Modify the WEB-INF/userGroup.txt
comment and uncomment the appropriate lines for testing or deploying
# Modify WEB-INF/classes/log4j2.properties, currently just writing to stdout, change all of the levels to warn or info
appender.rolling.fileName /usr/share/apache-tomcat-7.0.79/logs/gquery.log4j.txt
# update the war and clean up the
zip -ru GQuery.war WEB-INF
# cleanup
rm -rf license.html queryPostExample.html META-INF WEB-INF
# Starting up a new WAR, do as root, tomcat should auto detect the new xxx.war file and attempt a deployment
chmod 755 GQuery.war
echo Reset > /usr/share/apache-tomcat-7.0.79/logs/catalina.out
echo Reset > /usr/share/apache-tomcat-7.0.79/logs/gquery.log4j.txt
rm -rf /usr/share/apache-tomcat-7.0.79/webapps/GQuery*
sleep 5s
cp GQuery.war /usr/share/apache-tomcat-7.0.79/webapps/
chown tomcat /usr/share/apache-tomcat-7.0.79/webapps/GQuery.war
sleep 5s
tail /usr/share/apache-tomcat-7.0.79/logs/catalina.out
echo xxxxxxxGQueryxxxxxxx
tail -F /usr/share/apache-tomcat-7.0.79/logs/gquery.log4j.txt
# If the war doesn't auto deploy, as root:
/usr/share/apache-tomcat-7.0.79/bin/shutdown.sh
sleep 5s
/usr/share/apache-tomcat-7.0.79/bin/startup.sh
################## Checking new WAR ################
# FetchOptions as a guest, this should pull the generic json file
http://hci-clingen1.hci.utah.edu:8080/GQuery/search?fetchOptions=true
http://localhost:8080/GQuery/search?fetchOptions=true for testing in eclipse
# Fetch a key, see https://ri-confluence.hci.utah.edu/x/WIBLAw for the user name and pw
http://hci-clingen1.hci.utah.edu:8080/GQuery/fetchKey # then encode it, see https://www.urlencoder.org/
# Pull the options as a user, should now include the "searchableFiles" list
http://hci-clingen1.hci.utah.edu:8080/GQuery/search?
fetchOptions=true&
key=A1W82DU%2BdiEZbZoQcsDKJA%3D%3D%3AozFK%2FittEgwz7wsjCb%2BnTTi9oDBTLeir%2Fqaczdy7UpY%3D
# Perform a real search
http://hci-clingen1.hci.utah.edu:8080/GQuery/search?
bed=chr17:43,091,393-43,094,877&
regExDirPath=/Germline/Avatar/&
regExFileName=vcf.gz&
regExDataLine=CLNSIG%3DPathogenic&
fetchData=true&
key=A1W82DU%2BdiEZbZoQcsDKJA%3D%3D%3AozFK%2FittEgwz7wsjCb%2BnTTi9oDBTLeir%2Fqaczdy7UpY%3D
# Note first few queries on a new instance are slow but subsequent are faster.