new payment methods service

This commit is contained in:
Stephan D
2026-02-12 21:10:33 +01:00
parent b80dca0ce9
commit a862e27087
106 changed files with 3262 additions and 414 deletions

View File

@@ -33,6 +33,7 @@ services:
LEDGER_ADDRESS: ${LEDGER_SERVICE_NAME}:${LEDGER_GRPC_PORT}
PAYMENTS_ADDRESS: ${PAYMENTS_SERVICE_NAME}:${PAYMENTS_GRPC_PORT}
PAYMENTS_QUOTE_ADDRESS: ${PAYMENTS_QUOTATION_SERVICE_NAME}:${PAYMENTS_QUOTATION_GRPC_PORT}
PAYMENTS_METHODS_ADDRESS: ${PAYMENTS_METHODS_SERVICE_NAME}:${PAYMENTS_METHODS_GRPC_PORT}
MONGO_HOST: ${MONGO_HOST}
MONGO_PORT: ${MONGO_PORT}
MONGO_DATABASE: ${MONGO_DATABASE}

View File

@@ -0,0 +1,40 @@
# syntax=docker/dockerfile:1.7
ARG TARGETOS=linux
ARG TARGETARCH=amd64
FROM golang:alpine AS build
ARG APP_VERSION=dev
ARG GIT_REV=unknown
ARG BUILD_BRANCH=unknown
ARG BUILD_DATE=unknown
ARG BUILD_USER=ci
ENV GO111MODULE=on
ENV PATH="/go/bin:${PATH}"
WORKDIR /src
COPY . .
RUN apk add --no-cache bash git build-base protoc protobuf-dev \
&& go install google.golang.org/protobuf/cmd/protoc-gen-go@latest \
&& go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest \
&& bash ci/scripts/proto/generate.sh
WORKDIR /src/api/payments/methods
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \
go build -trimpath -ldflags "\
-s -w \
-X github.com/tech/sendico/payments/methods/internal/appversion.Version=${APP_VERSION} \
-X github.com/tech/sendico/payments/methods/internal/appversion.Revision=${GIT_REV} \
-X github.com/tech/sendico/payments/methods/internal/appversion.Branch=${BUILD_BRANCH} \
-X github.com/tech/sendico/payments/methods/internal/appversion.BuildUser=${BUILD_USER} \
-X github.com/tech/sendico/payments/methods/internal/appversion.BuildDate=${BUILD_DATE}" \
-o /out/payments-methods .
FROM alpine:latest AS runtime
RUN apk add --no-cache ca-certificates tzdata wget
WORKDIR /app
COPY api/payments/methods/config.yml /app/config.yml
COPY --from=build /out/payments-methods /app/payments-methods
EXPOSE 50066 9416
ENTRYPOINT ["/app/payments-methods"]
CMD ["--config.file", "/app/config.yml"]

View File

@@ -0,0 +1,53 @@
# Compose v2 - Payments Methods
x-common-env: &common-env
env_file:
- ../env/.env.runtime
- ../env/.env.version
networks:
sendico-net:
external: true
name: sendico-net
services:
sendico_payments_methods:
<<: *common-env
container_name: sendico-payments-methods
restart: unless-stopped
image: ${REGISTRY_URL}/payments/methods:${APP_V}
pull_policy: always
environment:
PAYMENTS_MONGO_HOST: ${PAYMENTS_MONGO_HOST}
PAYMENTS_MONGO_PORT: ${PAYMENTS_MONGO_PORT}
PAYMENTS_MONGO_DATABASE: ${PAYMENTS_MONGO_DATABASE}
PAYMENTS_MONGO_USER: ${PAYMENTS_MONGO_USER}
PAYMENTS_MONGO_PASSWORD: ${PAYMENTS_MONGO_PASSWORD}
PAYMENTS_MONGO_AUTH_SOURCE: ${PAYMENTS_MONGO_AUTH_SOURCE}
PAYMENTS_MONGO_REPLICA_SET: ${PAYMENTS_MONGO_REPLICA_SET}
MONGO_HOST: ${MONGO_HOST}
MONGO_PORT: ${MONGO_PORT}
MONGO_DATABASE: ${MONGO_DATABASE}
MONGO_USER: ${PAYMENTS_MONGO_USER}
MONGO_PASSWORD: ${PAYMENTS_MONGO_PASSWORD}
MONGO_AUTH_SOURCE: ${MONGO_AUTH_SOURCE}
MONGO_REPLICA_SET: ${MONGO_REPLICA_SET}
NATS_URL: ${NATS_URL}
NATS_HOST: ${NATS_HOST}
NATS_PORT: ${NATS_PORT}
NATS_USER: ${NATS_USER}
NATS_PASSWORD: ${NATS_PASSWORD}
PAYMENTS_METHODS_GRPC_PORT: ${PAYMENTS_METHODS_GRPC_PORT}
PAYMENTS_METHODS_METRICS_PORT: ${PAYMENTS_METHODS_METRICS_PORT}
command: ["--config.file", "/app/config.yml"]
ports:
- "0.0.0.0:${PAYMENTS_METHODS_GRPC_PORT}:50066"
- "0.0.0.0:${PAYMENTS_METHODS_METRICS_PORT}:9416"
healthcheck:
test: ["CMD-SHELL","wget -qO- http://localhost:9416/health | grep -q '\"status\":\"ok\"'"]
interval: 30s
timeout: 10s
retries: 3
start_period: 60s
networks:
- sendico-net