-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
1,269 additions
and
216 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 @@ | ||
.bin |
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,9 @@ | ||
DB_USER=string | ||
DB_PASSWORD=string | ||
DB_NAME=string | ||
|
||
USER_JWT_SECRET=string | ||
ADMIN_JWT_SECRET=string | ||
|
||
CONFIG_PATH=configs | ||
CONFIG_FILE=local.yml |
File renamed without changes.
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,9 @@ | ||
DB_USER= | ||
DB_PASSWORD= | ||
DB_NAME= | ||
|
||
USER_JWT_SECRET= | ||
ADMIN_JWT_SECRET= | ||
|
||
CONFIG_PATH=configs | ||
CONFIG_FILE=prod.yml |
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 |
---|---|---|
|
@@ -28,3 +28,5 @@ go.work | |
|
||
# Userdata | ||
postgres | ||
vendor | ||
postgres-auth-data |
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,85 @@ | ||
run: | ||
deadline: 3m | ||
|
||
build-tags: | ||
- selinux | ||
- seccomp | ||
|
||
linters: | ||
enable-all: true | ||
disable: | ||
- depguard | ||
- gochecknoglobals | ||
- gochecknoinits | ||
- prealloc | ||
- wrapcheck | ||
- varnamelen | ||
- errcheck | ||
- nonamedreturns | ||
- ireturn | ||
- exhaustruct | ||
- tagliatelle | ||
- goimports | ||
- exhaustive | ||
- tagalign | ||
- lll | ||
- gofumpt | ||
- gci | ||
- funlen | ||
- godot | ||
- cyclop | ||
- forcetypeassert | ||
- gomnd | ||
- execinquery | ||
|
||
linters-settings: | ||
govet: | ||
settings: | ||
printf: | ||
funcs: | ||
- (github.com/golang/glog.Verbose).Infof | ||
- github.com/golang/glog.Infof | ||
- github.com/golang/glog.Warningf | ||
- github.com/golang/glog.Errorf | ||
- github.com/golang/glog.Fatalf | ||
- github.com/golang/glog.Exitf | ||
golint: | ||
min-confidence: 0 | ||
gocyclo: | ||
min-complexity: 20 | ||
|
||
lll: | ||
tab-width: 4 | ||
prealloc: | ||
simple: true | ||
|
||
|
||
issues: | ||
exclude-rules: | ||
- path: _test\.go | ||
linters: | ||
- errcheck | ||
- dupl | ||
- gosec | ||
- lll | ||
- scopelint | ||
|
||
- path: pkg/server/runtime/streaming.go | ||
linters: | ||
- gocyclo | ||
|
||
- text: "vendor/github.com/kubernetes-sigs/cri-o/pkg/seccomp/seccomp.go" | ||
linters: | ||
- typecheck | ||
|
||
- path: pkg/server | ||
linters: | ||
- lll | ||
|
||
max-issues-per-linter: 0 | ||
max-same-issues: 0 | ||
|
||
service: | ||
prepare: | ||
- apt-get update | ||
- apt-get install -y libseccomp-dev |
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 |
---|---|---|
@@ -1,9 +1,15 @@ | ||
FROM golang:1.22-alpine | ||
FROM golang:1.22.3-alpine AS builder | ||
|
||
WORKDIR /app | ||
|
||
COPY . . | ||
|
||
RUN go build ./cmd/app/main.go | ||
RUN go build -o main ./cmd/app/main.go | ||
|
||
FROM alpine:latest | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=builder /app/main . | ||
|
||
CMD ["./main"] |
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,61 @@ | ||
.PHONY: run-docker-local | ||
run-docker-local: | ||
docker compose --env-file .env --env-file .env.local -f docker-compose.yml -f docker-compose.local.yml up --build --remove-orphans | ||
|
||
.PHONY: stop-docker-local | ||
stop-docker: | ||
docker compose --env-file .env --env-file .env.local -f docker-compose.yml -f docker-compose.local.yml down | ||
|
||
.PHONY: reset-docker-local | ||
reset-docker-local: | ||
docker compose --env-file .env --env-file .env.local -f docker-compose.yml -f docker-compose.local.yml down -v | ||
docker compose --env-file .env --env-file .env.local -f docker-compose.yml -f docker-compose.local.yml up -d | ||
|
||
.PHONY: run-docker-prod | ||
run-docker-prod: | ||
docker compose --env-file .env --env-file .env.prod -f docker-compose.yml -f docker-compose.prod.yml up -d --build --remove-orphans | ||
|
||
.PHONY: stop-docker-prod | ||
stop-docker-prod: | ||
docker compose --env-file .env --env-file .env.prod -f docker-compose.yml -f docker-compose.prod.yml down | ||
|
||
.PHONY: reset-docker-prod | ||
reset-docker-prod: | ||
docker compose --env-file .env --env-file .env.prod -f docker-compose.yml -f docker-compose.prod.yml down -v | ||
docker compose --env-file .env --env-file .env.prod -f docker-compose.yml -f docker-compose.prod.yml up -d | ||
|
||
.PHONY: pull-images | ||
pull-images: | ||
docker compose --env-file .env --env-file .env.prod -f docker-compose.yml -f docker-compose.prod.yml pull | ||
|
||
.PHONY: build | ||
|
||
.DEFAULT_GOAL := build | ||
|
||
.PHONY: lint | ||
lint: | ||
golangci-lint run --config .golangci-lint.yaml | ||
|
||
.PHONY: build | ||
build: | ||
go build -o ./.bin/server cmd/app/main.go | ||
|
||
.PHONY: build-docker | ||
build-docker: | ||
docker build -t auth . | ||
|
||
.PHONY: run | ||
run: build | ||
./.bin/server | ||
|
||
.PHONY: test | ||
test: | ||
go test -v ./... | ||
|
||
.PHONY: test-cover | ||
test-cover: | ||
go test -coverprofile=coverage.out -covermode=atomic ./... | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf ./.bin |
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 |
---|---|---|
|
@@ -2,6 +2,9 @@ grpc: | |
port: 22000 | ||
timeout: 5000 | ||
|
||
rest: | ||
host: "0.0.0.0:8081" | ||
|
||
logging: | ||
mode: "dev" | ||
|
||
|
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 |
---|---|---|
|
@@ -2,6 +2,9 @@ grpc: | |
port: | ||
timeout: | ||
|
||
rest: | ||
port: | ||
|
||
logging: | ||
mode: "prod" | ||
|
||
|
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,12 @@ | ||
version: "3.9" | ||
|
||
services: | ||
auth: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
env_file: | ||
- .env.local | ||
|
||
postgres: | ||
env_file: .env.local |
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,19 @@ | ||
version: "3.9" | ||
|
||
services: | ||
auth: | ||
env_file: | ||
- .env.prod | ||
deploy: | ||
replicas: 1 | ||
update_config: | ||
parallelism: 1 | ||
delay: 10s | ||
order: start-first | ||
resources: | ||
limits: | ||
memory: '512M' | ||
cpus: '0.5' | ||
|
||
postgres: | ||
env_file: .env.prod |
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 |
---|---|---|
@@ -1,40 +1,44 @@ | ||
version: "3.9" | ||
|
||
services: | ||
postgres: | ||
image: postgres:16.2-alpine | ||
container_name: postgres | ||
restart: on-failure | ||
env_file: .env | ||
environment: | ||
- POSTGRES_USER=${DB_USER} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
- POSTGRES_DB=${DB_NAME} | ||
volumes: | ||
- ./postgres-auth/data:/var/lib/postgresql/data | ||
ports: | ||
- "5432:5432" | ||
networks: | ||
- auth_network | ||
auth: | ||
image: your-registry/auth | ||
container_name: auth | ||
env_file: | ||
- .env | ||
environment: | ||
- PGSQL_PASSWORD=${DB_PASSWORD} | ||
restart: on-failure | ||
ports: | ||
- "5000:22000" | ||
- "8085:8081" | ||
depends_on: | ||
- postgres | ||
volumes: | ||
- ./configs:/app/configs | ||
networks: | ||
- network | ||
|
||
auth: | ||
image: auth | ||
build: | ||
context: . | ||
dockerfile: ./Dockerfile | ||
container_name: auth | ||
env_file: | ||
- .env | ||
environment: | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
restart: on-failure | ||
ports: | ||
- "22000:22000" | ||
depends_on: | ||
- postgres | ||
networks: | ||
- auth_network | ||
postgres: | ||
image: postgres:16.2-alpine | ||
restart: on-failure | ||
env_file: .env | ||
environment: | ||
- POSTGRES_USER=${DB_USER} | ||
- POSTGRES_PASSWORD=${DB_PASSWORD} | ||
- POSTGRES_DB=${DB_NAME} | ||
volumes: | ||
- ./postgres-auth-data:/var/lib/postgresql/data | ||
ports: | ||
- "5500:5432" | ||
networks: | ||
- network | ||
healthcheck: | ||
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"] | ||
interval: 5s | ||
timeout: 5s | ||
retries: 5 | ||
|
||
networks: | ||
auth_network: | ||
network: | ||
driver: bridge |
Oops, something went wrong.