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

Masv openapi3 #38

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
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
13 changes: 11 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ docker-push-apigw:
$(info Pushing docker images)
docker push $(DOCKER_TAG_APIGW)

docker-push: docker-push-gobuild docker-push-datastore docker-push-datastore docker-push-verifier docker-push-registry docker-push-cache docker-push-persistent docker-push-apigw
docker-push: docker-push-datastore docker-push-datastore docker-push-verifier docker-push-registry docker-push-cache docker-push-persistent docker-push-apigw
$(info Pushing docker images)

docker-pull:
Expand Down Expand Up @@ -213,6 +213,14 @@ swagger-verifier:
swagger-apigw:
swag init -d internal/apigw/apiv1/ -g client.go --output docs/apigw --parseDependency --packageName docs

openapi3-apigw: swagger-apigw
docker run --rm -v ./docs/apigw:/work openapitools/openapi-generator-cli:latest-release generate -i /work/swagger.yaml -o ./work/v3 -g openapi-yaml --minimal-update
docker run --rm -v ./docs/apigw:/work openapitools/openapi-generator-cli:latest-release generate -i /work/swagger.json -o ./work/v3 -g openapi --minimal-update
sudo mv ./docs/apigw/v3/openapi/openapi.yaml ./internal/apigw/httpserver/openapiv3/openapi.yaml
sudo mv ./docs/apigw/v3/openapi.json ./internal/apigw/httpserver/openapiv3/openapi.json
sudo rm -rf ./docs/apigw/v3
sudo chown -R $(shell id -u):$(shell id -g) ./internal/apigw/httpserver/openapiv3/

install-tools:
$(info Install from apt)
apt-get update && apt-get install -y \
Expand All @@ -239,4 +247,5 @@ vscode:
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest && \
go install golang.org/x/tools/cmd/deadcode@latest && \
go install github.com/securego/gosec/v2/cmd/gosec@latest && \
go install honnef.co/go/tools/cmd/staticcheck@latest
go install honnef.co/go/tools/cmd/staticcheck@latest && \
go install github.com/deepmap/oapi-codegen/cmd/oapi-codegen@latest
3 changes: 0 additions & 3 deletions cmd/apigw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ type service interface {
Close(ctx context.Context) error
}

var GitCommit string

func main() {
var wg sync.WaitGroup
ctx := context.Background()
Expand All @@ -37,7 +35,6 @@ func main() {
if err != nil {
panic(err)
}
log.Info("compile variable", "git commit", GitCommit)
tracer, err := trace.New(ctx, cfg, log, "vc", "apigw")
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion cmd/cache/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {
if err != nil {
panic(err)
}
tracer, err := trace.New(ctx, cfg, log, "vc_cache", "cache")
tracer, err := trace.New(ctx, cfg, log, "vc", "cache")
if err != nil {
panic(err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/persistent/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func main() {
if err != nil {
panic(err)
}
tracer, err := trace.New(ctx, cfg, log, "vc_persistent", "cache")
tracer, err := trace.New(ctx, cfg, log, "vc", "persistent")
if err != nil {
panic(err)
}
Expand Down
4 changes: 4 additions & 0 deletions dev_config_docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ persistent:
apigw:
api_server:
addr: :8080
tls:
enabled: false
cert_file_path: ""
key_file_path: ""

py_pdfsigner:
sign_queue_name: sign
Expand Down
4 changes: 2 additions & 2 deletions dockerfiles/worker
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ ARG SERVICE_NAME

WORKDIR /

RUN apt-get update && apt-get install -y curl procps iputils-ping less
RUN apt-get update && apt-get install -y curl procps iputils-ping less coreutils file netcat-openbsd
RUN rm -rf /var/lib/apt/lists/*

COPY --from=builder /go/src/app/bin/vc_${SERVICE_NAME} /vc_service
COPY --from=builder /go/src/app/docs /docs

EXPOSE 8080

HEALTHCHECK --interval=20s --timeout=10s CMD curl --connect-timeout 5 http://localhost:8080/health | grep -q STATUS_OK
HEALTHCHECK --interval=20s --timeout=10s CMD curl --insecure --connect-timeout 5 https://localhost:8080/health | grep -q STATUS_OK

# vars in CMD and ENTRYPOINT are evaluated at runtime, that's why we use a static name on the binary.
CMD [ "./vc_service" ]
Loading
Loading