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

View File

@ -1,18 +1,16 @@
# Logging Config (tomcat may have further config)
logging.level.org.springframework=TRACE
logging.level.org.apache.catalina=TRACE
logging.level.org.springframework.web: TRACE
logging.level.org.hibernate: ERROR
logging.level.org.springframework=ERROR
logging.level.org.apache.catalina=ERROR
logging.level.org.springframework.web=ERROR
logging.level.org.hibernate=ERROR
logging.file.path=/var/log/hirs
logging.file.name=hirs.spring.log
logging.file.name=HIRS_AttestationCA_Portal.log
# Database Config
spring.jpa.hibernate.ddl-auto=update
jakarta.persistence.sharedCache.mode = UNSPECIFIED
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
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
@ -37,16 +35,6 @@ server.ssl.key-store-type=JKS
server.ssl.key-store=/etc/hirs/certificates/HIRS/KeyStore.jks
server.ssl.key-alias=hirs_aca_tls_rsa_3k_sha384
#--server.ssl.key-store-password=123456
#--server.ssl.trust-store-password=123456
# ACA specific default properties
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.level.org.springframework=TRACE
logging.level.org.apache.catalina=TRACE
logging.level.org.springframework.web=TRACE
logging.level.org.springframework=ERROR
logging.level.org.apache.catalina=ERROR
logging.level.org.springframework.web=ERROR
logging.level.org.hibernate=ERROR
logging.file.path=C:/ProgramData/hirs/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"/>
</Console>
<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>
<pattern>%d{yyyy-MM-dd HH:mm:ss} [%C.%M] %-5p : %m%n</pattern>
</PatternLayout>
@ -18,18 +18,18 @@
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
<Loggers>
<Root level = "WARN">
<AppenderRef ref="STDOUT" level="WARN" />
<Loggers>
<Root level = "ERROR">
<AppenderRef ref="STDOUT" level="ERROR" />
<AppenderRef ref="FILE"/>
</Root>
<SpringProfile name="!development, !production">
<Logger name="hirs.attestationca" level="trace" />
<Logger name="hirs.attestationca" level="info" />
</SpringProfile>
<Logger name="org.hibernate" level="DEBUG" />
<Logger name="org.hibernate" level="ERROR" />
</Loggers>
<!-- prevents an out-of-memory exception caused by the debug logging of very large inserts -->
<category name="org.hibernate.event.def.AbstractFlushingEventListener">
<priority value="INFO"/>
<priority value="ERROR"/>
</category>
</Configuration>

View File

@ -122,15 +122,15 @@ keyStore="$CLIENT_DB_P12" "
WEB_TLS_PARAMS="--server.ssl.key-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\""
if [ -z "$USE_WAR" ]; then
echo "Booting the ACA from local build..."
# ./gradlew bootRun --args="$CONNECTOR_PARAMS$WEB_TLS_PARAMS"
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE"
else
./gradlew bootRun --args="--spring.config.location=$SPRING_PROP_FILE"
else
echo "Booting the ACA from a war file..."
# 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

View File

@ -17,7 +17,9 @@ fi
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
# 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
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
# Remove crontab and current ACA process

View File

@ -2,7 +2,7 @@
#####################################################################################
#
# Script to create ACA setup files and configure the hirs_db database.
#
#
#
#####################################################################################
# Capture location of the script to allow from invocation from any location
@ -59,7 +59,7 @@ while [[ $# -gt 0 ]]; do
;;
*)
POSITIONAL_ARGS+=("$1") # save positional arg
# shift # past argument
# shift # past argumfrom 'build/VERSION'ent
break
;;
esac

View File

@ -12,7 +12,7 @@ SQL_SERVICE="mariadb"
check_for_container () {
PRINT_STATUS=$1
# 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
if [[ $PRINT_STATUS == "-p" ]]; then echo "ACA is running in a container..." | tee -a "$LOG_FILE"; fi
else