#encoding=UTF-8
#********************************************************************
# Wrapper Properties
#
# WARNING - for any changes to take effect, you must completely
# stop the router and the wrapper. Clicking 'Restart' on your
# router console will NOT reload this file! You must
# click "Shutdown", wait 10 minutes, then start i2p.
#
#********************************************************************
# Java Application
wrapper.java.command=/usr/lib/jvm/default/bin/java

# Java Main class.  This class must implement the WrapperListener interface
#  or guarantee that the WrapperManager class is initialized.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp

# Java Classpath (include wrapper.jar)  Add class path elements as
#  needed starting from 1
# Be sure there are no other duplicate classes.
wrapper.java.classpath.1=/opt/i2p/lib/*.jar
wrapper.java.classpath.2=/usr/share/java/wrapper.jar

# Java Library Path (location of libwrapper.so)
wrapper.java.library.path.1=/opt/i2p
wrapper.java.library.path.2=/opt/i2p/lib
wrapper.java.library.path.3=/usr/lib/java-service-wrapper

# Java Bits. On applicable platforms, tells the JVM to run in 32 or 64-bit mode.
wrapper.java.additional.auto_bits=TRUE

# Java Additional Parameters
wrapper.java.additional.1=-DloggerFilenameOverride=logs/log-router-@.txt
wrapper.java.additional.2=-Dorg.mortbay.http.Version.paranoid=true
wrapper.java.additional.3=-Dorg.mortbay.xml.XmlParser.NotValidating=true
wrapper.java.additional.4=-Di2p.dir.base="/opt/i2p"
wrapper.java.additional.4.stripquotes=TRUE

# On some IPv6 enabled systems, I2P and other network-enabled java applications
# may fail to start. For examples see
# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560044.
# Two things that may help if you experience this issue
# 1) "echo 0 > /proc/sys/net/ipv6/bindv6only" as root; or
# 2) uncomment the next two lines:
#wrapper.java.additional.5=-Djava.net.preferIPv4Stack=true
#wrapper.java.additional.6=-Djava.net.preferIPv6Addresses=false

# Location used to hold temporary files.
wrapper.java.additional.7=-Djava.io.tmpdir=/opt/i2p/.tmp

# Initial Java Heap Size (in MB)
# Until jdk15, should be set same as maxmemory for best performance
# If a non-zero value is specified for this property then an appropriate -Xms
#  parameter will be added. The initial memory must be less than or equal to
#  the value set for the maxmemory property
wrapper.java.initmemory=128

# Maximum Java Heap Size (in MB)
# The JVM's default is 64MB, and I2P can work fine in that, but to handle
# lots of I2PSnark activity in the same JVM, increasing the default max heap
# size should help.  Feel free to reduce this if not using I2PSnark in the jvm
# High-bandwidth routers may need to increase to 256 or more.
wrapper.java.maxmemory=128

# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=net.i2p.router.Router

#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Enables Debug output from the Wrapper.
# wrapper.debug=TRUE
# Format of output for the console.  (See docs for formats)
wrapper.console.format=PM

# Log Level for console output.  (See docs for log levels)
# https://wrapper.tanukisoftware.com/doc/english/prop-console-loglevel.html
wrapper.console.loglevel=INFO

# Log file to use for wrapper output logging.
# You may wish to change this.
wrapper.logfile=/opt/i2p/wrapper.log

# Format of output for the log file.
# The format consists of the tokens 'L' for log level, 'P' for prefix, 'D' for thread,
# 'T' for time, 'Z' for millisecond time, and 'M' for message
# Unfortunately the log timezone cannot be changed, see
# http://www.nabble.com/Log-message-timezone-td23651317.html
wrapper.logfile.format=TM

# Log Level for log file output.  (See docs for log levels)
wrapper.logfile.loglevel=INFO

# Maximum size that the log file will be allowed to grow to before
#  the log is rolled. Size is specified in bytes.  The default value
#  of 0, disables log rolling.  May abbreviate with the 'k' (kb) or
#  'm' (mb) suffix.  For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=1m

# Maximum number of rolled log files which will be allowed before old
#  files are deleted.  The default value of 0 implies no limit.
wrapper.logfile.maxfiles=2

# Log Level for sys/event log output.  (See docs for log levels)
wrapper.syslog.loglevel=NONE

# these will shut down or crash the JVM
wrapper.signal.mode.usr1=RESTART
wrapper.signal.mode.usr2=IGNORE

# choose what to do if the JVM kills itself based on the exit code
wrapper.on_exit.default=SHUTDOWN
wrapper.on_exit.0=SHUTDOWN
wrapper.on_exit.1=SHUTDOWN
# OOM
wrapper.on_exit.10=RESTART
# graceful shutdown
wrapper.on_exit.2=SHUTDOWN
# hard shutdown
wrapper.on_exit.3=SHUTDOWN
# hard restart
wrapper.on_exit.4=RESTART
# hard restart
wrapper.on_exit.5=RESTART

# the router may take a few seconds to save state, etc
wrapper.jvm_exit.timeout=60

# give the OS 60s to clear all the old sockets / etc before restarting
# Let's change the default from 60 to 10 seconds and see if anyone moans..
wrapper.restart.delay=5
wrapper.restart.reload_configuration=TRUE

# The ping timeout must be at least 5 seconds longer than the value of wrapper.ping.interval.
# Extend this if you are getting 'JVM appears hung' shutdowns.
wrapper.ping.timeout=320
wrapper.ping.interval=300

# pid file for the JVM
# If you plan to have multiple wrappers running on the same machine,
# you should copy this file, change the location or file name,
# and edit the i2prouter script to change the WRAPPER_CONF setting
# to point to the new wrapper.config location.
# Directory must exist or the wrapper will fail to start.
wrapper.java.pidfile=/run/i2p/i2p.pid

#********************************************************************
# Wrapper General Properties
#********************************************************************
# Allow for the use of non-contiguous numbered properties
wrapper.ignore_sequence_gaps=TRUE

# Title to use when running as a console
wrapper.console.title=I2P Router Service

# Set permissions used when creating files
# See http://wrapper.tanukisoftware.com/doc/english/prop-umask.html
# for a detailed explanation of these settings.
wrapper.umask=0022
wrapper.java.umask=0022
wrapper.logfile.umask=077

#********************************************************************
# Wrapper JVM Checks
#********************************************************************
# Out Of Memory detection.
wrapper.filter.trigger.1=java.lang.OutOfMemoryError
wrapper.filter.action.1=RESTART
wrapper.filter.message.1=The JVM has run out of memory.

#********************************************************************
# Advanced Options - https://docs.oracle.com/en/java/javase/17/docs/specs/man/java.html
#********************************************************************
# Enable the Shenandoah Garbage Collector
#wrapper.java.additional.101=-XX:+UseShenandoahGC
#wrapper.java.additional.102=-XX:+DisableExplicitGC

# Committing heap pages into memory helps to reduce latency hiccups
#wrapper.java.additional.103=-XX:+AlwaysPreTouch

# Using large pages greatly improves performance on large heaps
# Recommended to set /sys/kernel/mm/transparent_hugepage/enabled and /sys/kernel/mm/transparent_hugepage/defrag to "madvise"
#wrapper.java.additional.104=XX:+UseTransparentHugePages
