Wiki source code of Deploying on Ubuntu 22.04
Version 4.1 by D Tim Cummings on 2023/09/28 05:15
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | == Set environment variables for your configuration to be used in following scripts == | ||
2 | |||
3 | For example | ||
4 | |||
5 | {{code}} | ||
6 | export SERVER_NAME=woserver.example.com | ||
7 | export SERVER_IP=172.5.4.3 | ||
8 | export WEBOBJECTS_GROUP=webobjects | ||
9 | export WEBOBJECTS_USER=webobjects | ||
10 | export NEXT_ROOT=/opt/webobjects | ||
11 | export URL_PART=apps | ||
12 | {{/code}} | ||
13 | |||
14 | The default URL_PART is "cgi-bin". I prefer to use "apps" in my WebObjects URLs. | ||
15 | |||
16 | == Install Java 17 == | ||
17 | |||
18 | {{code}} | ||
19 | sudo apt install openjdk-17-jdk-headless | ||
20 | {{/code}} | ||
21 | |||
22 | At time of writing this was build 17.0.8.1+1-Ubuntu-0ubuntu122.04. | ||
23 | |||
24 | == Add user and group == | ||
25 | |||
26 | {{code}} | ||
27 | sudo groupadd $WEBOBJECTS_GROUP | ||
28 | sudo useradd -m -g $WEBOBJECTS_GROUP -s /bin/bash $WEBOBJECTS_USER | ||
29 | echo -e "export NEXT_ROOT=$NEXT_ROOT" | sudo tee /home/$WEBOBJECTS_USER/.bash_profile | ||
30 | {{/code}} | ||
31 | |||
32 | (% class="auto-cursor-target" %) | ||
33 | == Create directories == | ||
34 | |||
35 | {{code}} | ||
36 | sudo mkdir -p /var/log/webobjects | ||
37 | sudo mkdir -p /etc/WebObjects/wotaskd | ||
38 | sudo mkdir -p /etc/WebObjects/JavaMonitor | ||
39 | {{/code}} | ||
40 | |||
41 | == Create configuration files == | ||
42 | |||
43 | {{code}} | ||
44 | echo -e "\ | ||
45 | WEBOBJECTS_GROUP=$WEBOBJECTS_GROUP\n\ | ||
46 | WEBOBJECTS_USER=$WEBOBJECTS_USER\n\ | ||
47 | NEXT_ROOT=$NEXT_ROOT\n\ | ||
48 | JAVA_MONITOR_ARGS=\"-WOPort 56789\"\n\ | ||
49 | WEBOBJECTS_URL=\n\ | ||
50 | " | sudo tee /etc/default/webobjects | ||
51 | |||
52 | echo -e "\ | ||
53 | er.extensions.WOHostUtilities.localhostips=($SERVER_IP)\n\ | ||
54 | WOHost=$SERVER_IP\n\ | ||
55 | " | sudo tee /etc/WebObjects/Properties | ||
56 | |||
57 | echo -e "WOHost=$SERVER_IP" | sudo tee /etc/WebObjects/wotaskd | ||
58 | echo -e "WOHost=$SERVER_IP" | sudo tee /etc/WebObjects/JavaMonitor | ||
59 | {{/code}} | ||
60 | |||
61 | (% class="auto-cursor-target" %) | ||
62 | == Set permissions == | ||
63 | |||
64 | {{code}} | ||
65 | sudo chown -R $WEBOBJECTS_USER:$WEBOBJECTS_GROUP /var/log/webobjects | ||
66 | sudo chown -R $WEBOBJECTS_USER:$WEBOBJECTS_GROUP /etc/WebObjects | ||
67 | {{/code}} | ||
68 | |||
69 | (% class="auto-cursor-target" %) | ||
70 | == Install wotaskd and javamonitor == | ||
71 | |||
72 | {{code}} | ||
73 | sudo mkdir -p $NEXT_ROOT/Local/Library/WebObjects/JavaApplications | ||
74 | cd $NEXT_ROOT/Local/Library/WebObjects/JavaApplications | ||
75 | |||
76 | sudo wget https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/artifact/Root/Roots/wotaskd.tar.gz | ||
77 | sudo tar zpxf wotaskd.tar.gz | ||
78 | sudo rm wotaskd.tar.gz | ||
79 | |||
80 | sudo wget https://jenkins.wocommunity.org/job/Wonder7/lastSuccessfulBuild/artifact/Root/Roots/JavaMonitor.tar.gz | ||
81 | sudo tar zpxf JavaMonitor.tar.gz | ||
82 | sudo rm JavaMonitor.tar.gz | ||
83 | |||
84 | sudo chown -R $WEBOBJECTS_USER:$WEBOBJECTS_GROUP $NEXT_ROOT/Local | ||
85 | sudo mkdir -p $NEXT_ROOT/bin | ||
86 | cd $NEXT_ROOT/bin | ||
87 | sudo ln -s $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd | ||
88 | sudo ln -s $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor javamonitor | ||
89 | |||
90 | # Fix wotaskd and javamonitor to work with Java 17 if not already | ||
91 | sudo sed -i '2s/= $/= --add-exports=java.base/sun.security.action=ALL-UNNAMED/' $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/Contents/UNIX/UNIXClassPath.txt | ||
92 | sudo sed -i '2s/= $/= --add-exports=java.base/sun.security.action=ALL-UNNAMED/' $NEXT_ROOT/Local/Library/WebObjects/JavaApplications/javamonitor.woa/Contents/UNIX/UNIXClassPath.txt | ||
93 | {{/code}} | ||
94 | |||
95 | (% class="auto-cursor-target" %) | ||
96 | == Create services for wotaskd and javamonitor == | ||
97 | |||
98 | {{code}} | ||
99 | echo -e "\ | ||
100 | [Unit]\n\ | ||
101 | Description=WebObjects/Wonder wotaskd\n\ | ||
102 | Documentation=https://wiki.wocommunity.org/display/documentation/Wonder+JavaMonitor+and+wotaskd\n\ | ||
103 | AssertPathExists=/var/log/webobjects\n\ | ||
104 | AssertPathExists=$NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa\n\ | ||
105 | After=network.target\n\ | ||
106 | [Service]\n\ | ||
107 | User=$WEBOBJECTS_USER\n\ | ||
108 | Group=$WEBOBJECTS_GROUP\n\ | ||
109 | Environment=NEXT_ROOT=$NEXT_ROOT\n\ | ||
110 | Environment="JVM_OPTIONS=-Xms32m -Xmx64m -XX:NewSize=2m"\n\ | ||
111 | ExecStart=$NEXT_ROOT/Local/Library/WebObjects/JavaApplications/wotaskd.woa/wotaskd -WOPort 1085 -Xms32m -Xmx64m >> /var/log/webobjects/wotaskd.log 2>&1\n\ | ||
112 | Restart=on-failure\n\ | ||
113 | RestartSec=5\n\ | ||
114 | [Install]\n\ | ||
115 | WantedBy=multi-user.target\n\ | ||
116 | " | sudo tee /lib/systemd/system/wotaskd.service | ||
117 | |||
118 | echo -e "\ | ||
119 | [Unit]\n\ | ||
120 | Description=WebObjects/Wonder JavaMonitor\n\ | ||
121 | Documentation=https://wiki.wocommunity.org/display/documentation/Wonder+JavaMonitor+and+wotaskd\n\ | ||
122 | AssertPathExists=/var/log/webobjects\n\ | ||
123 | AssertPathExists=$NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa\n\ | ||
124 | After=wotaskd.service\n\ | ||
125 | [Service]\n\ | ||
126 | User=$WEBOBJECTS_USER\n\ | ||
127 | Group=$WEBOBJECTS_GROUP\n\ | ||
128 | Environment=NEXT_ROOT=$NEXT_ROOT\n\ | ||
129 | Environment="JVM_OPTIONS=-Xms32m -Xmx64m -XX:NewSize=2m"\n\ | ||
130 | ExecStart=$NEXT_ROOT/Local/Library/WebObjects/JavaApplications/JavaMonitor.woa/JavaMonitor -WOPort 56789 -Xms32m -Xmx64m >> /var/log/webobjects/javamonitor.log 2>&1\n\ | ||
131 | Restart=on-failure\n\ | ||
132 | RestartSec=5\n\ | ||
133 | [Install]\n\ | ||
134 | WantedBy=multi-user.target\n\ | ||
135 | " | sudo tee /lib/systemd/system/javamonitor.service | ||
136 | |||
137 | sudo systemctl daemon-reload | ||
138 | |||
139 | sudo systemctl enable wotaskd | ||
140 | sudo systemctl start wotaskd | ||
141 | sudo systemctl status wotaskd | ||
142 | |||
143 | sudo systemctl start javamonitor | ||
144 | sudo systemctl status javamonitor | ||
145 | {{/code}} | ||
146 | |||
147 | (% class="auto-cursor-target" %) | ||
148 | == Install Apache HTTP Server (MPM prefork) == | ||
149 | |||
150 | {{code}} | ||
151 | sudo apt install apache2 make apache2-dev | ||
152 | sudo a2dismod mpm_event | ||
153 | sudo a2enmod mpm_prefork | ||
154 | sudo a2enmod expires | ||
155 | sudo a2enmod ssl | ||
156 | sudo a2enmod rewrite | ||
157 | |||
158 | # Add ServerName to conf to avoid configtest errors | ||
159 | echo "ServerName $SERVER_NAME" | sudo tee /etc/apache2/conf-available/server-name.conf | ||
160 | sudo a2enconf server-name | ||
161 | |||
162 | # Install WebObjects adaptor | ||
163 | git clone https://github.com/wocommunity/wonder.git | ||
164 | cd wonder/Utilities/Adaptors | ||
165 | sed -i '107s/CGI Apache2.2/Apache2.4/' make.config | ||
166 | sed -i '9s/MACOS/LINUX/' make.config | ||
167 | make | ||
168 | cd Apache2.4 | ||
169 | sudo apxs -i -a -n WebObjects mod_WebObjects.la | ||
170 | sudo cp apache.conf /etc/apache2/mods-available/WebObjects.conf | ||
171 | sudo sed -i "7s/^LoadModule/# LoadModule/" /etc/apache2/mods-available/WebObjects.conf | ||
172 | sudo sed -i "15,18s/cgi-bin/$URL_PART/" /etc/apache2/mods-available/WebObjects.conf | ||
173 | sudo sed -i "38s/cgi-bin/$URL_PART/" /etc/apache2/mods-available/WebObjects.conf | ||
174 | sudo a2enmod WebObjects | ||
175 | |||
176 | # Create Apache virtual host | ||
177 | sudo mkdir -p /var/www/$SERVER_NAME | ||
178 | sudo ln -s $NEXT_ROOT/Local/Library/WebServer/Documents/WebObjects /var/www/$SERVER_NAME/WebObjects | ||
179 | |||
180 | echo -e "\ | ||
181 | <VirtualHost *:80>\n\ | ||
182 | ServerName $SERVER_NAME\n\ | ||
183 | DocumentRoot /var/www/$SERVER_NAME\n\ | ||
184 | <Directory />\n\ | ||
185 | Require all denied\n\ | ||
186 | </Directory>\n\ | ||
187 | <Directory /var/www/$SERVER_NAME/>\n\ | ||
188 | Options Indexes FollowSymLinks MultiViews\n\ | ||
189 | AllowOverride None\n\ | ||
190 | Require all granted\n\ | ||
191 | </Directory>\n\ | ||
192 | <IfModule mod_expires.c>\n\ | ||
193 | ExpiresActive On\n\ | ||
194 | ExpiresByType text/html "access 5 minutes"\n\ | ||
195 | </IfModule>\n\ | ||
196 | ErrorLog ${APACHE_LOG_DIR}/error_apps_$SERVER_NAME.log\n\ | ||
197 | CustomLog ${APACHE_LOG_DIR}/access_apps_$SERVER_NAME.log combined\n\ | ||
198 | </VirtualHost>\n\ | ||
199 | " | sudo tee /etc/apache2/sites-available/$SERVER_NAME.conf | ||
200 | |||
201 | sudo a2ensite $SERVER_NAME.conf | ||
202 | |||
203 | sudo apachectl configtest | ||
204 | sudo systemctl restart apache2 | ||
205 | {{/code}} | ||
206 | |||
207 | (% class="auto-cursor-target" %) | ||
208 | == Troubleshooting == | ||
209 | |||
210 | {{code}} | ||
211 | # To test WOAdaptorInfo edit /etc/apache2/mods-available/WebObjects.conf and uncomment | ||
212 | WebObjectsAdminUsername public | ||
213 | |||
214 | #restart apache2 | ||
215 | sudo systemctl restart apache2 | ||
216 | |||
217 | #check in browser | ||
218 | http://woserver.example.com/apps/WebObjects/WOAdaptorInfo | ||
219 | |||
220 | #to turn on woadaptor logging | ||
221 | touch /tmp/logWebObjects | ||
222 | |||
223 | #might need to mkdir for adaptor logging | ||
224 | mkdir /Library | ||
225 | chown $WEBOBJECTS_USER:$WEBOBJECTS_GROUP /Library | ||
226 | {{/code}} | ||
227 | |||
228 | (% class="auto-cursor-target" %) | ||
229 | \\ |