Skip to content

Commit dc7c2b9

Browse files
Editing section about how to start MUSES with the WAR file
1 parent dbe9fd8 commit dc7c2b9

File tree

1 file changed

+83
-5
lines changed

1 file changed

+83
-5
lines changed

MUSESDevGuide.tex

Lines changed: 83 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,8 @@ \subsection{Preparing the database}
148148
\item[\texttt{SHOW DATABASES;}] should list the databases, and also MUSES database.
149149
\item[\texttt{USE muses;}]
150150
\item[\texttt{SHOW TABLES;}] should list the tables inside MUSES database.
151-
\item[\texttt{GRANT ALL ON muses.* TO 'muses'@'localhost';}] which gives permission to the MusesServer project to access the content in the MUSES database.
151+
\item[\texttt{CREATE USER 'muses'@'\%' IDENTIFIED BY 'muses11';}] creates a remote user for MUSES.
152+
\item[\texttt{GRANT ALL ON muses.* TO 'muses'@'\%';}] which gives permission to the MusesServer project to access the content in the MUSES database. Replace '\%' with localhost to make it only accessible from localhost.
152153
\end{description}
153154

154155
Finally, go to Eclipse again, right-click on the MusesServer project, and then go to \textit{Run As > Maven clean}, as it was shown in Figure \ref{fig:RunAs}. In the console, you will see a ``BUILD SUCESS'', and then, repeat going to \textit{Run As > Maven install}. Check that there were no errors, specially this type of error: \texttt{\textit{Error calling Driver\#connect}}, which means that the code cannot connect to the database. Now, you can implement functionalities and test them locally by doing \textit{Run As > Maven install} or \textit{Run As > Maven test}.
@@ -237,9 +238,9 @@ \chapter{Creating and integrating new sensors}
237238
\chapter{Installing MUSES}
238239
\label{ch:installmuses}
239240

240-
Table \ref{tab:server_infrastructure} shows the hardware requirements to run MUSES server applications, the following sections will explain how to install and configure these requirements.
241+
Table \ref{tab:server_infrastructure} shows the hardware requirements to run MUSES server applications. The following sections will explain how to install and configure these requirements but the database, which was explained in Section \ref{subsec:database}.
241242

242-
\begin{table}
243+
\begin{table}[!htbp]
243244
\caption{MUSES server infrastructure.}
244245
\label{tab:server_infrastructure}
245246

@@ -266,12 +267,89 @@ \section{Configuring Apache Tomcat (Application Server)}
266267

267268
Section \ref{sec:eclipsetomcat} explained how to install the last version of Apache Tomcat server, because it was needed for developing purposes. Once you have followed the steps in that section, we continue configuring the server in order to finally have a working MUSES environment on our system.
268269

269-
But first of all, we have to install the Tomcat web application administrator by this command \cite{tomcatdocu:site}:
270+
As said in that section, Tomcat configuration files are at \texttt{/etc/tomcat7} directory. Among the configuration files, \textit{server.xml} can be found. Also, Figure \ref{fig:serverconfig} shown the configuration of Apache Tomcat, which includes the listening port. The default listening port for Apache is 8080, but we see in the figure that we have configured it at port 8888. The file \textit{server.xml} offers the possibility of changing the default port:
271+
\\
272+
\\
273+
\begin{verbatim}
274+
<Connector port="8080" protocol="HTTP/1.1"
275+
connectionTimeout="20000"
276+
redirectPort="8443" />
277+
...
278+
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
279+
\end{verbatim}
280+
281+
By simply changing \textit{connector port} 8080 for 8888. Please note that you may have to open \textit{server.xml} under superuser rights.
282+
283+
Then, we have to install the Tomcat web application administrator by this command \cite{tomcatdocu:site}:
270284

271285
\begin{verbatim}
272-
$ sudo apt-get install tomcat7
286+
$ sudo apt-get install tomcat7-admin
287+
\end{verbatim}
288+
289+
In order to add manager privileges, and to be able to use Tomcat web applications like \textit{host-manager} \cite{tomcatdocu:site}, we need to define a \textit{``manager-gui''} user in \textit{tomcat-users.xml} file. This file is also among the configuration files at \texttt{/etc/tomcat7}. Open this file under superuser rights and make sure to change it until it looks like:
290+
291+
\begin{verbatim}
292+
<?xml version='1.0' encoding='utf-8'?>
293+
<tomcat-users>
294+
<role rolename="manager-gui"/>
295+
<role rolename="manager"/>
296+
<role rolename="admin-gui"/>
297+
<role rolename="admin "/>
298+
<user username="admin" password="admin"
299+
roles="manager, manager-gui"/>
300+
</tomcat-users>
301+
\end{verbatim}
302+
303+
\subsection{SSL configuration Tomcat}
304+
\label{subsec:ssltomcat}
305+
306+
MUSES is using HTTPS in order to make the communication encrypted, and secure. SSL encryption has to be enabled in Tomcat server configuration with an SSL certificate location, on the server machine. Back again in the Tomcat configuration folder, at \texttt{/etc/tomcat7}, the \textit{web.xml} file allows to configure HTTPS on tomcat.
307+
308+
This way, open the \textit{web.xml} file and add the following lines:
309+
310+
\begin{verbatim}
311+
<security-constraint>
312+
<web-resource-collection>
313+
<web-resource-name>ComMainServlet</web-resource-name>
314+
<url-pattern>/commain</url-pattern>
315+
</web-resource-collection>
316+
<user-data-constraint>
317+
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
318+
</user-data-constraint>
319+
</security-constraint>
273320
\end{verbatim}
274321

322+
This will allow the MUSES servlet to listen for HTTPS connections. However, we also have to modify the file \textit{server.xml}, which is the same that have to be modified to change the listening port (see the beginning of this section). What we need now is to enable SSL authentication by adding:
323+
324+
\begin{verbatim}
325+
<Connector
326+
SSLEnabled="true"
327+
ciphers="SSL_RSA_WITH_RC4_128_SHA"
328+
clientAuth="false"
329+
keystoreFile="/etc/tomcat7/keystore.jks"
330+
keystorePass="MUSES11"
331+
maxThreads="150"
332+
port="8443"
333+
protocol="HTTP/1.1"
334+
scheme="https" secure="true" sslProtocol="TLS" />
335+
\end{verbatim}
336+
337+
Finally, Apache Tomcat has to be restarted in order to successfully apply the changes. This is done by:
338+
339+
\begin{verbatim}
340+
$ sudo service tomcat restart
341+
\end{verbatim}
342+
343+
\section{Starting MUSES}
344+
\label{sec:musestart}
345+
346+
To be able to start MUSES, the WAR file (Web Archive file) is required. The Tomcat 7.0 application server setup requires deploying the war file in the tomcat container. Follow below instructions.
347+
348+
Open a web browser and go to this link
349+
\url{http://localhost:8080/manager/html}
350+
It will ask for the user name and password. Enter the credentials which have been set during tomcat configuration\footnote{In our case, we used admin/admin at \textit{tomcat-users.xml}, but they can be changed.}, then it will open the manager page for tomcat. Now in section \textit{\textbf{WAR file to deploy}} click on \textit{Browse...} and select the war file, then click \textit{Deploy}.
351+
After doing this the application is listed in the applications column. Now click on the application button to start the server.
352+
275353
\bibliographystyle{abbrv}
276354
\bibliography{MUSESDevGuide}
277355

0 commit comments

Comments
 (0)