Deploying the WAR file in Apache Tomcat
After all the configurations have been completed, the final step is to deploy the WAR files, which contain all the application-related files and are served by the application server. In this recipe, we will learn how to deploy WAR files using Salt.
How to do it...
We will use the same minion as in the previous recipe.
For this example, we will use a sample WAR file called sample.war
. Many such example application WAR files can be found online, for example at this location https://tomcat.apache.org/tomcat-6.0-doc/appdev/sample/sample.war.
The file is downloaded and located in the /opt/salt-cookbook/development/tomcat/files/sample.war
location.
Create and edit
/opt/salt-cookbook/development/tomcat/deploy.sls
to have the following entries:include: - tomcat sample_war: file.managed: - name: /opt/tomcat/webapps/sample.war - source: salt://tomcat/files/sample.war - mode: 0644 - require: - file: /opt/tomcat
Apply the state to the minion...