diff --git a/Dockerfile b/Dockerfile index 95aa754c5..25633ca92 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,7 +6,6 @@ FROM centos:centos8.3.2011 as osmt-base LABEL Maintainer="WGU / OSN" LABEL Version="1.0" -ENV JAVA_VERSION=11.0.9.11 ENV JAVA_HOME=/etc/alternatives/jre ENV USER=osmt ENV BASE_DIR=/opt/${USER} @@ -15,7 +14,7 @@ ENV BASE_DIR=/opt/${USER} RUN /usr/bin/yum install -y epel-release \ && /usr/bin/yum update -y \ && /usr/bin/yum remove -y java-1.8.0-openjdk* \ - && /usr/bin/yum install -y curl java-11-openjdk-headless-${JAVA_VERSION} wget + && /usr/bin/yum install -y curl java-11-openjdk wget # Add in configuration files ADD ./docker/etc /etc @@ -34,15 +33,14 @@ RUN /usr/sbin/useradd -r -d ${BASE_DIR} -s /bin/bash ${USER} -k /etc/skel -m -U FROM osmt-base as build ENV JAVA_HOME=/etc/alternatives/jre -ENV JAVA_VERSION=11.0.9.11 -ENV M2_VERSION=3.6.3 +ENV M2_VERSION=3.8.1 ENV M2_HOME=/usr/local/maven ENV PATH=${M2_HOME}/bin:${PATH} ENV USER=osmt ENV BASE_DIR=/opt/${USER} # Install OpenJDK Development Packages -RUN /usr/bin/yum install -y java-11-openjdk-devel-${JAVA_VERSION} +RUN /usr/bin/yum install -y java-11-openjdk-devel # Download / Install Maven ADD https://www-eu.apache.org/dist/maven/maven-3/${M2_VERSION}/binaries/apache-maven-${M2_VERSION}-bin.tar.gz /usr/share/src/ @@ -59,7 +57,8 @@ WORKDIR ${BASE_DIR}/build USER ${USER} -RUN mvn clean package +# The dockerfile-build Maven profile excludes certain api integration tests that require access to the Docker service. +RUN mvn clean package -P dockerfile-build ###################### ### PACKAGING IMAGE ## @@ -67,7 +66,6 @@ RUN mvn clean package FROM osmt-base ENV JAVA_HOME=/etc/alternatives/jre -ENV JAVA_VERSION=11.0.9.11 ENV USER=osmt ENV BASE_DIR=/opt/${USER} diff --git a/api/pom.xml b/api/pom.xml index 1c53e8621..11a7949d4 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -45,6 +45,11 @@ + + edu.wgu.osmt + osmt-ui + 1.0.5-SNAPSHOT + org.springframework.boot spring-boot-starter-data-redis @@ -259,7 +264,7 @@ ${flywaydb.version} jdbc:mysql://localhost:3306/osmt_db - changeme + osmt password classpath:db/migration @@ -291,7 +296,55 @@ full + + org.apache.maven.plugins + maven-help-plugin + 3.2.0 + + + show-profiles + compile + + active-profiles + + + + + + + dockerfile-build + + + + org.apache.maven.plugins + maven-surefire-plugin + + + + AuditLogRepositoryTest + BatchImportRichSkillTest + BlsImportTest + CollectionEsRepoTest + CollectionRepositoryTest + ElasticSearchReindexerTest + JobCodeEsRepoTest + JobCodeRepositoryTest + KeywordEsRepoTest + KeywordRepositoryTest + OnetImportTest + RichSkillControllerTest + RichSkillEsRepoTest + RichSkillRepositoryTest + SearchControllerTest + TaskTest + + + + + + + diff --git a/api/src/main/kotlin/edu/wgu/osmt/PropertyLogger.kt b/api/src/main/kotlin/edu/wgu/osmt/PropertyLogger.kt new file mode 100644 index 000000000..68ea70da3 --- /dev/null +++ b/api/src/main/kotlin/edu/wgu/osmt/PropertyLogger.kt @@ -0,0 +1,37 @@ +package edu.wgu.osmt + +import org.slf4j.LoggerFactory +import org.springframework.context.annotation.Profile +import org.springframework.context.event.ContextRefreshedEvent +import org.springframework.context.event.EventListener +import org.springframework.core.env.AbstractEnvironment +import org.springframework.core.env.EnumerablePropertySource +import org.springframework.core.env.PropertySource +import org.springframework.stereotype.Component +import java.util.* +import java.util.stream.StreamSupport + + +@Component +@Profile("dev") +class PropertyLogger { + @EventListener + fun handleContextRefresh(event: ContextRefreshedEvent) { + val env = event.applicationContext.environment + LOGGER.info("====== Environment and configuration ======") + LOGGER.info("Active profiles: {}", Arrays.toString(env.activeProfiles)) + val sources = (env as AbstractEnvironment).propertySources + StreamSupport.stream(sources.spliterator(), false) + .filter { ps: PropertySource<*>? -> ps is EnumerablePropertySource<*> } + .map { ps: PropertySource<*> -> (ps as EnumerablePropertySource<*>).propertyNames } + .flatMap { array: Array? -> Arrays.stream(array) } + .distinct() + .filter { prop: String -> !(prop.contains("credentials") || prop.contains("password")) } + .forEach { prop: String? -> LOGGER.info("{}: {}", prop, env.getProperty(prop!!)) } + LOGGER.info("===========================================") + } + + companion object { + private val LOGGER = LoggerFactory.getLogger(PropertyLogger::class.java) + } +} \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 5658eefa0..e3430bef2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -8,8 +8,14 @@ services: environment: - "ENVIRONMENT=apiserver,dev" - "MYSQL_DB_URI=osmt:password@db:3306" + - "DB_NAME=osmt_db" - "ELASTICSEARCH_URI=elasticsearch:9200" - "REDIS_URI=redis:6379" + - "MIGRATIONS_ENABLED=false" + - "OAUTH_ISSUER=${OAUTH_ISSUER}" + - "OAUTH_CLIENTID=${OAUTH_CLIENTID}" + - "OAUTH_CLIENTSECRET=${OAUTH_CLIENTSECRET}" + - "OAUTH_AUDIENCE=${OAUTH_AUDIENCE}" depends_on: - db - elasticsearch diff --git a/pom.xml b/pom.xml index 201f39f2b..5a145f8b6 100644 --- a/pom.xml +++ b/pom.xml @@ -26,4 +26,11 @@ ui api + + + + dockerfile-build + + + diff --git a/ui/package.json b/ui/package.json index 690a01c86..bbeb2f743 100644 --- a/ui/package.json +++ b/ui/package.json @@ -6,7 +6,7 @@ "start": "./node_modules/@angular/cli/bin/ng serve", "start-hotreload": "./node_modules/@angular/cli/bin/ng serve --live-reload", "build": "./node_modules/@angular/cli/bin/ng build", - "build-prod": "./node_modules/@angular/cli/bin/ng build --prod", + "build-prod": "./node_modules/@angular/cli/bin/ng build --prod --output-path dist/ui/META-INF/resources", "test": "./node_modules/@angular/cli/bin/ng test", "lint": "./node_modules/@angular/cli/bin/ng lint", "e2e": "./node_modules/@angular/cli/bin/ng e2e", diff --git a/ui/pom.xml b/ui/pom.xml index 09d03b358..b8b1ce936 100644 --- a/ui/pom.xml +++ b/ui/pom.xml @@ -12,7 +12,11 @@ osmt-ui 1.0.5-SNAPSHOT - pom + jar + + + ${project.parent.basedir} + @@ -24,7 +28,7 @@ com.github.eirslett frontend-maven-plugin - 1.7.6 + 1.9.1 ./ v10.16.0 @@ -36,22 +40,28 @@ install-node-and-npm + generate-resources npm install npm + + install + npm run build-prod npm + generate-resources run build-prod +