Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: backend oracle extract and load #276

Merged
merged 52 commits into from
Jan 31, 2025
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
f599472
feat: backend el initial commit
mishraomp Jan 23, 2025
7955019
chore: intermediate commit
mishraomp Jan 24, 2025
7d03d48
chore: intermediate commit switching to spring boot from quarkus
mishraomp Jan 25, 2025
6d3d0b7
Merge branch 'main' into feat/oracle-el-api
mishraomp Jan 25, 2025
789fc77
fix: trivy
mishraomp Jan 25, 2025
ddff120
chore: some more entities and more csv processing
mishraomp Jan 26, 2025
778ceff
chore: more code reuse
mishraomp Jan 26, 2025
a9cad89
chore: remove controller will be added later if needed currently run …
mishraomp Jan 26, 2025
60fa78f
chore: some more entities added
mishraomp Jan 26, 2025
a8b7f10
chore: more entities including attachment
mishraomp Jan 27, 2025
018e27b
chore: added more entities
mishraomp Jan 27, 2025
1a91c2f
fix: compilation error
mishraomp Jan 27, 2025
6976cce
Merge branch 'main' into feat/oracle-el-api
mishraomp Jan 27, 2025
f18c253
feat: adding backend el build deploy for openshift
mishraomp Jan 27, 2025
8d0ba81
chore: ignore helm charts for precommit
mishraomp Jan 27, 2025
5ef076d
chore: precommit I hope I made it this time
mishraomp Jan 27, 2025
dd9db33
Merge branch 'feat/oracle-el-gha-ci-cd' of https://github.com/bcgov/n…
mishraomp Jan 28, 2025
58febf8
chore: more logic for attachment processing, fix dockerfile
mishraomp Jan 28, 2025
7a926dc
Merge branch 'feat/oracle-el-api' of https://github.com/bcgov/nr-rec-…
mishraomp Jan 28, 2025
70b8e04
Merge branch 'main' into feat/oracle-el-api
mishraomp Jan 28, 2025
b332bf5
chore: support openshift deployment, dev and prod, configure aws secr…
mishraomp Jan 28, 2025
bfffc6c
fix: build file context
mishraomp Jan 28, 2025
7af8f63
fix: build context
mishraomp Jan 28, 2025
a6d8707
fix: helm deploy add missing parameter name
mishraomp Jan 28, 2025
c561456
fix: cronjob yaml indent
mishraomp Jan 28, 2025
8c42f55
chore: add missing env var and update job names
mishraomp Jan 28, 2025
2f26ae7
chore: add missing env var
mishraomp Jan 28, 2025
3844679
chore: make JDB URL env var
mishraomp Jan 28, 2025
143dab3
chore: make shell script to debug issues
mishraomp Jan 28, 2025
18e31b0
chore: try running without init, init will be deleted later
mishraomp Jan 28, 2025
b47cf14
fix: Dockerfile
mishraomp Jan 28, 2025
1cbb806
fix: wrap values with quotes
mishraomp Jan 28, 2025
66eb2d2
chore: remove init container and related charts, add certs to the mai…
mishraomp Jan 28, 2025
ef201be
fix: helm remove cronjob cert pvc
mishraomp Jan 29, 2025
2d33859
chore: add s3 sync between aws and openshift
mishraomp Jan 29, 2025
adf5034
Merge branch 'main' into feat/oracle-el-api
mishraomp Jan 29, 2025
0e43a89
fix: precommit
mishraomp Jan 29, 2025
551b94b
Merge branch 'feat/oracle-el-api' of https://github.com/bcgov/nr-rec-…
mishraomp Jan 29, 2025
4c38d47
chore: add workflow dispatch to trigger manually when needed
mishraomp Jan 29, 2025
14265ea
fix: java start command to reduce noise and added some more jvm args
mishraomp Jan 29, 2025
2da0c84
docs: add documentation
mishraomp Jan 29, 2025
3860ecb
Merge branch 'main' into feat/oracle-el-api
mishraomp Jan 30, 2025
6c7226f
chore: align with schema, column ordering and remove subpath
mishraomp Jan 30, 2025
1395c49
fix: tf code to not error during tf plan in pr
mishraomp Jan 30, 2025
da6a1cd
fix: tf and gha
mishraomp Jan 30, 2025
5116325
Merge branch 'main' into feat/oracle-el-api
mishraomp Jan 30, 2025
381c1b9
docs: OpenShift deployment
mishraomp Jan 30, 2025
5aa5507
Merge branch 'feat/oracle-el-api' of https://github.com/bcgov/nr-rec-…
mishraomp Jan 30, 2025
6c4602e
chore: update s3 location
mishraomp Jan 30, 2025
1445d80
fix: entity activity rank
mishraomp Jan 30, 2025
c2e901e
fix: entity align with db and add missing columns
mishraomp Jan 30, 2025
d4019a9
Merge branch 'main' into feat/oracle-el-api
mishraomp Jan 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,6 @@ venv.bak/
# Playwright
playwright-report/
test-results/
!backend-el
backend-el/target
backend-el/*.iml
2 changes: 2 additions & 0 deletions backend-el/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/mvnw text eol=lf
*.cmd text eol=crlf
33 changes: 33 additions & 0 deletions backend-el/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/
19 changes: 19 additions & 0 deletions backend-el/.mvn/wrapper/maven-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
wrapperVersion=3.3.2
distributionType=only-script
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.9/apache-maven-3.9.9-bin.zip
14 changes: 14 additions & 0 deletions backend-el/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Stage 1: Build the application
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Dismissed Show dismissed Hide dismissed
FROM maven:3.8.4-eclipse-temurin-21 AS build
WORKDIR /app
COPY pom.xml .
RUN mvn dependency:go-offline
COPY src ./src
RUN mvn package -DskipTests

# Stage 2: Run the application
FROM eclipse-temurin:21
WORKDIR /app
COPY --from=build /app/target/*.jar /app/app.jar
RUN java -Djarmode=layertools -jar app.jar extract
ENTRYPOINT ["java", "-cp", "BOOT-INF/classes:BOOT-INF/lib/*", "com.example.YourMainClass"]
17 changes: 17 additions & 0 deletions backend-el/Dockerfile.certs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#This Dockerfile mounts the certs
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
FROM eclipse-temurin:21

ENV LANG=en_CA.UTF-8
ENV LANGUAGE=en_CA.UTF-8
ENV LC_ALL=en_CA.UTF-8
WORKDIR /app

RUN apk --no-cache add openssl

COPY get_certs.sh .

RUN chmod g+w /app && \
chmod g+x get_certs.sh && \
chmod g+w ${JAVA_HOME}/lib/security/cacerts

ENTRYPOINT ["sh", "get_certs.sh"]
35 changes: 35 additions & 0 deletions backend-el/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
- This README file provides information on using the backend-el folder to read
data from an Oracle database, create CSV files from the retrieved data, and
upload the generated CSV files to AWS S3.

- The main functionalities include:

1. Connecting to an Oracle database and executing queries to fetch data.
2. Processing the fetched data and writing it into CSV files.
3. Uploading the generated CSV files to a specified AWS S3 bucket.

- Dependencies:

- Quarkus framework for building the application.
- Oracle JDBC driver for database connectivity.
- AWS SDK for Java for interacting with AWS S3.
- Apache Commons CSV or similar library for CSV file creation.

- Usage:

- Configure the Oracle database connection details and AWS S3 credentials in
the application properties.
- Invoke the appropriate methods to fetch data, generate CSV files, and upload
them to S3.

- Note:
- Ensure that the necessary permissions are granted for accessing the Oracle
database and AWS S3 bucket.
- Handle exceptions and errors appropriately to ensure robust and reliable
operation.

# Backend EL

### IAM User

https://developer.gov.bc.ca/docs/default/component/public-cloud-techdocs/aws/design-build-and-deploy-an-application/iam-user-service/
39 changes: 39 additions & 0 deletions backend-el/get_certs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

#check for environment variables
if [ -z "$DB_HOST" ]; then
echo "DB_HOST is not set"
exit 1
fi
if [ -z "$DB_PORT" ]; then
echo "DB_PORT is not set"
exit 1
fi
cert_folder="/app/cert"
cert_file="jssecacerts"
certSecret=$CERT_SECRET
echo "The certSecret is $certSecret"
mkdir -p $cert_folder
#The DB_SECRET is a secret that you have to set in the environment variables of the container, it is stored in github secrets and created manually and is not linked to the Database credentials.
generate_cert() {

echo "I will try to get the ${DB_HOST}-1 cert"
echo "Connecting to ${DB_HOST}:${DB_PORT}"

openssl s_client -connect "${DB_HOST}:${DB_PORT}" -showcerts </dev/null | openssl x509 -outform pem >"$cert_folder/${DB_HOST}.pem" || exit 1
openssl x509 -outform der -in "$cert_folder/${DB_HOST}.pem" -out "$cert_folder/${DB_HOST}.der" || exit 1
keytool -import -alias "${DB_HOST}" -keystore $cert_folder/$cert_file -file "$cert_folder/${DB_HOST}.der" -storepass "${certSecret}" -noprompt || exit 1

echo "Generated $cert_file and copied it to $cert_folder."
}

if [ "$(ls -A $cert_folder)" ]; then
echo "The $cert_folder folder is not empty."
if [ -e "$cert_folder/$cert_file" ]; then
echo "The "$cert_folder/$cert_file" certificate file is present."
else
generate_cert
fi
else
generate_cert
fi
Loading
Loading