Hier werden die Unterschiede zwischen zwei Versionen gezeigt.
Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
tomcat_administration:start [2022/05/13 14:34] marco.staub [GC Log Parameter] |
tomcat_administration:start [2024/04/11 06:55] (aktuell) |
||
---|---|---|---|
Zeile 3: | Zeile 3: | ||
===== Tag 1 ===== | ===== Tag 1 ===== | ||
- | ==== 1.2 - rc.sh ==== | + | ==== 1.2 - tomcat.sh ==== |
<code> | <code> | ||
#!/bin/sh | #!/bin/sh | ||
Zeile 9: | Zeile 9: | ||
### Start Config ### | ### Start Config ### | ||
- | TOMCAT_VERSION=10.0.20 | + | TOMCAT_VERSION=10.1.20 |
INSTANCE_NAME=workshop | INSTANCE_NAME=workshop | ||
Zeile 166: | Zeile 166: | ||
</Loggers> | </Loggers> | ||
</Configuration> | </Configuration> | ||
+ | </code> | ||
+ | |||
+ | ==== 2.7 - JMX Remote ==== | ||
+ | <code> | ||
+ | JMX_OPTS_NOSSL_NOAUTH="\ | ||
+ | -Dcom.sun.management.jmxremote=true \ | ||
+ | -Dcom.sun.management.jmxremote.port=1090 \ | ||
+ | -Dcom.sun.management.jmxremote.ssl=false \ | ||
+ | -Dcom.sun.management.jmxremote.authenticate=false \ | ||
+ | " | ||
+ | |||
+ | JMX_OPTS_SSL_NOAUTH="\ | ||
+ | -Dcom.sun.management.jmxremote=true \ | ||
+ | -Dcom.sun.management.jmxremote.port=1090 \ | ||
+ | -Dcom.sun.management.jmxremote.ssl=true \ | ||
+ | -Dcom.sun.management.jmxremote.authenticate=false \ | ||
+ | -Djavax.net.ssl.keyStorePassword=workshop \ | ||
+ | -Djavax.net.ssl.keyStore=${CATALINA_BASE}/conf/keystore.jks \ | ||
+ | " | ||
+ | |||
+ | JMX_OPTS_SSL_AUTH="\ | ||
+ | -Dcom.sun.management.jmxremote=true \ | ||
+ | -Dcom.sun.management.jmxremote.port=1090 \ | ||
+ | -Dcom.sun.management.jmxremote.ssl=true \ | ||
+ | -Dcom.sun.management.jmxremote.authenticate=true \ | ||
+ | -Dcom.sun.management.jmxremote.access.file=${CATALINA_BASE}/conf/jmxremote.access \ | ||
+ | -Dcom.sun.management.jmxremote.password.file=${CATALINA_BASE}/conf/jmxremote.password \ | ||
+ | -Djavax.net.ssl.keyStorePassword=workshop \ | ||
+ | -Djavax.net.ssl.keyStore=${CATALINA_BASE}/conf/keystore.jks \ | ||
+ | " | ||
+ | |||
+ | CATALINA_OPTS="$CATALINA_OPTS $JMX_OPTS_NOSSL_NOAUTH" | ||
</code> | </code> | ||
Zeile 203: | Zeile 235: | ||
===== Tag 5 ===== | ===== Tag 5 ===== | ||
- | ==== 5.5 - balancer-manager ==== | + | ==== 5.1 - docker ==== |
+ | |||
+ | <code> | ||
+ | FROM alpine:3.15 | ||
+ | |||
+ | #### OpenJDK 17 | ||
+ | RUN apk update | ||
+ | RUN apk add openjdk17-jre-headless | ||
+ | ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk | ||
+ | |||
+ | #### tcnative | ||
+ | #ENV TCNATIVE 1.2.33 | ||
+ | #RUN apk add openjdk17-jdk apr-dev openssl-dev gcc make musl-dev | ||
+ | #RUN wget -O /tmp/tomcat-native-${TCNATIVE}-src.tar.gz https://dlcdn.apache.org/tomcat/tomcat-connectors/native/${TCNATIVE}/source/tomcat-native-${TCNATIVE}-src.tar.gz; \ | ||
+ | # cd /tmp; \ | ||
+ | # tar -zxf tomcat-native-${TCNATIVE}-src.tar.gz; \ | ||
+ | # cd tomcat-native-${TCNATIVE}-src/native; \ | ||
+ | # ./configure --prefix=/opt/tcnative/${TCNATIVE}; \ | ||
+ | # make; \ | ||
+ | # make install; \ | ||
+ | # cd /tmp; \ | ||
+ | # rm -rf /tmp/tomcat-native* | ||
+ | |||
+ | #### tomcat | ||
+ | ENV TOMCATVERSION 10.0.20 | ||
+ | ENV INSTANCENAME workshop | ||
+ | ENV TOMCATDIR /opt/tomcat | ||
+ | ENV WARFILE workshop.war | ||
+ | ENV APPVERSION 3.1.0 | ||
+ | ENV CATALINA_HOME ${TOMCATDIR}/products/apache-tomcat-${TOMCATVERSION} | ||
+ | ENV CATALINA_BASE ${TOMCATDIR}/instances/${INSTANCENAME} | ||
+ | ENV CATALINA_VAR /var/tomcat/${INSTANCENAME} | ||
+ | ENV PATH $CATALINA_HOME/bin:$PATH | ||
+ | ENV TCUSER tcrun | ||
+ | ENV TCGROUP tcgroup | ||
+ | |||
+ | # create CATALINA_HOME | ||
+ | RUN mkdir -p "${TOMCATDIR}/products"; \ | ||
+ | cd ${TOMCATDIR}/products; \ | ||
+ | wget -O /tmp/tomcat-product.tar.gz "https://archive.apache.org/dist/tomcat/tomcat-10/v${TOMCATVERSION}/bin/apache-tomcat-${TOMCATVERSION}.tar.gz"; \ | ||
+ | tar -zxf /tmp/tomcat-product.tar.gz; \ | ||
+ | rm /tmp/tomcat-product.tar.gz | ||
+ | |||
+ | # create CATALINA_BASE | ||
+ | COPY ${INSTANCENAME}.tar /tmp/${INSTANCENAME}.tar | ||
+ | RUN mkdir -p ${TOMCATDIR}/instances; \ | ||
+ | cd ${TOMCATDIR}/instances; \ | ||
+ | tar -xf /tmp/${INSTANCENAME}.tar; \ | ||
+ | rm /tmp/${INSTANCENAME}.tar | ||
+ | |||
+ | # create CATALINA_VAR | ||
+ | RUN mkdir -p /var/tomcat/${INSTANCENAME}; \ | ||
+ | cd /var/tomcat/${INSTANCENAME}; \ | ||
+ | mkdir logs temp webapps work | ||
+ | |||
+ | # create webappdir | ||
+ | RUN mkdir -p /opt/webapps/${INSTANCENAME}/${APPVERSION}-jee9 | ||
+ | COPY $WARFILE /opt/webapps/${INSTANCENAME}/${APPVERSION}-jee9/ | ||
+ | |||
+ | # create runtime user and change rights | ||
+ | RUN addgroup $TCGROUP; \ | ||
+ | adduser -h /opt/tomcat -H -G $TCGROUP -s /bin/sh -D $TCUSER; \ | ||
+ | chown -R $TCUSER:$TCGROUP /opt/tomcat; \ | ||
+ | chown -R $TCUSER:$TCGROUP /var/tomcat; \ | ||
+ | chown -R $TCUSER:$TCGROUP /opt/webapps | ||
+ | |||
+ | WORKDIR $CATALINA_BASE | ||
+ | EXPOSE 8080 8443 | ||
+ | |||
+ | USER $TCUSER | ||
+ | CMD ["catalina.sh","run"] | ||
+ | </code> | ||
+ | |||
+ | ==== 5.3 - einfacher Proxy ==== | ||
+ | <code> | ||
+ | <VirtualHost *:80> | ||
+ | ProxyPass /workshop http://localhost:8180/workshop | ||
+ | ProxyPassReverse /workshop http://localhost:8080/workshop | ||
+ | ProxyPassReverse /workshop http://localhost:8180/workshop | ||
+ | ProxyPreserveHost On | ||
+ | </VirtualHost> | ||
+ | </code> | ||
+ | |||
+ | ==== 5.6 - Monitoring ==== | ||
<code> | <code> | ||
Zeile 217: | Zeile 332: | ||
</code> | </code> | ||
+ | <code> | ||
+ | LogFormat "%h %l %u %t \"%r\" %>s %b %{BALANCER_ROUTE_CHANGED}e %{BALANCER_WORKER_ROUTE}e %{BALANCER_SESSION_ROUTE}e %D" proxyextended | ||
+ | CustomLog "logs/proxy_access_log" proxyextended | ||
+ | </code> | ||