mirror of
https://github.com/hexolan/stocklet.git
synced 2026-03-26 11:41:18 +00:00
chore: initial commit
This commit is contained in:
16
build/auth-service/Dockerfile
Normal file
16
build/auth-service/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/auth-service ./cmd/auth-service
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/auth-service .
|
||||
EXPOSE 90 9090
|
||||
CMD ["./auth-service"]
|
||||
3
build/edge-gateway/Dockerfile
Normal file
3
build/edge-gateway/Dockerfile
Normal file
@@ -0,0 +1,3 @@
|
||||
FROM envoyproxy/envoy:v1.28-latest
|
||||
COPY envoy.yaml /etc/envoy/envoy.yaml
|
||||
RUN chmod go+r /etc/envoy/envoy.yaml
|
||||
190
build/edge-gateway/envoy.yaml
Normal file
190
build/edge-gateway/envoy.yaml
Normal file
@@ -0,0 +1,190 @@
|
||||
static_resources:
|
||||
listeners:
|
||||
- address:
|
||||
socket_address:
|
||||
address: 0.0.0.0
|
||||
port_value: 80
|
||||
filter_chains:
|
||||
- filters:
|
||||
- name: envoy.filters.network.http_connection_manager
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
|
||||
codec_type: AUTO
|
||||
stat_prefix: ingress_http
|
||||
generate_request_id: true
|
||||
tracing:
|
||||
provider:
|
||||
name: envoy.tracers.opentelemetry
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.config.trace.v3.OpenTelemetryConfig
|
||||
grpc_service:
|
||||
envoy_grpc:
|
||||
cluster_name: otel_collector
|
||||
timeout: 0.5s
|
||||
service_name: edge-gateway
|
||||
route_config:
|
||||
name: local_route
|
||||
virtual_hosts:
|
||||
- name: services
|
||||
domains:
|
||||
- "*"
|
||||
routes:
|
||||
- match:
|
||||
prefix: /v1/auth/
|
||||
route:
|
||||
cluster: auth_service_gw
|
||||
- match:
|
||||
prefix: /v1/order/
|
||||
route:
|
||||
cluster: order_service_gw
|
||||
- match:
|
||||
prefix: /v1/payment/
|
||||
route:
|
||||
cluster: payment_service_gw
|
||||
- match:
|
||||
prefix: /v1/product/
|
||||
route:
|
||||
cluster: product_service_gw
|
||||
- match:
|
||||
prefix: /v1/shipping/
|
||||
route:
|
||||
cluster: shipping_service_gw
|
||||
- match:
|
||||
prefix: /v1/user/
|
||||
route:
|
||||
cluster: user_service_gw
|
||||
- match:
|
||||
prefix: /v1/warehouse/
|
||||
route:
|
||||
cluster: warehouse_service_gw
|
||||
http_filters:
|
||||
- name: envoy.filters.http.jwt_authn
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.jwt_authn.v3.JwtAuthentication
|
||||
providers:
|
||||
default_provider:
|
||||
remote_jwks:
|
||||
http_uri:
|
||||
uri: http://auth-service:90/v1/auth/jwks
|
||||
cluster: auth_service_gw
|
||||
timeout: 1s
|
||||
cache_duration:
|
||||
seconds: 300
|
||||
from_headers:
|
||||
- name: Authorization
|
||||
forward: true
|
||||
forward_payload_header: x-jwt-payload
|
||||
rules:
|
||||
- match:
|
||||
prefix: /
|
||||
requires:
|
||||
requires_any:
|
||||
requirements:
|
||||
- provider_name: default_provider
|
||||
- allow_missing: {}
|
||||
- name: envoy.filters.http.router
|
||||
typed_config:
|
||||
"@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
|
||||
|
||||
clusters:
|
||||
- name: otel_collector
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
typed_extension_protocol_options:
|
||||
envoy.extensions.upstreams.http.v3.HttpProtocolOptions:
|
||||
"@type": type.googleapis.com/envoy.extensions.upstreams.http.v3.HttpProtocolOptions
|
||||
explicit_http_config:
|
||||
http2_protocol_options: {}
|
||||
load_assignment:
|
||||
cluster_name: otel_collector
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: otel-collector
|
||||
port_value: 4317
|
||||
- name: auth_service_gw
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: auth_service_gw
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: auth-service
|
||||
port_value: 90
|
||||
- name: order_service_gw
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: order_service_gw
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: order-service
|
||||
port_value: 90
|
||||
- name: payment_service_gw
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: payment_service_gw
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: payment-service
|
||||
port_value: 90
|
||||
- name: product_service_gw
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: product_service_gw
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: product-service
|
||||
port_value: 90
|
||||
- name: shipping_service_gw
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: shipping_service_gw
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: shipping-service
|
||||
port_value: 90
|
||||
- name: user_service_gw
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: user_service_gw
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: user-service
|
||||
port_value: 90
|
||||
- name: warehouse_service_gw
|
||||
type: STRICT_DNS
|
||||
lb_policy: ROUND_ROBIN
|
||||
load_assignment:
|
||||
cluster_name: warehouse_service_gw
|
||||
endpoints:
|
||||
- lb_endpoints:
|
||||
- endpoint:
|
||||
address:
|
||||
socket_address:
|
||||
address: warehouse-service
|
||||
port_value: 90
|
||||
16
build/order-service/Dockerfile
Normal file
16
build/order-service/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/order-service ./cmd/order-service
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/order-service .
|
||||
EXPOSE 90 9090
|
||||
CMD ["./order-service"]
|
||||
2
build/otel-collector/Dockerfile
Normal file
2
build/otel-collector/Dockerfile
Normal file
@@ -0,0 +1,2 @@
|
||||
FROM otel/opentelemetry-collector-contrib:0.90.1
|
||||
COPY config.yaml /etc/otelcol-contrib/config.yaml
|
||||
23
build/otel-collector/config.yaml
Normal file
23
build/otel-collector/config.yaml
Normal file
@@ -0,0 +1,23 @@
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
http:
|
||||
|
||||
exporters:
|
||||
debug:
|
||||
verbosity: detailed
|
||||
|
||||
processors:
|
||||
batch:
|
||||
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [debug]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
processors: [batch]
|
||||
exporters: [debug]
|
||||
16
build/payment-service/Dockerfile
Normal file
16
build/payment-service/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/payment-service ./cmd/payment-service
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/payment-service .
|
||||
EXPOSE 90 9090
|
||||
CMD ["./payment-service"]
|
||||
16
build/product-service/Dockerfile
Normal file
16
build/product-service/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/product-service ./cmd/product-service
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/product-service .
|
||||
EXPOSE 90 9090
|
||||
CMD ["./product-service"]
|
||||
15
build/service-init/Dockerfile
Normal file
15
build/service-init/Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/service-init ./cmd/service-init
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/service-init .
|
||||
CMD ["./service-init"]
|
||||
16
build/shipping-service/Dockerfile
Normal file
16
build/shipping-service/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/shipping-service ./cmd/shipping-service
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/shipping-service .
|
||||
EXPOSE 90 9090
|
||||
CMD ["./shipping-service"]
|
||||
16
build/user-service/Dockerfile
Normal file
16
build/user-service/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/user-service ./cmd/user-service
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/user-service .
|
||||
EXPOSE 90 9090
|
||||
CMD ["./user-service"]
|
||||
16
build/warehouse-service/Dockerfile
Normal file
16
build/warehouse-service/Dockerfile
Normal file
@@ -0,0 +1,16 @@
|
||||
FROM golang:1.22 AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Install required modules
|
||||
COPY go.mod go.sum ./
|
||||
RUN go mod download
|
||||
|
||||
# Build the service
|
||||
COPY . .
|
||||
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o /bin/warehouse-service ./cmd/warehouse-service
|
||||
|
||||
# Runtime Environment
|
||||
FROM gcr.io/distroless/static-debian12
|
||||
COPY --from=build /bin/warehouse-service .
|
||||
EXPOSE 90 9090
|
||||
CMD ["./warehouse-service"]
|
||||
Reference in New Issue
Block a user