Skip to content

Commit

Permalink
fix build for postgres
Browse files Browse the repository at this point in the history
  • Loading branch information
jdbranham committed Jun 10, 2024
1 parent 7e5eb51 commit c4b1d66
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 28 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,12 @@ jobs:
run: |
IMAGE_URL=$IMAGE_REPOSITORY:$GITHUB_REF_NAME.${{ github.sha }}
LATEST_TAG=$IMAGE_REPOSITORY:latest
TAGS=$IMAGE_URL,$LATEST_TAG
BRANCH_TAG=$IMAGE_REPOSITORY:$GITHUB_REF_NAME
TAGS=$IMAGE_URL,$LATEST_TAG,$BRANCH_TAG
echo "::set-output name=image::$IMAGE_URL"
echo ::set-output name=version::${VERSION}
echo ::set-output name=latest_tag::${LATEST_TAG}
echo ::set-output name=branch_tag::${BRANCH_TAG}
echo ::set-output name=tags::${TAGS}
echo ::set-output name=created::$(date -u +'%Y-%m-%dT%H:%M:%SZ')
Expand All @@ -72,7 +74,9 @@ jobs:

# Build the docker image
- name: Build Server Projects
run: mvn -pl webapp jib:dockerBuild -Dimage=${{ steps.prep_docker.outputs.image }} -Dspring.profiles.active=POSTGRESQL
env:
SPRING_PROFILES_ACTIVE: POSTGRESQL
run: docker build -f docker/Dockerfile -t ${{ steps.prep_docker.outputs.image }} .

- name: Log in to Docker Hub
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
Expand All @@ -84,6 +88,7 @@ jobs:
id: push-image
run: |
docker tag ${{ steps.prep_docker.outputs.image }} ${{ steps.prep_docker.outputs.latest_tag }}
docker tag ${{ steps.prep_docker.outputs.image }} ${{ steps.prep_docker.outputs.branch_tag }}
docker push ${{ steps.prep_docker.outputs.image }}
docker push ${{ steps.prep_docker.outputs.latest_tag }}
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ translations.pot
create-db-schema.sql

.DS_Store
.env
.env

postgres-data
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ clean:
mvn clean

.PHONY: build-image
build:
build-image:
@echo "Building the project"
mvn install -DskipTests
docker build \
Expand All @@ -37,6 +37,10 @@ build:
run-image:
docker compose up

.PHONY: run-image-postgres
run-image-postgres:
docker compose -f docker-compose.postgres.yml up


define setup_env
$(eval ENV_FILE := $(1))
Expand Down
38 changes: 38 additions & 0 deletions docker-compose.postgres.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
services:
nexus-command:
image: savantly/nexus-command:latest
ports:
- "8080:8080"
restart: unless-stopped
environment:
- LOGGING_LEVEL_ROOT=WARN
- ECLIPSELINK_LOGGING_LEVEL=WARNING
- JDBC_LOGGING=false
- nexus.modules.organizations.enabled=true
- nexus.modules.projects.enabled=true
- nexus.modules.franchise.enabled=true
- nexus.modules.web.enabled=true
- nexus.modules.org-web.enabled=true
- nexus.modules.security.enabled=true
- nexus.modules.flow.enabled=true
- app.security.enabled=false
- SPRING_PROFILES_ACTIVE=POSTGRESQL
- SPRING_DATASOURCE_URL=jdbc:postgresql://nexus-postgres:5432/nexus
- SPRING_DATASOURCE_USERNAME=nexus
- SPRING_DATASOURCE_PASSWORD=nexus
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver

volumes:
- ./webapp/log4j2-test.xml:/app/BOOT-INF/classes/log4j2.xml

nexus-postgres:
image: postgres:14
environment:
POSTGRES_USER: nexus
POSTGRES_PASSWORD: nexus
POSTGRES_DB: nexus
ports:
- "5432:5432"
restart: unless-stopped
volumes:
- ./postgres-data:/var/lib/postgresql/data
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ ls -al
sleep 2


java ${JAVA_OPTS} -cp /app -Dserver.port=${PORT:-8080} -javaagent:/app/spring-instrument.jar -Djava.security.disableSystemPropertiesFile=true --add-opens java.base/sun.net=ALL-UNNAMED org.springframework.boot.loader.JarLauncher
java ${JAVA_OPTS} -cp /app -Dserver.port=${PORT:-8080} -javaagent:/app/spring-instrument.jar -Djava.security.disableSystemPropertiesFile=true --add-opens java.base/sun.net=ALL-UNNAMED org.springframework.boot.loader.launch.JarLauncher
8 changes: 0 additions & 8 deletions module-flow/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,7 @@
</dependency>

<!-- Spring -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<!-- CAUSEWAY API -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
@XmlType(propOrder = {
"organization",
"year",
"month"
"month",
"totalAmount",
})
@XmlAccessorType(XmlAccessType.FIELD)
public class MonthlyOrgReport {
Expand Down
30 changes: 17 additions & 13 deletions webapp/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
Expand All @@ -9,7 +11,7 @@
</parent>

<artifactId>nexus-command-webapp</artifactId>
<name>SimpleApp (JPA) - Webapp</name>
<name>Nexus Command - Webapp</name>

<description>
Assembles and runs both the Wicket viewer and the Restfulobjects viewer
Expand Down Expand Up @@ -50,7 +52,8 @@
<configuration>
<classifier>exec</classifier>
<agents>
<agent>${env.HOME}/.m2/repository/org/springframework/spring-instrument/${spring-framework.version}/spring-instrument-${spring-framework.version}.jar</agent>
<agent>
${env.HOME}/.m2/repository/org/springframework/spring-instrument/${spring-framework.version}/spring-instrument-${spring-framework.version}.jar</agent>
</agents>
<requiresUnpack>
<dependency>
Expand All @@ -69,12 +72,12 @@
<groupId>${project.groupId}</groupId>
<artifactId>web-module</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>web-module-api</artifactId>
</dependency>

<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>organizations-web-module</artifactId>
Expand Down Expand Up @@ -141,7 +144,7 @@
<groupId>org.apache.causeway.viewer</groupId>
<artifactId>causeway-viewer-wicket-applib</artifactId>
</dependency>

<dependency>
<groupId>org.apache.causeway.testing</groupId>
<artifactId>causeway-testing-h2console-ui</artifactId>
Expand All @@ -156,7 +159,8 @@
<groupId>org.apache.causeway.valuetypes</groupId>
<artifactId>causeway-valuetypes-markdown-metamodel</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.causeway.valuetypes/causeway-valuetypes-markdown-ui -->
<!--
https://mvnrepository.com/artifact/org.apache.causeway.valuetypes/causeway-valuetypes-markdown-ui -->
<dependency>
<groupId>org.apache.causeway.valuetypes</groupId>
<artifactId>causeway-valuetypes-markdown-ui-wkt</artifactId>
Expand All @@ -173,7 +177,6 @@
</dependency>



<dependency>
<groupId>org.apache.causeway.extensions</groupId>
<artifactId>causeway-extensions-flyway-impl</artifactId>
Expand Down Expand Up @@ -270,7 +273,7 @@
</dependency>


<dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-webmvc-core</artifactId>
<version>1.6.14</version>
Expand All @@ -283,7 +286,7 @@
</dependency>

<!-- TESTING -->

<dependency>
<groupId>org.apache.causeway.testing</groupId>
<artifactId>causeway-testing-integtestsupport-applib</artifactId>
Expand Down Expand Up @@ -333,8 +336,8 @@
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<!-- <version>42.2.12</version> ... version already managed -->
<artifactId>postgresql</artifactId>
<!-- <version>42.2.12</version> ... version already managed -->
</dependency>
</dependencies>
</profile>
Expand Down Expand Up @@ -384,4 +387,5 @@
</build>
</profile>
</profiles>
</project>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.username=simpleapp
spring.datasource.password=simpleapp

eclipselink.deploy-on-startup=true
eclipselink.ddl-generation=create-or-extend-tables

spring.jpa.defer-datasource-initialization=false
spring.jpa.generate-ddl=false
spring.sql.init.mode=always
spring.sql.init.schema-locations=classpath*:db/migration/POSTGRESQL/_schema.sql

spring.flyway.enabled=false
spring.flyway.default-schema=public
spring.flyway.schemas=public
spring.flyway.schemas=public
spring.flyway.baseline-on-migrate=true
spring.flyway.locations=classpath:db/migration/POSTGRESQL

0 comments on commit c4b1d66

Please sign in to comment.