Skip to content

Commit

Permalink
feat: remove all postgres and add oracle (#222)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Roberts <derek.roberts@gmail.com>
  • Loading branch information
Ricardo Campos and DerekRoberts authored Jan 25, 2024
1 parent 74093c7 commit e112bb4
Show file tree
Hide file tree
Showing 17 changed files with 442 additions and 331 deletions.
16 changes: 7 additions & 9 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ jobs:
-p AWS_KINESIS_ROLE_ARN='${{ secrets.AWS_KINESIS_ROLE_ARN }}'
-p AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
-p AWS_ACCESS_KEY_SECRET='${{ secrets.AWS_ACCESS_KEY_SECRET }}'
-p ORACLE_DB_USER=${{ secrets.DB_USER }}
-p ORACLE_DB_PASSWORD='${{ secrets.DB_PASSWORD }}'

deploys-test:
name: TEST Deployments
Expand All @@ -63,11 +65,8 @@ jobs:
issues: write
strategy:
matrix:
name: [database, backend, frontend, fluentbit]
name: [backend, frontend, fluentbit]
include:
- name: database
overwrite: false
file: database/openshift.deploy.yml
- name: backend
verification_path: actuator/health
file: backend/openshift.deploy.yml
Expand Down Expand Up @@ -115,6 +114,8 @@ jobs:
-p AWS_KINESIS_ROLE_ARN='${{ secrets.AWS_KINESIS_ROLE_ARN }}'
-p AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
-p AWS_ACCESS_KEY_SECRET='${{ secrets.AWS_ACCESS_KEY_SECRET }}'
-p ORACLE_DB_USER=${{ secrets.DB_USER }}
-p ORACLE_DB_PASSWORD='${{ secrets.DB_PASSWORD }}'

image-promotions:
name: Promote images to PROD
Expand All @@ -124,7 +125,7 @@ jobs:
packages: write
strategy:
matrix:
component: [database, backend, frontend]
component: [backend, frontend]
steps:
- uses: shrink/actions-docker-registry-tag@v3
with:
Expand All @@ -140,11 +141,8 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
name: [database, backend, frontend, fluentbit]
name: [backend, frontend, fluentbit]
include:
- name: database
overwrite: false
file: database/openshift.deploy.yml
- name: backend
verification_path: actuator/health
file: backend/openshift.deploy.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
package: [database, backend, frontend]
package: [backend, frontend]
permissions:
packages: write
steps:
Expand Down
35 changes: 14 additions & 21 deletions .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
steps:
- name: Get PR Number Mod 50
id: route
run: |
echo "route=$(( ${{ github.event.number }} % 50 ))" >> $GITHUB_OUTPUT
echo "route=$(( ${{ github.event.number }} % 50 ))"
run: echo "route=$(( ${{ github.event.number }} % 50 ))" >> $GITHUB_OUTPUT

- name: PR Greeting
env:
Expand All @@ -38,7 +36,8 @@ jobs:
Thanks for the PR!
Any successful deployments (not always required) will be available below.
[Backend](https://${{ github.event.repository.name }}-${{ github.event.number }}-backend.${{ env.DOMAIN }}/actuator/health)
Deployment number, if any: ${{ steps.route.outputs.route }}
[Backend](https://${{ github.event.repository.name }}-${{ steps.route.outputs.route }}-backend.${{ env.DOMAIN }}/actuator/health)
[Frontend](https://${{ github.event.repository.name }}-${{ steps.route.outputs.route }}-frontend.${{ env.DOMAIN }})
Once merged, code will be promoted and handed off to following workflow run.
Expand All @@ -53,13 +52,15 @@ jobs:
file: common/openshift.init.yml
overwrite: false
parameters:
-p ZONE=${{ github.event.number }}
-p ZONE=${{ steps.route.outputs.route }}
-p NAME=${{ github.event.repository.name }}
-p AWS_KINESIS_STREAM='${{ secrets.AWS_KINESIS_STREAM }}'
-p AWS_KINESIS_ROLE_ARN='${{ secrets.AWS_KINESIS_ROLE_ARN }}'
-p AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}
-p AWS_ACCESS_KEY_SECRET='${{ secrets.AWS_ACCESS_KEY_SECRET }}'
triggers: ('common/' 'database/' 'backend/' 'frontend/')
-p ORACLE_DB_USER=${{ secrets.DB_USER }}
-p ORACLE_DB_PASSWORD='${{ secrets.DB_PASSWORD }}'
triggers: ('common/' 'backend/' 'frontend/')

builds:
name: Builds
Expand All @@ -70,10 +71,8 @@ jobs:
packages: write
strategy:
matrix:
name: [database, backend, frontend]
name: [backend, frontend]
include:
- package: database
triggers: ('database/')
- name: backend
triggers: ('backend/')
- name: frontend
Expand All @@ -83,7 +82,7 @@ jobs:
- uses: bcgov-nr/action-builder-ghcr@v2.0.1
with:
package: ${{ matrix.name }}
tag: ${{ github.event.number }}
tag: ${{ needs.init.outputs.route }}
tag_fallback: test
token: ${{ secrets.GITHUB_TOKEN }}
triggers: ${{ matrix.triggers }}
Expand All @@ -95,24 +94,18 @@ jobs:
runs-on: ubuntu-22.04
strategy:
matrix:
name: [database, backend, frontend, fluentbit]
name: [backend, frontend, fluentbit]
include:
- name: database
file: database/openshift.deploy.yml
parameters:
-p DB_PVC_SIZE=128Mi
overwrite: false
triggers: ('common/' 'database/' 'backend/' 'frontend/')
- name: backend
file: backend/openshift.deploy.yml
triggers: ('common/' 'database/' 'backend/' 'frontend/')
triggers: ('common/' 'backend/' 'frontend/')
verification_path: /actuator/health
parameters:
-p MIN_REPLICAS=1
-p MAX_REPLICAS=2
- name: frontend
file: frontend/openshift.deploy.yml
triggers: ('common/' 'database/' 'backend/' 'frontend/')
triggers: ('common/' 'backend/' 'frontend/')
parameters:
-p VITE_USER_POOLS_WEB_CLIENT_ID=${{ vars.VITE_USER_POOLS_WEB_CLIENT_ID }}
-p MIN_REPLICAS=1
Expand All @@ -121,7 +114,7 @@ jobs:
- name: fluentbit
file: common/openshift.fluentbit.yml
overwrite: true
triggers: ('common/' 'database/' 'backend/' 'frontend/')
triggers: ('common/' 'backend/' 'frontend/')
steps:
- uses: bcgov-nr/action-deployer-openshift@v2.0.0
with:
Expand All @@ -131,7 +124,7 @@ jobs:
oc_token: ${{ secrets.OC_TOKEN }}
overwrite: true
parameters:
-p ZONE=${{ github.event.number }}
-p ZONE=${{ needs.init.outputs.route }}
-p NAME=${{ github.event.repository.name }}
${{ matrix.parameters }}
triggers: ${{ matrix.triggers }}
Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,8 @@ test-report.xml
.Trashes
ehthumbs.db
Thumbs.db

# oracle certs
*.der
*.pem
backend/jssecacerts
20 changes: 13 additions & 7 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,28 @@ WORKDIR /app
COPY pom.xml mvnw ./
COPY src ./src
COPY .mvn/ ./.mvn
COPY InstallCert.java .

# Build
RUN ./mvnw package -Pnative -DskipTests
RUN ./mvnw package -Pnative -DskipTests -Dskip.unit.tests=true -Dspring-boot.run.profiles=prod && \
javac InstallCert.java

### Deployer
FROM gcr.io/distroless/java-base:nonroot AS deploy
ARG PORT=8080
FROM eclipse-temurin:17.0.9_9-jdk-jammy AS deploy

# Copy
WORKDIR /app
COPY --from=build /app/target/results ./results
COPY --from=build /app/target/*.jar /app/*.class ./artifacts/
COPY dockerfile-entrypoint.sh ./
RUN mkdir config dump public && \
chmod -R g+w . && \
chmod g+x dockerfile-entrypoint.sh && \
chmod g+w ${JAVA_HOME}/lib/security/cacerts

# Port and health check
USER 1001
EXPOSE ${PORT}
HEALTHCHECK CMD curl -f http://localhost:${PORT}/actuator/health | grep '"status":"UP"'
EXPOSE 8080
HEALTHCHECK CMD curl -f http://localhost:8080/actuator/health | grep '"status":"UP"'

# Startup
ENTRYPOINT ["/app/results"]
ENTRYPOINT ["/app/dockerfile-entrypoint.sh"]
Loading

0 comments on commit e112bb4

Please sign in to comment.