Thursday, November 26, 2015

VMware vfabric web servers and tc servers to start when system boot

It is very important to start the tomcat services when a virtual machine power on automatically.

I have worked on this for our application to start up when ever there is a power on. On the VMware esxi host we can add a virtual machine to power on automatically when host restarts.

After starting the virtual machine the tomcat service in the server was not starting in our case. So, I followed VMware documentations and listed the important commands to do the same task here.

The following are the steps to make the tomcat or web services to start automatically when a virtual machine starts.

We need to create a tomcat user  with sudo permissions

adduser tcserver sudo

Make him owner for all files and sub directories of CATALINA_HOME

Edit
CATALINA_HOME/bin/init.d.sh

Modiy
TC_RUNTIME_USER="tc-server" to TC_RUNTIME_USER="tcserver"

Link the init.d.sh to /etc/init.d/{servicename}

ln -s /var/opt/vmware/vfabric-tc-server-standard/tcserver/bin/init.d.sh \ /etc/init.d/tcserver

After that we can test the service is working or not just by
To start the server instance
/etc/init.d/tcserver start
To  get status the server instance
/etc/init.d/tcserver status
To restart the server instance
/etc/init.d/tcserver restart 
To staop the server instance
/etc/init.d/tcserver stop
 
This is important after above to start the instance on boot we need to update the rc.d add the service instance to defaults
update-rc.d webserver defaults 
 
Note : CATALINA_HOME =  /var/opt/vmware/vfabric-tc-server-standard/MyInstance/

For webservers I just made the link and updated the rc.d and it just works fine.

# ln -s /var/opt/vmware/vfabric-web-server/webserver/bin/httpdcl  /etc/init.d/webserver
# update-rc.d webserver defaults

No comments:

Post a Comment