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

Feature/notify 12 log dating #57

Merged
merged 3 commits into from
Aug 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ lerna-debug.log*

# NotifyBC
**/*.local.*
!/helm/values.local.yaml
/server/database/**
!/server/database/.keep
/server/certs/**
Expand Down
10 changes: 10 additions & 0 deletions helm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@
3. Move the new `.tgz` file to the `docs/` directory (`mv notify-bc-[version].tgz ../docs/helm`).
4. Update `docs/helm/index.yaml` to list the new package (`helm repo index ../docs/helm`).

## Deploying to local Kubernetes cluster (Docker Desktop)
1. Ensure Docker Desktop has Kubernetes enabled (Settings > Kubernetes > Enable Kubernetes).
2. Ensure you are on the `docker-desktop` context (should be the current context when running `kubectl config get-contexts`).
3. From project root, deploy to the Kubernetes cluster using the Helm command `helm install local -f ./helm/values.local.yaml ./helm/`.
- `local` in the example is the release name and can be changed to any name you want.
- `values.local.yaml` is a values file that changes configurations so the deployment will work locally.
- To add any other custom values (to change the image version, for example), add another `-f` flag pointing to your values yaml file.
4. To undo a deployment, run the command `helm delete local`.
- If you used a different release name in the previous step, replace `local` with that release name.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems easy to follow. I like numbered lists with actual commands in them

## Deploying to OpenShift
1. In this example we will be deploying to `dev`, so a file named `values.dev.local.yaml` should exist and contain values specific to the `dev` instance.
1. Run `helm install dev -f platform-specific/openshift.yaml -f values.yaml -f values.dev.local.yaml ./`
Expand Down
12 changes: 12 additions & 0 deletions helm/values.local.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
image:
repository: ghcr.io/bcgov/des-notify-bc
pullPolicy: Always
# Overrides the image tag whose default is the chart appVersion.
tag: 'latest'
fluentbit:
persistence:
# Overrides netapp-file-backup which is only valid in OpenShift.
storageClassName: hostpath
cronJob:
# Overrides netapp-file-backup which is only valid in OpenShift.
storageClassName: hostpath
25 changes: 18 additions & 7 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,25 @@ fluentbit:
service: ""
inputs: |
[INPUT]
Name tail
Path /tmp/logs/*.log
Tag app.access.log
Mem_Buf_Limit 5MB
Name tail
Path /tmp/logs/*.log

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why all the whitespace changes?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought it would be easier to read if the values were aligned with each other.

Tag app.access.log
Mem_Buf_Limit 5MB
Skip_Long_Lines Off
filters: ""
filters: |
[FILTER]
Name Lua
Match *
call append_tag
code function append_tag(tag, timestamp, record) new_record = record new_record["datestamp"] = os.date("%Y%m%d", timestamp) return 1, timestamp, new_record end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool - Lua code!

seems to be appending a tag to each record containing a datestamp.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. It's pretty hacky but I'm just wanting to finish this thing up even if it isn't done in the best way.


[FILTER]
Name rewrite_tag
Match app.access.log
Rule $datestamp ^(.*)$ $datestamp.app.access.log false
Emitter_Name re_emitted
outputs: |
[OUTPUT]
Name file
Name file
Match *
Path /tmp/pvc/
Path /tmp/pvc/
Loading