slaventius@odnookno.info 2 years ago
commit eedb8c0ef5
  1. 4
      .vscode/extensions.json
  2. 6
      .vscode/launch.json
  3. 51
      .vscode/tasks.json
  4. 4
      README.md
  5. 25
      build/Makefile
  6. 2
      deploy/.pre/auth-db-config.yaml
  7. 16
      deploy/.pre/auth-db-deployment.yaml
  8. 7
      deploy/.pre/auth-db-secret.yaml
  9. 0
      deploy/.pre/auth-db-service.yaml
  10. 6
      deploy/helm/Chart.yaml
  11. 8
      deploy/helm/templates/config.yaml
  12. 41
      deploy/helm/templates/deployment.yaml
  13. 7
      deploy/helm/templates/secret.yaml
  14. 14
      deploy/helm/templates/service.yaml
  15. 3
      deploy/helm/values.yaml
  16. 3
      deploy/redpanda/docker-compose.yaml
  17. 12
      scripts/start.sh

@ -1,5 +1,3 @@
{ {
"recommendations": [ "recommendations": ["johnpapa.vscode-peacock"]
"johnpapa.vscode-peacock"
]
} }

@ -11,9 +11,9 @@
"mode": "debug", "mode": "debug",
"program": "${workspaceRoot}/cmd/main.go", "program": "${workspaceRoot}/cmd/main.go",
"env": { "env": {
"APP_PORT":"9995", "APP_PORT": "9995",
"KAFKA_PORT":"9092", "KAFKA_PORT": "9092",
"KAFKA_HOST":"37.143.12.169", "KAFKA_HOST": "37.143.12.169",
"SENTRY_DSN": "https://3f4b31dbbd9a4a6b8a71f9881d962f25@o4504654569799680.ingest.sentry.io/4504654572683264" "SENTRY_DSN": "https://3f4b31dbbd9a4a6b8a71f9881d962f25@o4504654569799680.ingest.sentry.io/4504654572683264"
}, },
"args": [] "args": []

51
.vscode/tasks.json vendored

@ -1,10 +1,8 @@
{ {
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "build linux", "label": "build",
"type": "shell", "type": "shell",
"group": { "group": {
"kind": "build", "kind": "build",
@ -17,22 +15,24 @@
"options": { "options": {
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"env": { "env": {
"APP": "pakitara", "APP": "authDBService",
// "GOOS": "${env:GOOS}",
// "GOARCH": "${env:GOARCH}",
"GOOS": "linux", "GOOS": "linux",
"GOARCH": "amd64", "GOARCH": "amd64",
"GOBIN": "${env:GOPATH}/bin" "GOBIN": "${env:GOPATH}/bin"
}, },
"args": [ "args": ["ldflags '-s -w'"]
"ldflags '-s -w'"
]
}, },
"command": "go build -o $GOBIN/$APP-$GOOS-$GOARCH -ldflags \"-s -w\" $APP.go", "command": "go build -o $GOBIN/$APP-$GOOS-$GOARCH -ldflags \"-s -w\" ./cmd/main.go",
"problemMatcher": [] "problemMatcher": []
}, },
{ {
"label": "build windows", "label": "docker-build",
"type": "shell", "type": "shell",
"group": "build", "group": {
"kind": "build"
},
"presentation": { "presentation": {
"echo": true, "echo": true,
"panel": "new" "panel": "new"
@ -40,16 +40,31 @@
"options": { "options": {
"cwd": "${workspaceRoot}", "cwd": "${workspaceRoot}",
"env": { "env": {
"APP": "pakitara", "TAG": "slaventius/test3k_auth_db:latest"
"GOOS": "windows",
"GOARCH": "amd64",
"GOBIN": "${env:GOPATH}/bin"
}, },
"args": [ "args": ["--no-cache", "--tag $TAG"]
"ldflags '-s -w'" },
] "command": "sudo docker build --no-cache --tag $TAG ./build/",
"problemMatcher": []
},
{
"label": "docker-push",
"type": "shell",
"group": {
"kind": "build"
},
"presentation": {
"echo": true,
"panel": "new"
}, },
"command": "go build -o $GOBIN\\$APP-$GOOS-$GOARCH.exe -ldflags \"-s -w\" $APP.go" "options": {
"cwd": "${workspaceRoot}",
"env": {
"TAG": "slaventius/test3k_auth_db:latest"
}
},
"command": "sudo docker push $TAG",
"problemMatcher": []
} }
] ]
} }

@ -1,5 +1 @@
# authDB # authDB
* http://git.slaventius.ru/test3k/authDB.git
* docker build --no-cache --tag slaventius/test3k_auth_db:latest ./deploy/
* docker push slaventius/test3k_auth_db:latest

@ -0,0 +1,25 @@
.DEFAULT_GOAL := build
GOOS=$(shell go env GOOS)
GOARCH=$(shell go env GOARCH)
GOBIN=$(shell go env GOPATH)/bin
APP=authDBService
APP_BINARY=${GOBIN}/${APP}-${GOOS}-${GOARCH}
APP_TAG=slaventius/test3k_auth_db:latest
clean:
@echo "cleaning ${APP_BINARY}"
@go clean
@rm -f ${APP_BINARY}
build: clean
@echo "building ${APP_BINARY}"
@go build -o ${APP_BINARY} -ldflags "-s -w" ../cmd/main.go
docker-build:
@echo "building docker-image ${APP_TAG}"
@sudo docker build --no-cache --tag ${APP_TAG} .
docker-push: docker-build
@echo "pushing docker-image ${APP_TAG}"
@sudo docker push ${APP_TAG}

@ -4,5 +4,5 @@ metadata:
name: auth-db-config name: auth-db-config
data: data:
KAFKA_HOST: "37.143.12.169" KAFKA_HOST: "37.143.12.169"
KAFKA_PORT: "9092" KAFKA_PORT: "19092"
APP_PORT: "9995" APP_PORT: "9995"

@ -21,5 +21,21 @@ spec:
ports: ports:
- containerPort: 9995 - containerPort: 9995
envFrom: envFrom:
- secretRef:
name: auth-db-secret
- configMapRef: - configMapRef:
name: auth-db-config name: auth-db-config
# livenessProbe:
# grpc:
# port: 9995
# periodSeconds: 1
# initialDelaySeconds: 2
# failureThreshold: 3
# successThreshold: 1
# readinessProbe:
# grpc:
# port: 9995
# periodSeconds: 1
# initialDelaySeconds: 4
# failureThreshold: 3
# successThreshold: 1

@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: auth-db-secret
type: Opaque
data:
SENTRY_DSN: aHR0cHM6Ly8zZjRiMzFkYmJkOWE0YTZiOGE3MWY5ODgxZDk2MmYyNUBvNDUwNDY1NDU2OTc5OTY4MC5pbmdlc3Quc2VudHJ5LmlvLzQ1MDQ2NTQ1NzI2ODMyNjQ=

@ -0,0 +1,6 @@
apiVersion: v2
name: auth-db-HelmChart
description: Helm Chart for auth-db
type: application
version: 0.1.0
appVersion: "1.0.0"

@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
data:
KAFKA_HOST: "37.143.12.169"
KAFKA_PORT: "19092"
APP_PORT: "9995"

@ -0,0 +1,41 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Release.Name }}-application
labels:
app: {{ .Release.Name }}-application
spec:
replicas: 1
selector:
matchLabels:
app: {{ .Release.Name }}-application
template:
metadata:
labels:
app: {{ .Release.Name }}-application
spec:
containers:
- name: {{ .Release.Name }}-application
image: {{ .Values.container.image }}
imagePullPolicy: Always
ports:
- containerPort: {{ .Values.container.port }}
envFrom:
- secretRef:
name: {{ .Release.Name }}-secret
- configMapRef:
name: {{ .Release.Name }}-config
# livenessProbe:
# grpc:
# port: {{ .Values.container.port }}
# periodSeconds: 1
# initialDelaySeconds: 2
# failureThreshold: 3
# successThreshold: 1
# readinessProbe:
# grpc:
# port: {{ .Values.container.port }}
# periodSeconds: 1
# initialDelaySeconds: 4
# failureThreshold: 3
# successThreshold: 1

@ -0,0 +1,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{ .Release.Name }}-secret
type: Opaque
data:
SENTRY_DSN: aHR0cHM6Ly8zZjRiMzFkYmJkOWE0YTZiOGE3MWY5ODgxZDk2MmYyNUBvNDUwNDY1NDU2OTc5OTY4MC5pbmdlc3Quc2VudHJ5LmlvLzQ1MDQ2NTQ1NzI2ODMyNjQ=

@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: {{ .Release.Name }}-service
labels:
app: {{ .Release.Name }}-application
spec:
type: ClusterIP
selector:
app: {{ .Release.Name }}-application
ports:
- protocol: TCP
port: {{ .Values.container.port }}
targetPort: {{ .Values.container.port }}

@ -0,0 +1,3 @@
container:
image: slaventius/test3k_auth_db:latest
port: 9995

@ -20,7 +20,8 @@ services:
# #
# address the broker advertises to clients that connect to the Kafka API. # address the broker advertises to clients that connect to the Kafka API.
- --advertise-kafka-addr - --advertise-kafka-addr
- internal://redpanda-0:9092,external://localhost:19092 # # - internal://redpanda-0:9092,external://localhost:19092
- internal://redpanda-0:9092,outside://37.143.12.169:19092
- --pandaproxy-addr - --pandaproxy-addr
- internal://0.0.0.0:8082,external://0.0.0.0:18082 - internal://0.0.0.0:8082,external://0.0.0.0:18082
# address the broker advertises to clients that connect to PandaProxy. # address the broker advertises to clients that connect to PandaProxy.

@ -1,9 +1,13 @@
#!/bin/sh #!/bin/sh
export APP_PORT=9995 export APP_PORT=9995
# export KAFKA_PORT=9092
export KAFKA_PORT=19092 export KAFKA_PORT=19092
export KAFKA_HOST=127.0.0.1 export KAFKA_HOST=37.143.12.169
# export KAFKA_HOST=37.143.12.169 export SENTRY_DSN="https://3f4b31dbbd9a4a6b8a71f9881d962f25@o4504654569799680.ingest.sentry.io/4504654572683264"
./authDBService export APP=authDBService
export GOOS=$(eval go env GOOS)
export GOARCH=$(eval go env GOARCH)
export GOBIN=$(eval go env GOPATH)/bin
${GOBIN}/${APP}-${GOOS}-${GOARCH}
Loading…
Cancel
Save