Deployment runthrough » History » Version 4

Chris Cannam, 2014-02-24 10:58 AM

1 1 Chris Cannam
h1. Deployment runthrough
2 1 Chris Cannam
3 1 Chris Cannam
This is an example deployment, on a 64-bit Linux host. There are various different ways to do this and the details will vary from one platform to another.
4 1 Chris Cannam
5 1 Chris Cannam
h2. 1. Obtain the current code from Mercurial repository
6 1 Chris Cannam
7 1 Chris Cannam
<pre>
8 1 Chris Cannam
$ hg clone https://code.soundsoftware.ac.uk/hg/human-echolocation-java-webapp
9 1 Chris Cannam
http authorization required for https://code.soundsoftware.ac.uk/hg/human-echolocation-java-webapp
10 1 Chris Cannam
realm: Mercurial repository for Human Echolocation WebApp
11 1 Chris Cannam
user: chrisca
12 1 Chris Cannam
password: 
13 1 Chris Cannam
destination directory: human-echolocation-java-webapp
14 1 Chris Cannam
requesting all changes
15 1 Chris Cannam
adding changesets
16 1 Chris Cannam
adding manifests
17 1 Chris Cannam
adding file changes
18 1 Chris Cannam
added 41 changesets with 93 changes to 40 files
19 1 Chris Cannam
updating to branch default
20 1 Chris Cannam
23 files updated, 0 files merged, 0 files removed, 0 files unresolved
21 1 Chris Cannam
$
22 1 Chris Cannam
</pre>
23 1 Chris Cannam
24 1 Chris Cannam
h2. 2. Install the MATLAB Compiler Runtime
25 1 Chris Cannam
26 1 Chris Cannam
Navigate to http://www.mathworks.co.uk/products/compiler/mcr/ and find the download URL, then use as follows.
27 1 Chris Cannam
28 1 Chris Cannam
<pre>
29 1 Chris Cannam
$ mkdir mcr
30 1 Chris Cannam
$ cd mcr
31 1 Chris Cannam
$ wget 'http://www.mathworks.co.uk/supportfiles/downloads/R2013b/deployment_files/R2013b/installers/glnxa64/MCR_R2013b_glnxa64_installer.zip'
32 1 Chris Cannam
--2014-02-24 10:00:10--  http://www.mathworks.co.uk/supportfiles/downloads/R2013b/deployment_files/R2013b/installers/glnxa64/MCR_R2013b_glnxa64_installer.zip
33 1 Chris Cannam
Resolving www.mathworks.co.uk (www.mathworks.co.uk)... 23.214.117.160
34 1 Chris Cannam
Connecting to www.mathworks.co.uk (www.mathworks.co.uk)|23.214.117.160|:80... connected.
35 1 Chris Cannam
HTTP request sent, awaiting response... 200 OK
36 1 Chris Cannam
Length: 488473010 (466M) [application/zip]
37 1 Chris Cannam
Saving to: ‘MCR_R2013b_glnxa64_installer.zip’
38 1 Chris Cannam
39 1 Chris Cannam
100%[======================================>] 488,473,010 7.81MB/s   in 60s    
40 1 Chris Cannam
41 1 Chris Cannam
2014-02-24 10:01:11 (7.71 MB/s) - ‘MCR_R2013b_glnxa64_installer.zip’ saved [488473010/488473010]
42 1 Chris Cannam
$ unzip MCR_R2013b_glnxa64_installer.zip 
43 1 Chris Cannam
Archive:  MCR_R2013b_glnxa64_installer.zip
44 1 Chris Cannam
  inflating: archives/mpc_resources_common_1348598029.enc  
45 1 Chris Cannam
  inflating: archives/cgir_mi_core_glnxa64_1375749553.xml  
46 1 Chris Cannam
[etc]
47 1 Chris Cannam
$ ./install
48 1 Chris Cannam
</pre>
49 1 Chris Cannam
50 1 Chris Cannam
The installer window then pops up (X server connection required for graphical interaction here).
51 1 Chris Cannam
52 1 Chris Cannam
The default installation folder is @/usr/local/MATLAB/MATLAB_Compiler_Runtime@. I'm going to accept that.
53 2 Chris Cannam
54 2 Chris Cannam
The installer runs, and then prints out the following:
55 2 Chris Cannam
56 2 Chris Cannam
<pre>
57 2 Chris Cannam
On the target computer, append the following to your LD_LIBRARY_PATH environment variable:
58 2 Chris Cannam
59 2 Chris Cannam
/usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/runtime/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/bin/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/sys/os/glnxa64:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/sys/java/jre/glnxa64/jre/lib/amd64/native_threads:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/sys/java/jre/glnxa64/jre/lib/amd64/server:/usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/sys/java/jre/glnxa64/jre/lib/amd64
60 2 Chris Cannam
61 2 Chris Cannam
Next, set the XAPPLRESDIR environment variable to the following value:
62 2 Chris Cannam
63 2 Chris Cannam
/usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/X11/app-defaults  
64 2 Chris Cannam
</pre>
65 3 Chris Cannam
66 3 Chris Cannam
h2. 3. Bring dependent JAR files into the webapp folder
67 3 Chris Cannam
68 3 Chris Cannam
Make sure we're back in the webapp folder (the one we cloned from Mercurial earlier)
69 3 Chris Cannam
70 3 Chris Cannam
<pre>
71 3 Chris Cannam
$ cd ../human-echolocation-java-webapp
72 3 Chris Cannam
</pre>
73 3 Chris Cannam
74 3 Chris Cannam
Copy in the Servlet API library from our application server (in this case Tomcat):
75 3 Chris Cannam
76 3 Chris Cannam
<pre>
77 3 Chris Cannam
$ cp /usr/share/java/tomcat7/servlet-api.jar .
78 3 Chris Cannam
</pre>
79 3 Chris Cannam
80 3 Chris Cannam
And the MATLAB MCR JavaBuilder library:
81 3 Chris Cannam
82 3 Chris Cannam
<pre>
83 3 Chris Cannam
$ cp /usr/local/MATLAB/MATLAB_Compiler_Runtime/v82/toolbox/javabuilder/jar/javabuilder.jar ./WebContent/WEB-INF/lib/
84 3 Chris Cannam
</pre>
85 4 Chris Cannam
86 4 Chris Cannam
h2. 4. Build the WAR file bundle
87 4 Chris Cannam
88 4 Chris Cannam
Simple enough:
89 4 Chris Cannam
90 4 Chris Cannam
<pre>
91 4 Chris Cannam
$ ant
92 4 Chris Cannam
Buildfile: /work/human-echolocation-java-webapp/build.xml
93 4 Chris Cannam
94 4 Chris Cannam
build:
95 4 Chris Cannam
    [javac] Compiling 2 source files to /work/human-echolocation-java-webapp/WebContent/WEB-INF/classes
96 4 Chris Cannam
97 4 Chris Cannam
build-war:
98 4 Chris Cannam
      [war] Building war: /work/human-echolocation-java-webapp/echoapp.war
99 4 Chris Cannam
100 4 Chris Cannam
BUILD SUCCESSFUL
101 4 Chris Cannam
Total time: 1 second
102 4 Chris Cannam
$
103 4 Chris Cannam
</pre>