Skip to content

Commit

Permalink
feat: side car
Browse files Browse the repository at this point in the history
  • Loading branch information
liaosunny123 committed Sep 3, 2023
1 parent ac18edc commit 0326bda
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 29 deletions.
78 changes: 51 additions & 27 deletions manifests-endymx/deployment-auth-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,32 +22,56 @@ spec:
dream-unit: gugotik-auth-service
spec:
imagePullSecrets:
- name: regcred
- name: regcred
containers:
- image: ${IMAGE}
imagePullPolicy: IfNotPresent
name: gugotik-auth-service
command:
- ./services/auth/AuthService
envFrom:
- configMapRef:
name: env-config
- configMapRef:
name: gugotik-env
- secretRef:
name: gugotik-secret
ports:
- name: grpc-37001
containerPort: 37001
protocol: TCP
- name: metrics-37099
containerPort: 37099
protocol: TCP
resources:
limits:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 100m
memory: 128Mi
- image: ${IMAGE}
imagePullPolicy: IfNotPresent
name: gugotik-auth-service
command:
- ./services/auth/AuthService
envFrom:
- configMapRef:
name: env-config
- configMapRef:
name: gugotik-env
- secretRef:
name: gugotik-secret
ports:
- name: grpc-37001
containerPort: 37001
protocol: TCP
- name: metrics-37099
containerPort: 37099
protocol: TCP
volumeMounts:
- mountPath: /var/log/gugotik
name: log-volume
resources:
limits:
cpu: 2000m
memory: 2048Mi
requests:
cpu: 100m
memory: 128Mi
- name: logger
image: fluent/fluent-bit:1.8.4
imagePullPolicy: IfNotPresent
resources:
requests:
cpu: 20m
memory: 100Mi
limits:
cpu: 100m
memory: 200Mi
volumeMounts:
- mountPath: /fluent-bit/etc
name: gugotik-log-config
- mountPath: /var/log/gugotik
name: log-volume
volumes:
- name: config
configMap:
name: fluentbit-config
- name: log-volume
emptyDir: { }
terminationGracePeriodSeconds: 30
10 changes: 8 additions & 2 deletions src/utils/logging/logging.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"go.opentelemetry.io/otel/trace"
"io"
"os"
"path"
)

var hostname string
Expand All @@ -31,8 +32,13 @@ func init() {
log.SetLevel(log.TraceLevel)
}

logFile := "log.txt"
f, err := os.OpenFile(logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
filePath := path.Join("var", "log", "gugotik", "gugotik.log")
dir := path.Dir(filePath)
if err := os.MkdirAll(dir, os.FileMode(0755)); err != nil {
panic(err)
}

f, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0644)
if err != nil {
panic(err)
}
Expand Down

0 comments on commit 0326bda

Please sign in to comment.