-
Notifications
You must be signed in to change notification settings - Fork 529
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
feat: api v2 init #2832
feat: api v2 init #2832
Changes from 20 commits
69aea84
e9a61fe
14fba3e
a408313
a77cf37
0e5e0d9
f26a308
be8764f
d5ad52c
e7a2d1a
b817e7d
d2d30e7
6b2f19b
53a5d11
1463151
0760e6a
323d4bb
58214d7
b575be9
2a936d7
b9b2c30
6490adb
7ca44ed
dc5f9de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -31,6 +31,23 @@ services: | |||||||||||||
ports: | ||||||||||||||
- 3900:3900 | ||||||||||||||
|
||||||||||||||
apiv2: | ||||||||||||||
deploy: | ||||||||||||||
replicas: 1 | ||||||||||||||
endpoint_mode: vip | ||||||||||||||
|
||||||||||||||
command: [ "api", "--config", "config.docker.json"] | ||||||||||||||
build: | ||||||||||||||
context: ../go | ||||||||||||||
dockerfile: ./Dockerfile | ||||||||||||||
depends_on: | ||||||||||||||
- mysql | ||||||||||||||
- clickhouse | ||||||||||||||
environment: | ||||||||||||||
PORT: 8080 | ||||||||||||||
DATABASE_PRIMARY_DSN: "mysql://unkey:password@tcp(mysql:3900)/unkey" | ||||||||||||||
CLICKHOUSE_URL: "clickhouse://default:password@clickhouse:9000" | ||||||||||||||
Comment on lines
+47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use secrets management for sensitive information. Hard-coded credentials in environment variables pose a security risk. Consider using Docker secrets or environment files: environment:
PORT: 8080
- DATABASE_PRIMARY_DSN: "mysql://unkey:password@tcp(mysql:3900)/unkey"
- CLICKHOUSE_URL: "clickhouse://default:password@clickhouse:9000"
+ DATABASE_PRIMARY_DSN: "${DATABASE_PRIMARY_DSN}"
+ CLICKHOUSE_URL: "${CLICKHOUSE_URL}" 📝 Committable suggestion
Suggested change
|
||||||||||||||
|
||||||||||||||
agent: | ||||||||||||||
deploy: | ||||||||||||||
replicas: 3 | ||||||||||||||
|
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,18 @@ | ||||||
FROM golang:1.23-alpine AS builder | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix invalid Go version in base image. The specified Go version 1.23 doesn't exist. The latest stable version is 1.21.5. -FROM golang:1.23-alpine AS builder
+FROM golang:1.21.5-alpine AS builder 📝 Committable suggestion
Suggested change
|
||||||
|
||||||
|
||||||
|
||||||
WORKDIR /go/src/github.com/unkeyed/unkey/go | ||||||
COPY go.sum go.mod ./ | ||||||
RUN go mod download | ||||||
|
||||||
COPY . . | ||||||
ARG VERSION | ||||||
RUN go build -o bin/unkey -ldflags "-X 'github.com/unkeyed/unkey/go/pkg/version.Version=${VERSION}'" ./cmd/main.go | ||||||
|
||||||
FROM golang:1.23-alpine | ||||||
WORKDIR /usr/local/bin | ||||||
COPY --from=builder /go/src/github.com/unkeyed/unkey/go/bin/unkey . | ||||||
COPY --from=builder /go/src/github.com/unkeyed/unkey/go/config.docker.json . | ||||||
|
||||||
ENTRYPOINT [ "/usr/local/bin/unkey"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '3' | ||
|
||
tasks: | ||
install: | ||
cmd: | ||
go mod tidy | ||
fmt: | ||
cmds: | ||
- go fmt ./... | ||
- task: lint | ||
test: | ||
cmds: | ||
- go test -cover -json -failfast ./... | tparse -all -progress | ||
|
||
build: | ||
cmds: | ||
- go build -o unkey ./cmd/main.go | ||
|
||
|
||
lint: | ||
cmds: | ||
- golangci-lint run |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/oapi-codegen/oapi-codegen/HEAD/configuration-schema.json | ||
package: api | ||
output: ./gen.go | ||
generate: | ||
models: true | ||
|
||
|
||
output-options: | ||
nullable-type: true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Add health checks and resource limits.
The service should include health checks and resource constraints for better reliability and resource management.
📝 Committable suggestion