Pivotal/tcserver
tcserver
Contents |
Overview
https://content.pivotal.io/blog/part-one-comparing-apache-tomcat-and-pivotal-tc-server
Pivotal tc server builds on top of Apache Tomcat and adds a few key features:
- Enterprise support (with purchased license)
- Multi-instance support with shared binaries - individual runtime instances allows a separation between the binaries and the applications/configuration, allowing one set of binaries to power multiple instances.
- Variable substitution within server.xml - allows for consistent configuration and port management
Note: Pivotal tcserver 3.x is available through the pivotal repo, however to get the latest version, 4.x, you need to download and install the RPM from pivnet manually.
https://tcserver.docs.pivotal.io/4x/docs-tcserver/topics/whats-new-4.0.0.html#rpm-packaging
Installing tcserver 3.x - Linux
references: https://tcserver.docs.pivotal.io/3x/docs-tcserver/topics/install-getting-started.html
https://tcserver.docs.pivotal.io/4x/docs-tcserver/topics/tutwebapp.html
In this example we will be installing tcserver 3.x on a CentOS 7 vm using the pivotal repo.
Adding the Pivotal Repo and installing the package
Accept the EULA
~$ wget -q -O - http://packages.pivotal.io | sudo sh
Verify you see the new package
~$ sudo yum search pivotal-tc-server-standard
Install tcserver, ant, and java
~$ sudo yum install pivotal-tc-server-standard ant java-1.8.0-openjdk
Setting the user variables
To discover your Java home variable, you need to find the executable location and then use that to discover JAVA_HOME. You will need to omit /jre
if it appears in your java_home results.
~$ which java /bin/java ~$ /bin/java -XshowSettings:properties -version 2>&1 > /dev/null | grep 'java.home' java.home = /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre
Ant HOME should always be /usr/share/ant
With both the JAVA_HOME
and ANT_HOME
found, we can set the following in our bash profile. Make sure to omit /jre
from your JAVA_HOME:
export JAVA_HOME="/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64" export ANT_HOME="/usr/share/ant" export PATH=$PATH:$JAVA_HOME/bin
You can use the following to append the variables in your bash profile, make sure to update the variables to match your versions.
~$ echo -e export JAVA_HOME='"'/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64'"'"\n"export ANT_HOME='"'/usr/share/ant'"'"\n"export PATH='$PATH:$JAVA_HOME/bin' >> ~/.bash_profile
NOTE: I would set the user variables to both your sudo capable user AND the tcserver user.
tcserver user
When you installed tcserver, it created a user called tcserver
. We will want to replicate the steps above for setting the user variables for JAVA_HOME
and ANT_HOME
for this user, tcserver, as well. When you log in as tcserver
, you will want to use the -E
flag in order to maintain user variables.
~$ sudo -E su tcserver
If you forget to use the -E
flag, you can set the variables for your current session like this:
~$ source ~/.bash_profile
Testing with Hello World app
With tcserver installed and its dependencies configured, we can test it with a simple hello world java app.
Before we begin, lets log in as the user tcserver
~$ sudo -E su tcserver
git clone and ant build
tcserver recommends that all instances be placed in /var/opt/pivotal/pivotal-tc-server-standard
instead of the default executable directory.
~$ git clone https://github.com/carefreepineapple/hello-world-war.git
Now lets build the WAR file.
~$ cd ~/hello-world-war/ ~$ ant all
The important file we want from this is the WAR file, which will be located in the ./dist/
folder.
~$ ls ~/hello-world-war/dist/ hello.war
create instance, copy war, and start
To create a new instance, we need to use the tcruntime-instance.sh
script.
~$ /opt/pivotal/pivotal-tc-server-standard/tcruntime-instance.sh create hello-world-war -i /var/opt/pivotal/pivotal-tc-server-standard/
Now that we've created a new instance called hello-world-war, we can copy the WAR file we generated earlier into it.
~$ cp ~/hello-world-war/dist/hello.war /var/opt/pivotal/pivotal-tc-server-standard/hello-world-war/webapps/
Finally lets try to start the instance.
~$ /opt/pivotal/pivotal-tc-server-standard/tcruntime-ctl.sh hello-world-war start -i /var/opt/pivotal/pivotal-tc-server-standard/
uninstall tcserver 3.x
In the event you want to remove tcserver 3.x, you can do the following:
~$ sudo yum erase pivotal-tc-server-standard
However, that will leave a few things
~$ sudo rm -rf /var/opt/pivotal/ sudo userdel -r tcserver
</nowiki>
Installing tcserver 4.x - Linux
references: https://tcserver.docs.pivotal.io/3x/docs-tcserver/topics/install-getting-started.html
https://tcserver.docs.pivotal.io/4x/docs-tcserver/topics/tutwebapp.html
In this example we will be installing tcserver 4.x on a CentOS 7 vm using the pivotal RPM package.