-
Notifications
You must be signed in to change notification settings - Fork 4
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
22 changed files
with
324 additions
and
108 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 @@ | ||
**/node_modules/** |
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,46 @@ | ||
# =================================================================================== | ||
# === Stage 1: bleep bloop ========================= | ||
# =================================================================================== | ||
FROM golang:1.14-alpine as go-build | ||
|
||
ARG serviceName="SET_ON_COMMAND_LINE" | ||
ARG version="0.0.1" | ||
ARG buildInfo="Local manual builds" | ||
|
||
WORKDIR /build | ||
|
||
# Install system dependencies | ||
RUN apk update && apk add git gcc musl-dev | ||
|
||
# Fetch and cache Go modules | ||
COPY services/go.mod . | ||
COPY services/go.sum . | ||
RUN go mod download | ||
|
||
# Copy in Go source files | ||
COPY services/$serviceName/ ./service | ||
COPY services/common/ ./common | ||
|
||
# Now run the build | ||
# Disabling cgo results in a fully static binary that can run without C libs | ||
# Also inject version and build details | ||
RUN GO111MODULE=on CGO_ENABLED=0 GOOS=linux go build \ | ||
-ldflags "-X main.version=$version -X 'main.buildInfo=$buildInfo'" \ | ||
-o server ./service | ||
|
||
# ================================================================================================ | ||
# === Stage 2: Fooo =================================== | ||
# ================================================================================================ | ||
FROM alpine | ||
WORKDIR /app | ||
|
||
ARG servicePort=9000 | ||
|
||
# Copy the Go server binary | ||
COPY --from=go-build /build/server . | ||
|
||
EXPOSE $servicePort | ||
ENV PORT=$servicePort | ||
|
||
# That's it! Just run the server | ||
CMD [ "./server"] |
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,50 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: api-gateway | ||
labels: | ||
app: api-gateway | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: api-gateway | ||
template: | ||
metadata: | ||
labels: | ||
app: api-gateway | ||
annotations: | ||
dapr.io/enabled: "true" | ||
dapr.io/id: "api-gateway" | ||
dapr.io/port: "9000" | ||
spec: | ||
containers: | ||
- name: service | ||
image: bcdemo.azurecr.io/dapr-store/api-gateway | ||
imagePullPolicy: Always | ||
ports: | ||
- containerPort: 9000 | ||
env: | ||
- name: DAPR_HTTP_PORT | ||
value: "3500" | ||
resources: | ||
limits: | ||
cpu: 200m | ||
memory: 200M | ||
|
||
--- | ||
|
||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: api-gateway | ||
labels: | ||
app: api-gateway | ||
spec: | ||
selector: | ||
app: api-gateway | ||
ports: | ||
- protocol: TCP | ||
port: 80 | ||
targetPort: 9000 | ||
type: LoadBalancer |
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,31 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: orders | ||
labels: | ||
app: orders | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: orders | ||
template: | ||
metadata: | ||
labels: | ||
app: orders | ||
annotations: | ||
dapr.io/enabled: "true" | ||
dapr.io/id: "orders" | ||
dapr.io/port: "9001" | ||
spec: | ||
containers: | ||
- name: service | ||
image: bcdemo.azurecr.io/dapr-store/orders | ||
imagePullPolicy: Always | ||
env: | ||
- name: DAPR_HTTP_PORT | ||
value: "3500" | ||
resources: | ||
limits: | ||
cpu: 200m | ||
memory: 200M |
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,13 @@ | ||
apiVersion: dapr.io/v1alpha1 | ||
kind: Configuration | ||
metadata: | ||
name: default | ||
spec: | ||
httpPipeline: | ||
handlers: | ||
- name: uppercase | ||
type: middleware.http.uppercase | ||
mtls: | ||
enabled: true | ||
workloadCertTTL: "24h" | ||
allowedClockSkew: "15m" |
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,14 @@ | ||
apiVersion: dapr.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
name: statestore | ||
spec: | ||
type: state.redis | ||
metadata: | ||
- name: redisHost | ||
value: redis:6379 | ||
- name: redisPassword | ||
value: "" | ||
|
||
# helm install redis bitnami/redis --set "cluster.enabled=false,master.persistence.enabled=false" | ||
# kubectl get secret --namespace default redis -o jsonpath="{.data.redis-password}" | base64 --decode |
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,5 @@ | ||
controller: | ||
podAnnotations: | ||
dapr.io/enabled: "true" | ||
dapr.io/id: "nginx-ingress" | ||
dapr.io/port: "80" |
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,41 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: redis | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: redis | ||
replicas: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: redis | ||
spec: | ||
containers: | ||
- name: master | ||
image: redis | ||
imagePullPolicy: IfNotPresent | ||
resources: | ||
limits: | ||
cpu: 100m | ||
memory: 100M | ||
ports: | ||
- containerPort: 6379 | ||
|
||
--- | ||
|
||
kind: Service | ||
apiVersion: v1 | ||
metadata: | ||
name: redis | ||
labels: | ||
app: redis | ||
spec: | ||
selector: | ||
app: redis | ||
ports: | ||
- protocol: TCP | ||
port: 6379 | ||
targetPort: 6379 | ||
type: ClusterIP |
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,17 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
ACR_NAME="bcdemo" | ||
|
||
docker build . -f build/service.Dockerfile \ | ||
--build-arg serviceName=api-gateway \ | ||
--build-arg servicePort=9000 \ | ||
-t $ACR_NAME.azurecr.io/dapr-store/api-gateway | ||
|
||
docker build . -f build/service.Dockerfile \ | ||
--build-arg serviceName=orders \ | ||
--build-arg servicePort=9001 \ | ||
-t $ACR_NAME.azurecr.io/dapr-store/orders | ||
|
||
docker push $ACR_NAME.azurecr.io/dapr-store/api-gateway | ||
docker push $ACR_NAME.azurecr.io/dapr-store/orders |
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,4 @@ | ||
kubectl rollout restart -n dapr-system deploy/dapr-operator | ||
kubectl rollout restart -n dapr-system deploy/dapr-placement | ||
kubectl rollout restart -n dapr-system deploy/dapr-sentry | ||
kubectl rollout restart -n dapr-system deploy/dapr-sidecar-injector |
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,17 @@ | ||
GET http://localhost:9000/healthz | ||
### | ||
|
||
GET http://localhost:9000/status | ||
### | ||
|
||
GET http://localhost:9000/api/orders/6 | ||
### | ||
GET http://localhost:45949/v1.0/invoke/orders/method/foo | ||
### | ||
GET http://localhost:9000/api/forUser/1 | ||
|
||
|
||
### | ||
GET http://localhost:9001/6 | ||
### | ||
GET http://localhost:9001/forUser/1 |
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
This file was deleted.
Oops, something went wrong.
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 was deleted.
Oops, something went wrong.
Oops, something went wrong.