Wiki source code of Deploying on Linux

Version 288.1 by Ray Kiddy on 2021/05/01 00:48

Show last authors
1 (% class="auto-cursor-target" %)
2 \\
3
4 {{warning}}
5 If you are using RedHat Enterprise Linux, CentOS or Amazon Linux, stop right there! We now have RPM packages for CentOS and RedHat 5.x/6.x, and Amazon Linux. [[Read the following instructions>>doc:Installing a deployment environment on RedHat, CentOS or Amazon Linux]] instead of this document.
6
7 Guess what? If you are using Debian or Ubuntu, [[packages>>doc:Installing a deployment environment on Debian or Ubuntu]] are also available for your platform (although not yet for Xenial)!
8 {{/warning}}
9
10 Install Sun Java JDK
11
12 ~1. You should install a [[Sun/Oracle Java SDK>>url:http://www.oracle.com/technetwork/java/javase/downloads/index.html||shape="rect"]]. Use Oracle's [[installation instructions>>url:http://www.oracle.com/technetwork/java/javase/index-137561.html#linux||shape="rect"]]. Choose the appropriate 32-bit or 64-bit Linux installer, for example jdk-6u27-linux-x64-rpm.bin, and install it.
13
14 {{warning}}
15 Make sure to install the correct "bit" version for the OS, e.g. install 64 bit JVM on a 64 bit installation, and a 32 bit JVM on a 32 bit installation! To find that information, do:
16
17 {{code}}
18 uname -p
19 {{/code}}
20
21 If the response is //x86_64//, it's a 64 bit system. If the response is //i386// or //i686//, it's a 32 bit system.
22 {{/warning}}
23
24 Creating symbolic links as follows is useful (alternatively use the 'alternatives' command to manage JVMs):
25
26 {{code}}
27 ln -s /usr/java/jdk1.6.0_27 /usr/java/jdk1.6
28 ln -s /usr/java/jdk1.6/bin/java /usr/bin/java
29 {{/code}}
30
31 and you need to change your path in your bash profile (_~~/.bash_profile) to have this path :
32
33 {{code}}
34 PATH=$PATH:/usr/java/jdk1.6/bin:$HOME/bin
35 {{/code}}
36
37 Optional: Install the WebObjects frameworks
38
39 {{info}}
40 If you embed the frameworks into your applications, you don't need to install the core frameworks on the deployment system. Install them only if your applications don't have the frameworks inside their bundles.
41 {{/info}}
42
43 2. Get the WebObjects installer from the wocommunity's Web site :
44
45 {{code}}
46 curl -C - -O https://jenkins.wocommunity.org/job/WOInstaller/lastSuccessfulBuild/artifact/Utilities/WOInstall/WOInstaller.jar
47
48 OR
49
50 wget https://jenkins.wocommunity.org/job/WOInstaller/lastSuccessfulBuild/artifact/Utilities/WOInstall/WOInstaller.jar
51 {{/code}}
52
53 and install it like this :
54
55
56 [[https:~~/~~/download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/Mac_OS_X/downloads/061-4634.20080915.3ijd0/WebObjects543.dmg>>url:https://download.info.apple.com/Apple_Support_Area/Apple_Software_Updates/Mac_OS_X/downloads/061-4634.20080915.3ijd0/WebObjects543.dmg||shape="rect"]]\\
57
58 {{{ wget sudo java -jar WOInstaller.jar dev54 /opt}}}
59
60 You may see an error as the command above finishes, but WO may still be installed.
61
62 This command below is what you could do if you did not need the dmg above. Unfortunately there is a bug having to do with downloading via HTTPS and you do not get the WebObjects543.dmg automatically and you need the command above.
63
64 \\
65
66
67 \\///opt
68 \\//
69
70 {{{ sudo /usr/java/latest/bin/java -jar WOInstaller.jar 5.4.3 /optWebObjects frameworks are now installed in }}}
71
72 {{code}}
73 [root@ ~]# ls -l /opt
74 total 12
75 drwxr-xr-x 3 root root 4096 Nov 9 08:19 Developer
76 drwxr-xr-x 4 root root 4096 Nov 9 08:19 Library
77 drwxr-xr-x 3 root root 4096 Nov 9 08:20 Local
78 {{/code}}
79
80 Creating the //appserver// user and starting wotaskd/JavaMonitor
81
82 To follow the conventions from Mac OS X, we will create two users to run wotaskd and Monitor under this user :
83
84 {{code}}
85 sudo groupadd appserveradm
86 sudo useradd -g appserveradm appserver
87 {{/code}}
88
89 Edit the bash profile of the appserver
90
91 {{code}}
92 # sudo su - appserver
93 % vi .bash_profile
94 {{/code}}
95
96 and add this line :
97
98 {{code}}
99 export NEXT_ROOT=/opt
100 {{/code}}
101
102 and run it manually in your current shell :
103
104 {{code}}
105 [appserver@ ~]$ . .bash_profile
106 {{/code}}
107
108 3. Next, we need to install the Wonder version **wotaskd** and **JavaMonitor**.
109
110 {{code}}
111 $ mkdir -p /opt/Local/Library/WebObjects/JavaApplications
112 $ cd /opt/Local/Library/WebObjects/JavaApplications
113 $ wget https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/artifact/Root/Roots/wotaskd.tar.gz
114 $ tar zpxf wotaskd.tar.gz
115 $ rm wotaskd.tar.gz
116 $ wget https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/artifact/Root/Roots/JavaMonitor.tar.gz
117 $ tar zpxf JavaMonitor.tar.gz
118 $ rm JavaMonitor.tar.gz
119 {{/code}}
120
121 4. Now we need to change some permissions:
122
123 {{code}}
124 sudo chown -R appserver:appserveradm /opt/Local
125 sudo chown -R appserver:appserveradm /opt/Library
126 {{/code}}
127
128 5. Now we can start wotask and Monitor
129
130 {{code}}
131 [root@ ~]# sudo su - appserver
132 {{/code}}
133
134 You can start wotaskd and Monitor to make sure that they run without any problems :
135
136 {{code}}
137 [appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd &
138 [appserver@ ~]$ $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 &
139 {{/code}}
140
141 Apache
142
143 If your Linux installation don't already have Apache httpd running or installed, you need to install it:
144
145 For Ubuntu distributions :
146
147 {{code}}
148 sudo apt-get install apache2 apache2.2-common apache2-mpm-prefork apache2-utils apache2-threaded-dev ssl-cert
149 {{/code}}
150
151 On that system the relevant command names are //apache2ctl// and //apxs2//, and the document root is ///var/www// (not ///usr/local/apache/htdocs// as in the example below).
152
153 (you will need httpd-devel and gcc)
154
155 For CentOS, RedHat or Fedora distributions :
156
157 {{code}}
158 I found on AWS for apache 2.4 I had to change the yum to: yum install httpd24 httpd24-devel   yum install httpd mod_ssl httpd-devel chkconfig httpd on /etc/init.d/httpd start
159 {{/code}}
160
161 .. default install location is then /etc/httpd
162
163 HTTP Adaptor
164
165 First, check if a pre-built module already exists at [[wocommunity.org>>url:http://wocommunity.org/documents/tools/mod_WebObjects/||shape="rect"]]. If you are running CentOS 6.x, you can use the module for CentOS 5.5, it works fine.
166
167 Once you have downloaded the module, you can install it with:
168
169 {{code}}
170 sudo apxs -i -a -n WebObjects mod_WebObjects.so
171 {{/code}}
172
173 If you can't find a adaptor for your Linux platform, you [[will have to build it>>doc:Compiling the HTTP adaptor on Linux]]
174
175 Apache Configuration
176
177 Instead of copying the //WebObjects// directory, you can use a alias to point to the folder inside NEXT_ROOT. In your Apache configuration, add something like :
178
179 {{code}}
180 Alias /WebObjects "/opt/Local/Library/WebServer/Documents/WebObjects"
181 {{/code}}
182
183 and add a directive to allow fetching files in this directory:
184
185 {{code}}
186 <Directory "/opt/Local/Library/WebServer/Documents/WebObjects"> AllowOverride All Order allow,deny Allow from all </Directory>
187 {{/code}}
188
189 Or (depending on your Apache configuration) you could use a symbolic link.
190
191 You also need, as explained by the adaptor's README file, to add this directive in //httpd.conf// :
192
193 {{code}}
194 <LocationMatch /apps/WebObjects/.*> Order allow,deny Allow from all </LocationMatch>
195 {{/code}}
196
197 If you don't add it, you will get 403s (Forbidden) HTTP errors.
198
199 If you want to keep ///cgi-bin/WebObjects// as the base URL, you will need to remove a line in //httpd.conf//. Find the line that starts with //ScriptAlias /cgi-bin// and comment it out, or else Apache will try to find a //WebObjects// CGI in ///cgi-bin// instead of loading the adaptor from the Apache module.
200
201 And edit ///usr/local/apache/conf/extra/webobjects.conf// to comment the //LoadModule WebObjects_module// line. You can also change the //WebObjectsAlias// property, in my case I use ///apps/WebObjects//. Last step : add the following line in httpd.conf (near the end):
202
203 {{code}}
204 Include conf/extra/webobjects.conf
205 {{/code}}
206
207 Check for any errors with //apachectl configtest//, and if everything's ok, you are good to go. You can install your first app, don't forget that your app must be accessible by the //appserver// user or the //appserveradm// group. If your app don't start or if Monitor complains about a path, it might be a permission problem.
208
209 Jerome Chan told me that you can check if the Apache module is loaded by doing this :
210
211 {{code}}
212 /usr/local/apache/bin/apachectl -M
213 {{/code}}
214
215 On my installation on OpenSuse 11.1, I had to change the path to the lib64 directory where Apache contains the modules.
216
217 {{code}}
218 LoadModule WebObjects_module /usr/lib64/apache2/mod_WebObjects.so
219 {{/code}}
220
221 Auto Start WOTaskd and WOMonitor
222
223 One last thing, you need a init script to start wotaskd and Monitor at boot time.
224
225 Systems using upstart (Ubuntu and maybe others)
226
227 If you are running Ubuntu that have support for [[upstart>>url:http://upstart.ubuntu.com/||shape="rect"]], you can grab the two startup scripts for upstart on [[GitHub>>url:https://github.com/wocommunity/wonder/tree/master/Utilities/Linux/StartupScripts/Ubuntu||shape="rect"]]. Grab the two files (womonitor.conf and wotaskd.conf) and copy them in ///etc/init///. Once they are in this directory, run:
228
229 {{code}}
230 sudo service wotaskd start
231 sudo service womonitor start
232 {{/code}}
233
234 (% class="auto-cursor-target" %)
235 \\
236
237 {{info}}
238 Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights!
239
240 {{code}}
241 chown root /etc/init/wotaskd.conf
242 chown root /etc/init/womonitor.conf
243 chmod 755 /etc/init/wotaskd.conf
244 chmod 755 /etc/init/womonitor.conf
245 {{/code}}
246
247 (% class="auto-cursor-target" %)
248 \\
249 {{/info}}
250
251 Systems not using upstart (CentOS, RedHat, Fedora and others)
252
253 If you are running a system not capable of running upstart, like CentOS, RedHat or older versions of Ubuntu, you need to use the old-style init.d startup script. Again, the scripts are [[available>>url:https://github.com/wocommunity/wonder/tree/integration/Utilities/Linux/StartupScripts/RedHat||shape="rect"]] on GitHub. Grab the two files (//womonitor// and //wotaskd//) and copy them in ///etc/init.d///.
254
255 Once the scripts are in ///etc/init.d///, you can start them:
256
257 {{code}}
258 sudo service wotaskd start
259 sudo service womonitor start
260 {{/code}}
261
262 Last step: add the startup scripts under chkconfig control with:
263
264 {{code}}
265 sudo /sbin/chkconfig --add webobjects
266 sudo /sbin/chkconfig webobjects on
267 {{/code}}
268
269 If you are using Ubuntu or Debian without upstart support, you need to use //update-rc.d// instead of //chkconfig//:
270
271 {{code}}
272 sudo update-rc.d wotaskd defaults 90 20
273 sudo update-rc.d womonitor defaults 90 20
274 {{/code}}
275
276 (% class="auto-cursor-target" %)
277 \\
278
279 {{info}}
280 Don't forget to change the permissions on the startup file so that the owner is root and that everyone have execution rights!
281
282 {{code}}
283 chown root /etc/init.d/wotaskd
284 chown root /etc/init.d/womonitor
285 chmod 755 /etc/init.d/wotaskd
286 chmod 755 /etc/init.d/womonitor
287 {{/code}}
288
289 (% class="auto-cursor-target" %)
290 \\
291 {{/info}}
292
293 (% style="font-weight: bold;" %)
294
295
296 (% style="font-weight: bold;" %)Systems using systemd instead of upstart (like Ubuntu 16.04 LTS)
297
298 Here's a systemd unit to put into {{code language="none"}}/lib/systemd/system/wotaskd.service{{/code}}
299
300 {{code}}
301 # systemd unit for wotaskd to run on Ubuntu 16.04 LTS
302 # Maik Musall <maik@selbstdenker.ag>, Aug 2016 [Unit]
303 Description=WebObjects/Wonder wotaskd
304 Documentation=https://wiki.wocommunity.org/display/documentation/Wonder+JavaMonitor+and+wotaskd
305 AssertPathExists=/var/log/webobjects
306 AssertPathExists=/opt/Local/Library/WebObjects/JavaApplications/wotaskd.woa
307 [Service]
308 User=appserver
309 Group=appserveradm
310 Environment=NEXT_ROOT=/opt
311 Environment="JVM_OPTIONS=-Xms32m -Xmx64m -XX:NewSize=2m"
312 Environment=WOTASKD_LOG=/var/log/webobjects/wotaskd.log
313 ExecStart=/opt/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 -Xms32m -Xmx64m >> $WOTASKD_LOG 2>&1 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target
314 {{/code}}
315
316 Start it with {{code language="none"}}systemctl start wotaskd.service{{/code}}
317
318 Start it at runtime by doing {{code language="none"}}systemctl enable wotaskd.service{{/code}}
319
320 Problems with Application Responding to WOMonitor/WOTaskd
321
322 If your Linux server is a virtual machine or if it has multiple IP addresses, you may find that clicking 'Stop' in WOMonitor has no effect on instances, or that the applications never start (the level just go up and down non-stop). This can usually be solved for all Wonder-based applications running on hosts with such a problem by simply creating the following file (known as the 'Machine Properties' file in Wonder's ERXProperties):
323
324 {{code}}
325 /etc/WebObjects/Properties
326 {{/code}}
327
328 And inside that file, add an array property that defines all the IP addresses assigned to your host, for example:
329
330 {{code}}
331 er.extensions.WOHostUtilities.localhostips=(192.168.3.168,192.168.1.168)
332 {{/code}}
333
334 (% class="auto-cursor-target" %)
335 \\
336
337 {{info}}
338 To learn more, see the class named WOHostUtilities in ERExtensions framework
339 {{/info}}
340
341 SELinux
342
343 If SELinux is enabled on your system, wotaskd won't be reachable due to its preventing Apache from opening TCP connections. If you're comfortable with allowing Apache to connect to any TCP ports (including external hosts), you can run the following:
344
345 {{code}}
346 sudo setsebool -P httpd_can_network_connect=1
347 {{/code}}
348
349 Alternatively, [[Steven Klassen>>url:http://www.mrxinu.com/||shape="rect"]] has written a blog post ([[Custom SELinux Port Access>>url:http://www.mrxinu.com/2013/06/07/custom-selinux-port-access/||shape="rect"]]) that outlines how to create and install a wotaskd SELinux module that specifically allows connections to port 1085.
350
351 {{warning}}
352 Be aware that SELinux is enabled by default on CentOS 6.x, you will need to either call the //setsebool// command or to [[disable SELinux>>url:http://www.how2centos.com/disable-selinux-centos-6/||shape="rect"]]
353 {{/warning}}
354
355 Additional Resources
356
357 [[Jonathon Rentzsch WOPlat Project 'WOInstaller + Wonder Web Server Adaptor + OS Support Files'>>url:http://github.com/rentzsch/woplat||shape="rect"]]
358 [[http:~~/~~/vmadmin.nt.com.au/?p=47>>url:http://vmadmin.nt.com.au/?p=47||shape="rect"]]
359 [[http:~~/~~/www.watermarkstudios.com/blog/?p=48>>url:http://www.watermarkstudios.com/blog/?p=48||shape="rect"]]