-
Notifications
You must be signed in to change notification settings - Fork 0
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
54 changed files
with
1,559 additions
and
237 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
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 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,29 @@ | ||
apiVersion: backstage.io/v1alpha1 | ||
kind: Component | ||
metadata: | ||
annotations: | ||
crashoverride.com/artifact: "fsm-cmd" | ||
crashoverride.com/component: "go-statemachine" | ||
|
||
name: statemachine | ||
title: 'Statemachine Server (gRPC)' | ||
description: | | ||
[The Statemachine Server](http://github.com/massenz/go-statemachine) | ||
exposes a gRPC API to manage statemachines and relative configurations, | ||
and a PubSub API to receive events for those. | ||
links: | ||
- url: https://github.com/massenz/go-statemachine | ||
title: GitHub Repo | ||
icon: github | ||
- url: https://github.com/massenz/go-statemachine/releases | ||
title: Releases | ||
icon: settings | ||
spec: | ||
type: service | ||
lifecycle: experimental | ||
owner: user:marco | ||
team: Backend | ||
providesApis: | ||
- statemachines | ||
- configurations | ||
- events |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,11 +7,11 @@ WORKDIR /server | |
COPY . . | ||
RUN rm -rf certs data | ||
RUN CGO_ENABLED=0 make build | ||
RUN CGO_ENABLED=0 go build -o out/bin/hc docker/grpc_health.go | ||
RUN CGO_ENABLED=0 go build -o build/bin/hc docker/grpc_health.go | ||
|
||
# NOTE: Use the Ubuntu image; other images will encounter errors, | ||
# including the "`GLIBC_2.32' not found" error. | ||
# Alpine (which uses /bin/sh) emits an error which makes no sense (./fsm-server not found) | ||
# Alpine (which uses /bin/sh) emits an error which makes no sense (./fsm-cmd not found) | ||
# only because, in fact, it cannot find the library. | ||
FROM ubuntu:22.04 | ||
LABEL org.opencontainers.image.authors="Marco Massenzio <[email protected]>" | ||
|
@@ -21,6 +21,7 @@ LABEL org.opencontainers.image.licenses=Apache-2.0 | |
|
||
RUN apt-get update && apt-get install ca-certificates -y | ||
RUN groupadd -r sm-bot && useradd -r -g sm-bot sm-bot | ||
|
||
# Sensible defaults for the server, for reference | ||
# we list all the environment variables used by the | ||
# entrypoint script. | ||
|
@@ -34,8 +35,8 @@ WORKDIR /app | |
RUN chown sm-bot:sm-bot /app | ||
|
||
USER sm-bot | ||
COPY --from=builder /server/out/bin/fsm-server* ./fsm-server | ||
COPY --from=builder /server/out/bin/hc ./ | ||
COPY --from=builder /server/build/bin/fsm-server* ./fsm-server | ||
COPY --from=builder /server/build/bin/hc ./ | ||
ADD docker/entrypoint.sh ./ | ||
|
||
EXPOSE ${SERVER_PORT} | ||
|
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
* Author: Marco Massenzio ([email protected]) | ||
*/ | ||
|
||
package examples | ||
package main | ||
|
||
import ( | ||
"context" | ||
|
@@ -44,9 +44,9 @@ func NewOrderDetails(orderId, customerId string, orderTotal float64) *OrderDetai | |
} | ||
|
||
func (o *OrderDetails) String() string { | ||
res, error := json.Marshal(o) | ||
if error != nil { | ||
panic(error) | ||
res, err := json.Marshal(o) | ||
if err != nil { | ||
panic(err) | ||
} | ||
return string(res) | ||
} | ||
|
@@ -86,7 +86,7 @@ func NewSqs(endpoint *string) *sqs.SQS { | |
} | ||
|
||
// main simulates a Client sending an SQS event message for an Order entity | ||
// whose status is being tracked by `fsm-server`. | ||
// whose status is being tracked by `fsm-cmd`. | ||
func main() { | ||
endpoint := flag.String("endpoint", "", "Use http://localhost:4566 to use LocalStack") | ||
q := flag.String("q", "", "The SQS Queue to send an Event to") | ||
|
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
Oops, something went wrong.