Fixed mariadb service stop with ACA RPM install

This commit is contained in:
iadgovuser26 2024-02-13 08:59:43 -05:00
parent 672500b6e0
commit 522bca3549
8 changed files with 47 additions and 45 deletions

View File

@ -87,6 +87,13 @@ test {
useJUnitPlatform() useJUnitPlatform()
} }
build {
doFirst{
def verFile = new File(projectDir, "build/VERSION")
verFile.write("${jarVersion}")
}
}
ospackage { ospackage {
packageName = 'HIRS_AttestationCA' packageName = 'HIRS_AttestationCA'
os = LINUX os = LINUX
@ -108,6 +115,7 @@ ospackage {
// copy springboot property file // copy springboot property file
into ('/etc/hirs/aca/') { into ('/etc/hirs/aca/') {
from '../HIRS_AttestationCAPortal/src/main/resources/application.properties' from '../HIRS_AttestationCAPortal/src/main/resources/application.properties'
from 'build/VERSION'
} }
// copy setup scripts to /opt/hirs/aca // copy setup scripts to /opt/hirs/aca
into ('/opt/hirs/aca/scripts/') { into ('/opt/hirs/aca/scripts/') {
@ -128,18 +136,18 @@ ospackage {
postInstall '/opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &' postInstall '/opt/hirs/aca/scripts/aca/aca_bootRun.sh -w &'
postInstall 'chmod +x /opt/hirs/aca/scripts/aca/*' postInstall 'chmod +x /opt/hirs/aca/scripts/aca/*'
postInstall 'bash /opt/hirs/aca/scripts/aca/check_for_aca.sh' postInstall 'bash /opt/hirs/aca/scripts/aca/check_for_aca.sh'
postInstall 'mkdir -p /etc/hirs/aca && touch /etc/hirs/aca/VERSION' postInstall 'if [ -f /opt/hirs/aca/VERSION ]; then rm /opt/hirs/aca/VERSION; fi;'
postInstall "echo ${jarVersion} > /etc/hirs/aca/VERSION"
// Uninstall // Uninstall
preUninstall 'bash /opt/hirs/aca/scripts/aca/aca_remove_setup.sh' preUninstall 'bash /opt/hirs/aca/scripts/aca/aca_remove_setup.sh'
postUninstall 'rm -rf /etc/hirs'
buildRpm { buildRpm {
dependsOn ':build'
arch = X86_64 arch = X86_64
} }
buildDeb { buildDeb {
dependsOn ':build'
packageName = 'hirs-attestationca' packageName = 'hirs-attestationca'
arch = 'amd64' arch = 'amd64'
} }

View File

@ -1,18 +1,16 @@
# Logging Config (tomcat may have further config) # Logging Config (tomcat may have further config)
logging.level.org.springframework=TRACE logging.level.org.springframework=ERROR
logging.level.org.apache.catalina=TRACE logging.level.org.apache.catalina=ERROR
logging.level.org.springframework.web: TRACE logging.level.org.springframework.web=ERROR
logging.level.org.hibernate: ERROR logging.level.org.hibernate=ERROR
logging.file.path=/var/log/hirs logging.file.path=/var/log/hirs
logging.file.name=hirs.spring.log logging.file.name=HIRS_AttestationCA_Portal.log
# Database Config # Database Config
spring.jpa.hibernate.ddl-auto=update spring.jpa.hibernate.ddl-auto=update
jakarta.persistence.sharedCache.mode = UNSPECIFIED jakarta.persistence.sharedCache.mode = UNSPECIFIED
spring.datasource.driver-class-name=org.mariadb.jdbc.Driver spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
#spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#spring.datasource.driverClassName=com.mysql.cj.jdbc.Driver
aca.certificates.validity = 3652
# Tomcat Config # Tomcat Config
server.tomcat.additional-tld-skip-patterns=jakarta.persistence-api*.jar, jakarta.xml.bind-api*.jar, txw2*.jar, *commons*.jar, *annotations*.jar, *checker*.jar, *lombok*.jar, *jsr*.jar, *guava*.jar, *access*.jar, *activation*.jar, *bcprov*.jar, *bcmail*.jar, *bcutil*.jar, *bcpkix*.jar, *json*.jar server.tomcat.additional-tld-skip-patterns=jakarta.persistence-api*.jar, jakarta.xml.bind-api*.jar, txw2*.jar, *commons*.jar, *annotations*.jar, *checker*.jar, *lombok*.jar, *jsr*.jar, *guava*.jar, *access*.jar, *activation*.jar, *bcprov*.jar, *bcmail*.jar, *bcutil*.jar, *bcpkix*.jar, *json*.jar
server.tomcat.basedir=/opt/embeddedtomcat server.tomcat.basedir=/opt/embeddedtomcat
@ -37,16 +35,6 @@ server.ssl.key-store-type=JKS
server.ssl.key-store=/etc/hirs/certificates/HIRS/KeyStore.jks server.ssl.key-store=/etc/hirs/certificates/HIRS/KeyStore.jks
server.ssl.key-alias=hirs_aca_tls_rsa_3k_sha384 server.ssl.key-alias=hirs_aca_tls_rsa_3k_sha384
#--server.ssl.key-store-password=123456 # ACA specific default properties
#--server.ssl.trust-store-password=123456 aca.certificates.validity = 3652
#jdbc.driverClassName = com.mysql.cj.jdbc.Driver
#jdbc.url = jdbc:mysql://localhost:3306/hirs_db?autoReconnect=true&useSSL=false
#jdbc.username = root
#jdbc.password = hirspass
#entitymanager.packagesToScan: hirs.attestationca.portal.page.controllers
#spring.jpa.hibernate.ddl-auto=update
#spring.jpa.show-sql=true
# DB dfault password.
#spring.datasource.password=hirs_db

View File

@ -1,8 +1,8 @@
# Logging Config (tomcat may have further config) # Logging Config (tomcat may have further config)
logging.level.org.springframework=TRACE logging.level.org.springframework=ERROR
logging.level.org.apache.catalina=TRACE logging.level.org.apache.catalina=ERROR
logging.level.org.springframework.web=TRACE logging.level.org.springframework.web=ERROR
logging.level.org.hibernate=ERROR logging.level.org.hibernate=ERROR
logging.file.path=C:/ProgramData/hirs/log logging.file.path=C:/ProgramData/hirs/log
logging.file.name=hirs.spring.log logging.file.name=hirs.spring.log

View File

@ -5,7 +5,7 @@
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%C.%M] %-5p : %m%n"/> <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%C.%M] %-5p : %m%n"/>
</Console> </Console>
<RollingFile name="FILE" fileName="/var/log/hirs/HIRS_AttestationCA_Portal.log" <RollingFile name="FILE" fileName="/var/log/hirs/HIRS_AttestationCA_Portal.log"
filePattern="./logs/HIRS_AttestationCA_Portal.log-%d{yyyy-MM-dd}-%i.log" > filePattern="/var/log/hirs/HIRS_AttestationCA_Portal-%d{yyyy-MM-dd}-%i.log" >
<PatternLayout> <PatternLayout>
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%C.%M] %-5p : %m%n</pattern> <pattern>%d{yyyy-MM-dd HH:mm:ss} [%C.%M] %-5p : %m%n</pattern>
</PatternLayout> </PatternLayout>
@ -18,18 +18,18 @@
<DefaultRolloverStrategy max="10"/> <DefaultRolloverStrategy max="10"/>
</RollingFile> </RollingFile>
</Appenders> </Appenders>
<Loggers> <Loggers>
<Root level = "WARN"> <Root level = "ERROR">
<AppenderRef ref="STDOUT" level="WARN" /> <AppenderRef ref="STDOUT" level="ERROR" />
<AppenderRef ref="FILE"/> <AppenderRef ref="FILE"/>
</Root> </Root>
<SpringProfile name="!development, !production"> <SpringProfile name="!development, !production">
<Logger name="hirs.attestationca" level="trace" /> <Logger name="hirs.attestationca" level="info" />
</SpringProfile> </SpringProfile>
<Logger name="org.hibernate" level="DEBUG" /> <Logger name="org.hibernate" level="ERROR" />
</Loggers> </Loggers>
<!-- prevents an out-of-memory exception caused by the debug logging of very large inserts --> <!-- prevents an out-of-memory exception caused by the debug logging of very large inserts -->
<category name="org.hibernate.event.def.AbstractFlushingEventListener"> <category name="org.hibernate.event.def.AbstractFlushingEventListener">
<priority value="INFO"/> <priority value="ERROR"/>
</category> </category>
</Configuration> </Configuration>

View File

@ -122,15 +122,15 @@ keyStore="$CLIENT_DB_P12" "
WEB_TLS_PARAMS="--server.ssl.key-store-password=$hirs_pki_password \ WEB_TLS_PARAMS="--server.ssl.key-store-password=$hirs_pki_password \
--server.ssl.trust-store-password=$hirs_pki_password" --server.ssl.trust-store-password=$hirs_pki_password"
# uncomment to show spring boot and hibernate properties used as gradle argumanets # uncomment to show spring boot and hibernate properties used as gradle arguments
#echo "--args=\"$CONNECTOR_PARAMS $WEB_TLS_PARAMS\"" #echo "--args=\"$CONNECTOR_PARAMS $WEB_TLS_PARAMS\""
if [ -z "$USE_WAR" ]; then if [ -z "$USE_WAR" ]; then
echo "Booting the ACA from local build..." echo "Booting the ACA from local build..."
# ./gradlew bootRun --args="$CONNECTOR_PARAMS$WEB_TLS_PARAMS" # ./gradlew bootRun --args="$CONNECTOR_PARAMS$WEB_TLS_PARAMS"
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE" ./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE"
else else
echo "Booting the ACA from a war file..." echo "Booting the ACA from a war file..."
# java -jar $WAR_PATH $CONNECTOR_PARAMS$WEB_TLS_PARAMS & # java -jar $WAR_PATH $CONNECTOR_PARAMS$WEB_TLS_PARAMS &
java -jar $WAR_PATH --spring.config.location=$SPRING_PROP_FILE java -jar $WAR_PATH --spring.config.location=$SPRING_PROP_FILE & disown -h
fi fi

View File

@ -17,7 +17,9 @@ fi
source $SCRIPT_DIR/../db/mysql_util.sh source $SCRIPT_DIR/../db/mysql_util.sh
# Make sure myswl root password is available and set $DB_ADIM_PWD before continuing... # Make sure mysql root password is available and set $DB_ADIM_PWD before continuing...
check_mariadb_install
check_mysql_root check_mysql_root
# remove the hrs-db and hirs_db user # remove the hrs-db and hirs_db user
@ -27,8 +29,12 @@ popd &>/dev/null
# remove pki files and config files if not installed by rpm # remove pki files and config files if not installed by rpm
echo "Removing certificates and config files..." echo "Removing certificates and config files..."
if [ ! -d /opt/hirs/aca ]; then
rm -rf /etc/hirs if [ -d "/etc/hirs" ]; then
rm -rf /etc/hirs >/dev/null 2>&1
fi
if [ -d "/opt/hirs" ]; then
rm -rf /opt/hirs >/dev/null 2>&1
fi fi
# Remove crontab and current ACA process # Remove crontab and current ACA process

View File

@ -59,7 +59,7 @@ while [[ $# -gt 0 ]]; do
;; ;;
*) *)
POSITIONAL_ARGS+=("$1") # save positional arg POSITIONAL_ARGS+=("$1") # save positional arg
# shift # past argument # shift # past argumfrom 'build/VERSION'ent
break break
;; ;;
esac esac

View File

@ -12,7 +12,7 @@ SQL_SERVICE="mariadb"
check_for_container () { check_for_container () {
PRINT_STATUS=$1 PRINT_STATUS=$1
# Check if we're in a Docker container # Check if we're in a Docker container
if [[ $(cat /proc/1/cgroup | head -n 1) == *"docker"* ]] || [ -f /.dockerenv ]; then if [[ $(cat /proc/1/cgroup | head -n 1) == *"docker"* ]] || [[ -f /.dockerenv ]]; then
DOCKER_CONTAINER=true DOCKER_CONTAINER=true
if [[ $PRINT_STATUS == "-p" ]]; then echo "ACA is running in a container..." | tee -a "$LOG_FILE"; fi if [[ $PRINT_STATUS == "-p" ]]; then echo "ACA is running in a container..." | tee -a "$LOG_FILE"; fi
else else