-
-
Notifications
You must be signed in to change notification settings - Fork 659
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: replace current logging solution with log server (#1381)
* feat: add log server * feat(runtimes&server): adapt to log server * chore(build): add helm template for log-server * feat(log-server): health check * refactor(server): fetch function logs from log server * chore(docs): tidy docs for function log * chore: clean code * chore(ci): dockerize log server * fix(server): replace db in FunctionConsole.write * feat: verify appid for log server * chore(runtimes): restart app when file changes * chore: adjust env and region conf for supporting log server * refactor(server): get logs from log server
- Loading branch information
Showing
40 changed files
with
3,204 additions
and
137 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: dockerize-log-server | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- "services/log-server/**" | ||
- ".github/workflows/dockerize-log-server.yml" | ||
- "!**/*.md" | ||
- "!services/log-server/package-lock.json" | ||
|
||
concurrency: | ||
group: dockerize-log-server-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
dockerize-log-server: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Docker meta | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
ghcr.io/${{ github.repository_owner }}/log-server | ||
docker.io/${{ secrets.DOCKER_USERNAME }}/log-server | ||
# https://github.com/docker/metadata-action#typesemver | ||
tags: | | ||
type=raw,value=latest,enable=true | ||
type=sha,enable=true,format=short | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Login to Github Container Hub | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: ./services/log-server | ||
file: ./services/log-server/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
platforms: linux/amd64, linux/arm64 | ||
|
||
trigger-workflow-build-cluster-image: | ||
needs: [dockerize-log-server] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: trigger cluster image workflow | ||
uses: peter-evans/repository-dispatch@v2 | ||
with: | ||
event-type: docker_build_success | ||
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "version": "latest"}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
charts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
labels: | ||
{{- include "log-server.labels" . | nindent 4 }} | ||
name: log-server | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
{{- include "log-server.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "log-server.selectorLabels" . | nindent 8 }} | ||
spec: | ||
containers: | ||
- image: docker.io/lafyun/log-server:latest | ||
imagePullPolicy: Always | ||
name: log-server | ||
ports: | ||
- name: http | ||
containerPort: 5060 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: /healthz | ||
port: http | ||
env: | ||
- name: DB_URI | ||
value: {{ .Values.default_region.log_server_database_url | quote }} | ||
- name: JWT_SECRET | ||
value: {{ .Values.default_region.log_server_secret | quote }} | ||
--- | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
labels: | ||
{{- include "log-server.labels" . | nindent 4 }} | ||
name: log-server | ||
spec: | ||
ports: | ||
- name: http | ||
port: 5060 | ||
protocol: TCP | ||
targetPort: http | ||
selector: | ||
{{- include "log-server.selectorLabels" . | nindent 4 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.