Skip to content

Commit

Permalink
Implement JPA through Elide
Browse files Browse the repository at this point in the history
  • Loading branch information
QubitPi committed Sep 13, 2023
1 parent fa5f6a2 commit 29e7071
Show file tree
Hide file tree
Showing 26 changed files with 723 additions and 785 deletions.
28 changes: 28 additions & 0 deletions .github/actions/create-mvn-settings/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'settings.xml'
description: 'Generate settings.xml for authenticating internal model package download'

inputs:
internal-maven-repo-server-id:
description: 'The server ID of Maven repo that contains the model package'
required: true
internal-maven-repo-user:
description: 'The accessing user of Maven repo that contains the model package'
required: true
internal-maven-repo-token:
description: 'The access token of Maven repo that contains the model package'
required: true

runs:
using: "composite"
steps:
- name: Authenticating internal model package download
uses: whelk-io/maven-settings-xml-action@v20
with:
servers: >
[
{
"id": "${{ inputs.internal-maven-repo-server-id }}",
"username": "${{ inputs.internal-maven-repo-user }}",
"password": "${{ inputs.internal-maven-repo-token }}"
}
]
45 changes: 8 additions & 37 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ name: Template CI/CD
push:
branches:
- master
- jpa-elide

env:
JDK_VERSION: 17
Expand Down Expand Up @@ -105,43 +106,6 @@ jobs:
user_name: ${{ env.USER }}
user_email: ${{ env.EMAIL }}

docker-image:
name: Build Test & Release Development Docker Image
needs: tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v3
with:
java-version: ${{ env.JDK_VERSION }}
distribution: ${{ env.JDK_DISTRIBUTION }}
- name: Build App WAR file so that Docker can pickup during image build
run: mvn clean package
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Test image build
uses: docker/build-push-action@v3
with:
context: .
push: false
- name: Login to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push image to DockerHub
if: github.ref == 'refs/heads/master'
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: ${{ secrets.DOCKERHUB_USERNAME }}/jersey-ws-template:latest

hashicorp:
name: Generated Webservice WAR in GitHub Action, and Publish Template AMI Image and Deploy it to EC2 through HashiCorp
if: ${{ github.event.repository.name != 'jersey-ws-template' }}
Expand All @@ -155,10 +119,17 @@ jobs:
with:
java-version: ${{ env.JDK_VERSION }}
distribution: ${{ env.JDK_DISTRIBUTION }}
- name: Generate Maven settings.xml
uses: ./.github/actions/create-mvn-settings
with:
internal-maven-repo-server-id: ${{ secrets.INTERNAL_MAVEN_REPO_SERVER_ID }}
internal-maven-repo-user: ${{ secrets.INTERNAL_MAVEN_REPO_USER }}
internal-maven-repo-token: ${{ secrets.INTERNAL_MAVEN_REPO_TOKEN }}
- name: Load webservice settings
run: |
echo "${{ secrets.APPLICATION_PROPERTIES }}" > src/main/resources/application.properties
echo "${{ secrets.OAUTH_PROPERTIES }}" > src/main/resources/oauth.properties
echo "${{ secrets.JPADATASTORE_PROPERTIES }}" > src/main/resources/jpadatastore.properties
- name: Generate webservice WAR file
run: mvn -B clean package
- name: Load SSL Certificates into AMI
Expand Down
42 changes: 42 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright Jiaqi Liu
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
version: "3.9"
services:
web:
build: .
ports:
- "8080:8080"
environment:
- MODEL_PACKAGE_NAME=${MODEL_PACKAGE_NAME}
- DB_USER=root
- DB_PASSWORD=root
- DB_DRIVER=com.mysql.jdbc.Driver
- DB_DIALECT=org.hibernate.dialect.MySQLDialect
- DB_URL=jdbc:mysql://db/elide?serverTimezone=UTC
- OAUTH_ENABLED=false
depends_on:
db:
condition: service_healthy
db:
image: "mysql:5.7"
ports:
- "3306:3306"
volumes:
- "./mysql-init.sql:/docker-entrypoint-initdb.d/mysql-init.sql"
environment:
MYSQL_ROOT_PASSWORD: root
healthcheck:
test: mysqladmin ping -h localhost -u root -proot
timeout: 3s
retries: 3
16 changes: 16 additions & 0 deletions mysql-init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
-- Copyright Jiaqi Liu
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- See the License for the specific language governing permissions and
-- limitations under the License.

CREATE DATABASE IF NOT EXISTS elide;
USE elide;
168 changes: 43 additions & 125 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,11 @@
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>

<version.validation.api>3.0.1</version.validation.api>
<version.jcip.annotations>1.0</version.jcip.annotations>
<version.slf4j>1.7.25</version.slf4j>
<version.logback>1.2.3</version.logback>
<version.jackson>2.13.3</version.jackson>
<version.slf4j>2.0.7</version.slf4j>
<version.logback>1.4.7</version.logback>
<version.owner>1.0.12</version.owner>
<version.servlet>6.0.0</version.servlet>
<version.jersey>3.1.1</version.jersey>
<version.groovy>4.0.6</version.groovy>
<version.jetty>11.0.15</version.jetty>

<version.maven.war.plugin>3.2.2</version.maven.war.plugin>
<version.maven.javadoc.plugin>3.5.0</version.maven.javadoc.plugin>
Expand All @@ -65,15 +60,6 @@

<dependencyManagement>
<dependencies>
<!-- JSON Parsing -->
<dependency>
<groupId>com.fasterxml.jackson</groupId>
<artifactId>jackson-bom</artifactId>
<version>${version.jackson}</version>
<scope>import</scope>
<type>pom</type>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.spockframework</groupId>
Expand All @@ -82,97 +68,54 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-bom</artifactId>
<version>${version.jetty}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>

<dependencies>
<!-- Logging -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>4.0.2</version>
</dependency>

<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
<version>${version.validation.api}</version>
</dependency>

<!-- Servlet API -->
<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>${version.servlet}</version>
</dependency>
<dependency>
<groupId>jakarta.ws.rs</groupId>
<artifactId>jakarta.ws.rs-api</artifactId>
<version>3.1.0</version>
</dependency>

<!-- Jersey -->
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>${version.jersey}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
<version>${version.jersey}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-multipart</artifactId>
<version>${version.jersey}</version>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${version.jersey}</version>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${version.logback}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework</groupId>
<artifactId>jersey-test-framework-core</artifactId>
<version>${version.jersey}</version>
<scope>test</scope>
</dependency>
<dependency> <!-- Jersey Test 'grizzly' container -->
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-grizzly2</artifactId>
<version>${version.jersey}</version>
<scope>test</scope>
<groupId>io.sentry</groupId>
<artifactId>sentry-logback</artifactId>
<version>6.25.2</version>
</dependency>

<!-- Injection -->
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<version>3.0.0</version>
</dependency>
<!-- Elide -->
<dependency>
<groupId>org.glassfish.hk2</groupId>
<artifactId>hk2-locator</artifactId>
<version>3.0.0</version>
<groupId>com.yahoo.elide</groupId>
<artifactId>elide-core</artifactId>
<version>7.0.0-pr6</version>
<exclusions>
<exclusion>
<groupId>com.yahoo.elide</groupId>
<artifactId>elide-graphql</artifactId>
</exclusion>
</exclusions>
</dependency>

<!-- JSON Parsing -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<groupId>com.yahoo.elide</groupId>
<artifactId>elide-standalone</artifactId>
<version>7.0.0-pr6</version>
<exclusions>
<exclusion>
<groupId>com.yahoo.elide</groupId>
<artifactId>elide-graphql</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.asynchttpclient</groupId>
<artifactId>async-http-client</artifactId>
<version>3.0.0.Beta2</version>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.49</version>
</dependency>

<!-- Concurrency -->
Expand All @@ -189,23 +132,6 @@
<version>${version.owner}</version>
</dependency>

<!-- Logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${version.slf4j}</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>${version.logback}</version>
</dependency>
<dependency>
<groupId>io.sentry</groupId>
<artifactId>sentry-logback</artifactId>
<version>6.25.2</version>
</dependency>

<!-- Testing -->
<dependency>
<groupId>org.spockframework</groupId>
Expand All @@ -216,11 +142,13 @@
<groupId>org.apache.groovy</groupId>
<artifactId>groovy</artifactId>
<version>${version.groovy}</version>
<scope>test</scope>
</dependency>
<dependency> <!-- Enable mocking of non-interface types -->
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>3.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.objenesis</groupId>
Expand All @@ -229,22 +157,6 @@
<scope>test</scope>
</dependency>

<!--Jetty-->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
Expand All @@ -261,7 +173,13 @@
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>spock</artifactId>
<version>1.18.0</version>
<version>1.19.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<version>1.19.0</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
Loading

0 comments on commit 29e7071

Please sign in to comment.