ansible-roles/tomcat-instance
Jeremy Lecour 00fe225a3c
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2615|7|2608|177|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/278//ansiblelint">Evolix » ansible-roles » unstable #278</a>
gitea/ansible-roles/pipeline/head This commit looks good
force: [yes,no] → force [true,false]
2023-06-28 13:25:30 +02:00
..
defaults fix non-breaking spaces 2022-12-14 11:47:53 +01:00
files tomcat-instance: deploy correct version of config files 2019-03-06 15:52:56 +01:00
meta Update Galaxy metadata (company, platforms and galaxy_tags) 2021-06-28 15:26:28 +02:00
tasks force: [yes,no] → force [true,false] 2023-06-28 13:25:30 +02:00
templates tomcat-instance: deploy correct version of server.xml 2019-02-20 11:29:11 +01:00
tests Tomcat: add some context for tests 2017-05-21 10:59:57 +02:00
.kitchen.yml Kitchen: Change base image to evolix/ansible 2017-06-02 08:38:08 -04:00
README.md Split tomcat-instance in tomcat + tomcat-instance 2017-07-03 17:37:06 +02:00

tomcat-instance

Install a Tomcat Instance with an independent Unix user and use of systemd user instance.

Available variables

**tomcat_instance_name **: Name of Tomcat instance and proprietary user and group (required) tomcat_instance_port: HTTP port for Tomcat instance and uid/gid for Tomcat user and group (default: 8080) tomcat_instance_shutdown: Port for Tomcat shutdown (default: HTTP port + 1) tomcat_instance_ram: Max memory for Tomcat instance (default: 512) tomcat_instance_mps: Max memory for internal objects of Tomcat instance (default: ram / 2) tomcat_instance_mail: Mail adresse for sending mail on shutdown instance (default to Unix user) tomcat_instance_deploy_user: Unix user who have sudo right with no password for application deployement

Exemple of role usage

- hosts: hostname
  become: yes
  vars:
    - tomcat_instance_mail: 'test@example.com'
    - tomcat_instance_deploy_user: 'deploy'
  roles:
  - { role: tomcat-instance, tomcat_instance_name: 'instance1', tomcat_instance_port: 8888, tomcat_instance_ram: 2048 }

Configuration of your Tomcat instance

Once you instance was installed, you can managed it with members of Tomcat instance group, deploy_user or directly by Tomcat instance owner.

Environnment config of Tomcat instance

The ~/conf/env file was sourced by systemd Tomcat service, you must define your environnment variables in this file, default value was :

JAVA_HOME="/usr/lib/jvm/java-1.7.0-openjdk-amd64"
JAVA_OPTS="-server -Xmx512m -Xms512m -XX:MaxPermSize=256m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:+CMSPermGenSweepingEnabled -XX:+CMSClassUnloadingEnabled -Xverify:none"

Usage of systemd Tomcat service

You must use systemctl --user with Tomcat user by su - username or prefix command by sudo -iu username ;

systemctl --user start tomcat
systemctl --user stop tomcat
systemctl --user status tomcat
systemctl --user restart tomcat
systemctl --user enable tomcat
systemctl --user disable tomcat

Alias scripts was availables in ~/bin/ for easier use if you are in Tomcat instance group or if you are deploy_user .

~/bin/startup.sh
~/bin/shutdown.sh
~/bin/status.sh
~/bin/enable.sh
~/bin/disable.sh