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

refactor(log-server): remove old log server #1655

Merged
merged 1 commit into from
Nov 8, 2023
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
76 changes: 0 additions & 76 deletions .github/workflows/dockerize-log-server.yml

This file was deleted.

20 changes: 0 additions & 20 deletions build/charts/laf-server/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "log-server.labels" -}}
helm.sh/chart: {{ include "laf-server.chart" . }}
{{ include "log-server.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Common labels
*/}}
Expand All @@ -74,14 +62,6 @@ app.kubernetes.io/name: {{ include "laf-server.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "log-server.selectorLabels" -}}
app.kubernetes.io/name: log-server
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Selector labels
*/}}
Expand Down
6 changes: 0 additions & 6 deletions build/charts/laf-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,6 @@ spec:
value: {{ .Values.default_region.tls.enabled | quote}}
- name: DEFAULT_REGION_TLS_WILDCARD_CERTIFICATE_SECRET_NAME
value: {{ .Values.default_region.tls.wildcard_certificate_secret_name | quote}}
- name: DEFAULT_REGION_LOG_SERVER_URL
value: {{ .Values.default_region.log_server_url }}
- name: DEFAULT_REGION_LOG_SERVER_SECRET
value: {{ .Values.default_region.log_server_secret }}
- name: DEFAULT_REGION_LOG_SERVER_DATABASE_URL
value: {{ .Values.default_region.log_server_database_url }}
- name: DEFAULT_REGION_PROMETHEUS_URL
value: {{ .Values.default_region.prometheus_url }}
- name: SITE_NAME
Expand Down
52 changes: 0 additions & 52 deletions build/charts/laf-server/templates/log-server.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions build/charts/laf-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ default_region:
wildcard_certificate_secret_name: ""
runtime_domain: ""
website_domain: ""
# log-server
log_server_url: ""
log_server_secret: ""
log_server_database_url: ""
# runtime-exporter
runtime_exporter_secret: ""
# prometheus
Expand Down
6 changes: 0 additions & 6 deletions build/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,6 @@ helm install minio -n ${NAMESPACE} \

## 5. install laf-server
SERVER_JWT_SECRET=$PASSWD_OR_SECRET
LOG_SERVER_URL="http://log-server.${NAMESPACE}.svc.cluster.local:5060"
LOG_SERVER_DATABASE_URL="mongodb://${DB_USERNAME:-admin}:${PASSWD_OR_SECRET}@mongodb-0.mongo.${NAMESPACE}.svc.cluster.local:27017/function-logs?authSource=admin&replicaSet=rs0&w=majority"
LOG_SERVER_SECRET=$PASSWD_OR_SECRET
RUNTIME_EXPORTER_SECRET=$PASSWD_OR_SECRET
helm install server -n ${NAMESPACE} \
--set databaseUrl=${DATABASE_URL} \
Expand All @@ -92,10 +89,7 @@ helm install server -n ${NAMESPACE} \
--set default_region.runtime_domain=${DOMAIN} \
--set default_region.website_domain=${DOMAIN} \
--set default_region.tls.enabled=false \
--set default_region.log_server_url=${LOG_SERVER_URL} \
--set default_region.log_server_secret=${LOG_SERVER_SECRET} \
--set default_region.runtime_exporter_secret=${RUNTIME_EXPORTER_SECRET} \
--set default_region.log_server_database_url=${LOG_SERVER_DATABASE_URL} \
$([ "$ENABLE_MONITOR" = "true" ] && echo "--set default_region.prometheus_url=${PROMETHEUS_URL}") \
./charts/laf-server

Expand Down
12 changes: 0 additions & 12 deletions server/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,18 +147,6 @@ export class ServerConfig {
return process.env.DEFAULT_REGION_MINIO_ROOT_SECRET_KEY
}

static get DEFAULT_REGION_LOG_SERVER_URL() {
return process.env.DEFAULT_REGION_LOG_SERVER_URL
}

static get DEFAULT_REGION_LOG_SERVER_SECRET() {
return process.env.DEFAULT_REGION_LOG_SERVER_SECRET
}

static get DEFAULT_REGION_LOG_SERVER_DATABASE_URL() {
return process.env.DEFAULT_REGION_LOG_SERVER_DATABASE_URL
}

static get DEFAULT_REGION_PROMETHEUS_URL() {
return process.env.DEFAULT_REGION_PROMETHEUS_URL
}
Expand Down
8 changes: 7 additions & 1 deletion server/src/function/function.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class FunctionService {
private readonly functionRecycleBinService: FunctionRecycleBinService,
private readonly httpService: HttpService,
private readonly regionService: RegionService,
) { }
) {}
async create(appid: string, userid: ObjectId, dto: CreateFunctionDto) {
await this.db.collection<CloudFunction>('CloudFunction').insertOne({
appid,
Expand Down Expand Up @@ -364,6 +364,12 @@ export class FunctionService {
},
) {
const region = await this.regionService.findByAppId(appid)
if (!region?.logServerConf?.apiUrl) {
return {
data: [],
total: 0,
}
}

const res = await this.httpService.axiosRef.get(
`${region.logServerConf.apiUrl}/function/log`,
Expand Down
6 changes: 3 additions & 3 deletions server/src/initializer/initializer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ export class InitializerService {
},
},
logServerConf: {
apiUrl: ServerConfig.DEFAULT_REGION_LOG_SERVER_URL,
secret: ServerConfig.DEFAULT_REGION_LOG_SERVER_SECRET,
databaseUrl: ServerConfig.DEFAULT_REGION_LOG_SERVER_DATABASE_URL,
apiUrl: '',
secret: '',
databaseUrl: '',
},
prometheusConf: {
apiUrl: ServerConfig.DEFAULT_REGION_PROMETHEUS_URL,
Expand Down
20 changes: 0 additions & 20 deletions server/src/instance/instance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,19 @@ import { LABEL_KEY_APP_ID, MB } from '../constants'
import { StorageService } from '../storage/storage.service'
import { DatabaseService } from 'src/database/database.service'
import { ClusterService } from 'src/region/cluster/cluster.service'
import { SystemDatabase } from 'src/system-database'
import { ApplicationWithRelations } from 'src/application/entities/application'
import { ApplicationService } from 'src/application/application.service'
import { JwtService } from '@nestjs/jwt'
import * as assert from 'assert'

@Injectable()
export class InstanceService {
private readonly logger = new Logger('InstanceService')
private readonly db = SystemDatabase.db

constructor(
private readonly cluster: ClusterService,
private readonly storageService: StorageService,
private readonly databaseService: DatabaseService,
private readonly applicationService: ApplicationService,
private readonly jwtService: JwtService,
) {}

public async create(appid: string) {
Expand Down Expand Up @@ -111,7 +107,6 @@ export class InstanceService {
}

public async restart(appid: string) {
const labels = this.getRuntimeLabel(appid)
const app = await this.applicationService.findOneUnsafe(appid)
const region = app.region
const { deployment, hpa, service } = await this.get(appid)
Expand Down Expand Up @@ -293,21 +288,6 @@ export class InstanceService {
name: 'RESTART_AT',
value: new Date().getTime().toString(),
},
{
name: 'LOG_SERVER_URL',
value: region.logServerConf.apiUrl,
},
{
name: 'LOG_SERVER_TOKEN',
value: this.jwtService.sign(
{
appid: appid,
},
{
secret: region.logServerConf.secret,
},
),
},
]

// merge env from app configuration, override if exists
Expand Down
3 changes: 0 additions & 3 deletions services/log-server/.dockerignore

This file was deleted.

3 changes: 0 additions & 3 deletions services/log-server/.gitignore

This file was deleted.

5 changes: 0 additions & 5 deletions services/log-server/.prettierrc

This file was deleted.

29 changes: 0 additions & 29 deletions services/log-server/Dockerfile

This file was deleted.

1 change: 0 additions & 1 deletion services/log-server/commitlint.config.js

This file was deleted.

Loading