Skip to content

Commit

Permalink
feat(ci): drop fluentbit (#1372)
Browse files Browse the repository at this point in the history
Co-authored-by: Ricardo Campos <[email protected]>
  • Loading branch information
DerekRoberts and Ricardo Campos authored Jul 10, 2024
1 parent 02231e8 commit fd7423d
Show file tree
Hide file tree
Showing 12 changed files with 29 additions and 519 deletions.
25 changes: 1 addition & 24 deletions .github/workflows/.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ on:
default: false
required: false
type: boolean
fluentbit_target:
description: FluentBit target; usually development, test or production
default: development
required: false
type: string
tag:
description: Container tag; usually PR number
default: ${{ github.event.number }}
Expand Down Expand Up @@ -74,22 +69,6 @@ jobs:
-p ORACLE_SYNC_USER='${{ vars.ORACLE_SYNC_USER }}'
-p ORACLE_SYNC_PASSWORD='${{ secrets.ORACLE_SYNC_PASSWORD }}'

- name: FluentBit
if: inputs.fluentbit_target != 'development'
uses: bcgov-nr/[email protected]
with:
oc_namespace: ${{ vars.OC_NAMESPACE }}
oc_server: ${{ vars.OC_SERVER }}
oc_token: ${{ secrets.OC_TOKEN }}
file: common/openshift.fluentbit.yml
overwrite: true
parameters:
-p ZONE=${{ inputs.target }}
-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 }}'

database:
name: Deploy (database)
environment: ${{ inputs.environment }}
Expand Down Expand Up @@ -126,8 +105,7 @@ jobs:
overwrite: true
parameters:
-p AWS_COGNITO_ISSUER_URI=https://cognito-idp.${{ vars.AWS_REGION }}.amazonaws.com/${{ vars.VITE_USER_POOLS_ID }}
-p OPENSEARCH_ENV=${{ inputs.fluentbit_target == 'prod' && 'production' || inputs.fluentbit_target }}
verification_path: "actuator/health"
verification_path: "health"
- name: frontend
file: frontend/openshift.deploy.yml
overwrite: true
Expand All @@ -141,7 +119,6 @@ jobs:
overwrite: true
parameters:
-p AWS_COGNITO_ISSUER_URI=https://cognito-idp.${{ vars.AWS_REGION }}.amazonaws.com/${{ vars.VITE_USER_POOLS_ID }}
-p OPENSEARCH_ENV=${{ inputs.fluentbit_target == 'prod' && 'production' || inputs.fluentbit_target }}
verification_path: "actuator/health"
- name: sync
file: sync/openshift.deploy.yml
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ jobs:
environment: test
tag: ${{ inputs.tag || needs.init.outputs.pr }}
target: test
fluentbit_target: test

deploy-prod:
name: PROD
Expand All @@ -52,4 +51,3 @@ jobs:
environment: prod
tag: ${{ inputs.tag || needs.init.outputs.pr }}
target: prod
fluentbit_target: production
2 changes: 1 addition & 1 deletion backend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Run (from the project root):
docker-compose up database -d
```

Then head to http://localhost:8090/actuator/health to check if the service was successfully launched:
Then head to http://localhost:8090/health to check if the service was successfully launched:
the first `status` property should have the value **UP**.

Before writing your first line of code, and learn more about the checks, including
Expand Down
7 changes: 0 additions & 7 deletions backend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ objects:
- name: ${NAME}-${ZONE}
image: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
imagePullPolicy: Always
volumeMounts:
- name: ${NAME}-${ZONE}-fluentbit-logs
mountPath: /logs
env:
- name: NR_SPAR_BACKEND_VERSION
value: ${REGISTRY}/${ORG}/${NAME}/${COMPONENT}:${TAG}
Expand Down Expand Up @@ -158,10 +155,6 @@ objects:
tcpSocket:
port: container-port
failureThreshold: 45
volumes:
- name: ${NAME}-${ZONE}-fluentbit-logs
persistentVolumeClaim:
claimName: ${NAME}-${ZONE}-fluentbit-logs
- apiVersion: v1
kind: Service
metadata:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package ca.bc.gov.backendstartapi.config;

import io.micrometer.core.aop.TimedAspect;
import io.micrometer.core.instrument.Meter;
import io.micrometer.core.instrument.MeterRegistry;
import io.micrometer.core.instrument.config.MeterFilter;
import io.micrometer.core.instrument.distribution.DistributionStatisticConfig;
import io.micrometer.prometheusmetrics.PrometheusMeterRegistry;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.actuate.autoconfigure.metrics.MeterRegistryCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


/** This class holds configurations for Prometheus metrics. */
@Configuration
public class SparMetricsConfig {

Expand All @@ -29,15 +27,21 @@ public TimedAspect timedAspect(MeterRegistry registry) {
return new TimedAspect(registry);
}

/**
* Creates a bean for the metrics common tags.
*
* @return MeterRegistryCustomizer
*/
@Bean
public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
return registry -> registry.config()
.commonTags(
"version", appVersion,
"app", appName,
"zone",appZone
)
.meterFilter(ignoreTag());
return registry ->
registry
.config()
.commonTags(
"version", appVersion,
"app", appName,
"zone", appZone)
.meterFilter(ignoreTag());
}

@Bean
Expand All @@ -48,6 +52,4 @@ public MeterRegistryCustomizer<PrometheusMeterRegistry> prometheusConfiguration(
public MeterFilter ignoreTag() {
return MeterFilter.ignoreTags("type");
}


}
}
8 changes: 5 additions & 3 deletions backend/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ management.endpoints.web.path-mapping.prometheus=metrics
management.endpoints.web.base-path=/
management.endpoints.web.exposure.include=health,info,metrics,otlp,tracing,httptrace,prometheus
management.metrics.export.prometheus.enabled=true
info.app.name=${spring.application.name}
info.app.zone=${APP_ZONE:local}
info.app.version=${app.version}

# App fnfo
info.app.name=${NAME:"nr-spar-backend"}
info.app.zone=${ZONE:"local"}
info.app.version=${TAG:"0.0.0"}
7 changes: 6 additions & 1 deletion backend/src/test/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ oracle-api.base-url = https://nr-spar-test-oracle-api.apps.silver.devops.gov.bc.

# FAM
spring.security.oauth2.resourceserver.jwt.issuer-uri = https://aws-cognito-issuer-uri.aws.com
spring.security.oauth2.resourceserver.jwt.jwk-set-uri = https://aws-cognito-issuer-uri.aws.com/.well-known/jwks.json
spring.security.oauth2.resourceserver.jwt.jwk-set-uri = https://aws-cognito-issuer-uri.aws.com/.well-known/jwks.json

# App info
info.app.name=${NAME:"nr-spar-backend"}
info.app.zone=${ZONE:"local"}
info.app.version=${TAG:"0.0.0"}
Loading

0 comments on commit fd7423d

Please sign in to comment.