Skip to content

Commit

Permalink
Merge branch 'main' into testing1
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhatsharma committed May 3, 2022
2 parents eaa50f7 + 6e77d28 commit 96678e0
Show file tree
Hide file tree
Showing 196 changed files with 2,987 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ assignees: ''
**Security disclosures**
If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please email [Prabhat Sharma](mailto:admin+security@zinclabs.io).
If you think you’ve found a potential security issue, please do not post it in the Issues. Instead, please email [Zinc team](mailto:admin+security@zinclabs.io).
-->

Expand Down
28 changes: 14 additions & 14 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ changelog:
- "^test:"
dockers:
- image_templates:
- public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-amd64
- public.ecr.aws/zinclabs/zinc:{{ .Version }}-amd64
use: buildx
skip_push: "false"
build_flag_templates:
Expand All @@ -66,7 +66,7 @@ dockers:
- web
- embed.go
- image_templates:
- public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-arm64
- public.ecr.aws/zinclabs/zinc:{{ .Version }}-arm64
use: buildx
skip_push: "false"
build_flag_templates:
Expand All @@ -82,7 +82,7 @@ dockers:
- web
- embed.go
- image_templates:
- public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-armv7
- public.ecr.aws/zinclabs/zinc:{{ .Version }}-armv7
use: buildx
skip_push: "false"
build_flag_templates:
Expand All @@ -98,7 +98,7 @@ dockers:
- web
- embed.go
- image_templates:
- public.ecr.aws/h9e2j3o7/zinc:latest-amd64
- public.ecr.aws/zinclabs/zinc:latest-amd64
use: buildx
skip_push: "false"
build_flag_templates:
Expand All @@ -114,7 +114,7 @@ dockers:
- web
- embed.go
- image_templates:
- public.ecr.aws/h9e2j3o7/zinc:latest-arm64
- public.ecr.aws/zinclabs/zinc:latest-arm64
use: buildx
skip_push: "false"
build_flag_templates:
Expand All @@ -130,7 +130,7 @@ dockers:
- web
- embed.go
- image_templates:
- public.ecr.aws/h9e2j3o7/zinc:latest-armv7
- public.ecr.aws/zinclabs/zinc:latest-armv7
use: buildx
skip_push: "false"
build_flag_templates:
Expand All @@ -150,26 +150,26 @@ docker_manifests:

# Name template for the manifest.
# Defaults to empty.
name_template: public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}
name_template: public.ecr.aws/zinclabs/zinc:{{ .Version }}

# Image name templates to be added to this manifest.
# Defaults to empty.
image_templates:
- public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-amd64
- public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-arm64
- public.ecr.aws/h9e2j3o7/zinc:{{ .Version }}-armv7
- public.ecr.aws/zinclabs/zinc:{{ .Version }}-amd64
- public.ecr.aws/zinclabs/zinc:{{ .Version }}-arm64
- public.ecr.aws/zinclabs/zinc:{{ .Version }}-armv7
- id: zinc-latest

# Name template for the manifest.
# Defaults to empty.
name_template: public.ecr.aws/h9e2j3o7/zinc:latest
name_template: public.ecr.aws/zinclabs/zinc:latest

# Image name templates to be added to this manifest.
# Defaults to empty.
image_templates:
- public.ecr.aws/h9e2j3o7/zinc:latest-amd64
- public.ecr.aws/h9e2j3o7/zinc:latest-arm64
- public.ecr.aws/h9e2j3o7/zinc:latest-armv7
- public.ecr.aws/zinclabs/zinc:latest-amd64
- public.ecr.aws/zinclabs/zinc:latest-arm64
- public.ecr.aws/zinclabs/zinc:latest-armv7
# https://goreleaser.com/customization/homebrew/
brews:
- name: zinc
Expand Down
13 changes: 13 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2022 Zinc Labs Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
2 changes: 1 addition & 1 deletion buildspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ phases:
commands:

- echo Logging in to Amazon ECR...
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/h9e2j3o7
- aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/zinclabs
# Install AWS CLI
# - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
# - unzip awscliv2.zip
Expand Down
37 changes: 27 additions & 10 deletions cmd/zinc/main.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/* Copyright 2022 Zinc Labs Inc. and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package main

import (
Expand All @@ -20,15 +35,17 @@ import (

func main() {

/******** initialize sentry **********/
err := sentry.Init(sentry.ClientOptions{
Dsn: "https://15b6d9b8be824b44896f32b0234c32b7@o1218932.ingest.sentry.io/6360942",
Release: "zinc@" + v1.Version,
})
if err != nil {
log.Print("sentry.Init: %s", err)
if zutils.GetEnvToBool("ZINC_SENTRY", "true") {
/******** initialize sentry **********/
err := sentry.Init(sentry.ClientOptions{
Dsn: "https://15b6d9b8be824b44896f32b0234c32b7@o1218932.ingest.sentry.io/6360942",
Release: "zinc@" + v1.Version,
})
if err != nil {
log.Print("sentry.Init: %s", err)
}
/******** sentry initialize complete *******/
}
/******** sentry initialize complete *******/

r := gin.New()
// Recovery middleware recovers from any panics and writes a 500 if there was one.
Expand All @@ -51,7 +68,7 @@ func main() {
ctx, cancel := context.WithTimeout(context.Background(), time.Second*60)
defer cancel()
if err := server.Shutdown(ctx); err != nil {
log.Fatal().Msgf("Server Shutdown:", err)
log.Fatal().Msgf("Server Shutdown: %s", err.Error())
}
} else {
server.Close()
Expand All @@ -62,7 +79,7 @@ func main() {
if err == http.ErrServerClosed {
log.Info().Msgf("Server closed under request")
} else {
log.Fatal().Msgf("Server closed unexpect")
log.Fatal().Msgf("Server closed unexpect: %s", err.Error())
}
}

Expand Down
15 changes: 15 additions & 0 deletions embed.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/* Copyright 2022 Zinc Labs Inc. and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package zinc

import (
Expand Down
15 changes: 15 additions & 0 deletions embed_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
/* Copyright 2022 Zinc Labs Inc. and Contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package zinc

import (
Expand Down
5 changes: 1 addition & 4 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/zinclabs/zinc

go 1.18
go 1.17

require (
github.com/aws/aws-sdk-go-v2/config v1.11.0
Expand Down Expand Up @@ -62,14 +62,12 @@ require (
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/go-cmp v0.5.7 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/jtolds/gls v4.20.0+incompatible // indirect
github.com/klauspost/compress v1.13.5 // indirect
github.com/klauspost/cpuid v1.3.1 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/mattn/go-isatty v0.0.14 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.1 // indirect
Expand All @@ -87,7 +85,6 @@ require (
github.com/segmentio/backo-go v1.0.0 // indirect
github.com/sirupsen/logrus v1.8.1 // indirect
github.com/smartystreets/assertions v1.2.0 // indirect
github.com/stretchr/testify v1.6.1 // indirect
github.com/tklauser/go-sysconf v0.3.9 // indirect
github.com/tklauser/numcpus v0.3.0 // indirect
github.com/ugorji/go/codec v1.1.7 // indirect
Expand Down
2 changes: 1 addition & 1 deletion helm/zinc/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Declare variables to be passed into your templates.

image:
repository: public.ecr.aws/prabhat/zinc
repository: public.ecr.aws/h9e2j3o7/zinc
pullPolicy: IfNotPresent
# Overrides the image tag whose default is the chart appVersion.
tag: "latest"
Expand Down
116 changes: 116 additions & 0 deletions k8s/ingest-fluent-bit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: fluent-bit-config
namespace: logging
labels:
k8s-app: fluent-bit
data:
# Configuration files: server, input, filters and output
# ======================================================
fluent-bit.conf: |
[SERVICE]
Flush 1
Log_Level info
Daemon off
Parsers_File parsers.conf
HTTP_Server On
HTTP_Listen 0.0.0.0
HTTP_Port 2020
@INCLUDE input-kubernetes.conf
@INCLUDE filter-kubernetes.conf
@INCLUDE output-elasticsearch.conf
input-kubernetes.conf: |
[INPUT]
Name tail
Tag kube.*
Path /var/log/containers/*.log
Parser docker
DB /var/log/flb_kube.db
Mem_Buf_Limit 5MB
Skip_Long_Lines On
Refresh_Interval 10
filter-kubernetes.conf: |
[FILTER]
Name kubernetes
Match kube.*
Kube_URL https://kubernetes.default.svc:443
Kube_CA_File /var/run/secrets/kubernetes.io/serviceaccount/ca.crt
Kube_Token_File /var/run/secrets/kubernetes.io/serviceaccount/token
Kube_Tag_Prefix kube.var.log.containers.
Merge_Log On
Merge_Log_Key log_processed
K8S-Logging.Parser On
K8S-Logging.Exclude Off
output-elasticsearch.conf: |
[OUTPUT]
Name es
Match *
Path /es
Host z.zinc.svc.cluster.local
Port 4080
Generate_ID On
HTTP_User admin
HTTP_Passwd Complexpass#123
Logstash_Format On
Logstash_Prefix k8s-logs
Logstash_DateFormat %Y.%m.%d
parsers.conf: |
[PARSER]
Name apache
Format regex
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name apache2
Format regex
Regex ^(?<host>[^ ]*) [^ ]* (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^ ]*) +\S*)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name apache_error
Format regex
Regex ^\[[^ ]* (?<time>[^\]]*)\] \[(?<level>[^\]]*)\](?: \[pid (?<pid>[^\]]*)\])?( \[client (?<client>[^\]]*)\])? (?<message>.*)$
[PARSER]
Name nginx
Format regex
Regex ^(?<remote>[^ ]*) (?<host>[^ ]*) (?<user>[^ ]*) \[(?<time>[^\]]*)\] "(?<method>\S+)(?: +(?<path>[^\"]*?)(?: +\S*)?)?" (?<code>[^ ]*) (?<size>[^ ]*)(?: "(?<referer>[^\"]*)" "(?<agent>[^\"]*)")?$
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name json
Format json
Time_Key time
Time_Format %d/%b/%Y:%H:%M:%S %z
[PARSER]
Name docker
Format json
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L
Time_Keep On
[PARSER]
# http://rubular.com/r/tjUt3Awgg4
Name cri
Format regex
Regex ^(?<time>[^ ]+) (?<stream>stdout|stderr) (?<logtag>[^ ]*) (?<message>.*)$
Time_Key time
Time_Format %Y-%m-%dT%H:%M:%S.%L%z
[PARSER]
Name syslog
Format regex
Regex ^\<(?<pri>[0-9]+)\>(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$
Time_Key time
Time_Format %b %d %H:%M:%S
2 changes: 1 addition & 1 deletion k8s/kube-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ spec:
# terminationGracePeriodSeconds: 0
containers:
- name: zinc
image: public.ecr.aws/h9e2j3o7/zinc:latest
image: public.ecr.aws/zinclabs/zinc:latest
env:
- name: ZINC_FIRST_ADMIN_USER
value: admin
Expand Down

0 comments on commit 96678e0

Please sign in to comment.