Well, there is couple of tutorials but they missing some points so it pushed me to lost one hour of my work.
What I got
- Fresh installation of Tomcat 7 on remote machine with opened 8080 port on firewall
- Personal war file supposed to be deployed
How to push it to tomcat?
Here is working example of tomcat-users.xml:
<tomcat-users>
<user username="manager-gui" password="changeit" roles="manager-gui"/>
<user username="manager-script" password="changeit" roles="manager-script"/>
</tomcat-users>
The important part is manager-script, contrary to Tomcat 6 where it had not exist yet. This user allows access to /text sub-namespace in management uri. The first user called manager-gui is the one which you use in GUI console, e.g. http://localhost:8085/manager/html
Once you run tomcat using bin's bat file, you can move to second bullet.
2. Now, it's possible to use remote deployment using curl command, e.g. in my use-case:
curl --upload-file my.war "http://manager-script:changeit@localhost:8080/manager/text/deploy?path=/myPath&update=true"
The command is working using manager-script user contrary to my original manager-gui. Another interesting part is path=/myPath. This attribute say which URL sub-namespace is to be used.
Even if you deploy my.war and common Tomcat's approach is to deploy application in /my subname, the application is to be exposed on /myPath.
2 comments:
Very elegant method! Without any dependencies like tomcat-plugin, etc. Thanks!
Goog article!. In my case, this works:
curl -T "myAppName.war" "http://user:password@[ip]:[port]/manager/text/deploy?path=/myAppName&update=true"
Post a Comment