Compare commits

..

4 commits

13 changed files with 167 additions and 72 deletions

View file

@ -4,7 +4,7 @@ on:
- cron: "0 10 * * *"
push:
branches:
- "**"
- "main"
tags:
- "v*.*.*"
pull_request:
@ -47,6 +47,16 @@ jobs:
type=semver,pattern={{major}}
type=sha
- name: Setup Golang cache
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Build binaries
run: devbox run -- just build-bin

View file

@ -1,4 +1,4 @@
FROM gcr.io/distroless/static-debian12:latest as production
FROM scratch
ARG TARGETARCH
ARG TARGETOS

View file

@ -1,20 +1,3 @@
# Deploy the application to fly.io
deploy-fly:
fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}
# Read local jwt key and set it as fly secret
deploy-fly-set-jwt-key-secrets:
#!/bin/bash
# https://github.com/superfly/flyctl/issues/589
cat <<EOF | fly secrets import -c deploy/fly.toml
JWT_PRIVATE_KEY="""{{JWT_PRIVATE_KEY}}"""
JWT_PUBLIC_KEY="""{{JWT_PUBLIC_KEY}}"""
EOF
# Deploy locally with docker compose
deploy-docker: build-docker
docker compose --file dpeloy/docker-compose.yaml up
# Build the application
build: build-bin build-docker

16
deploy/Justfile Normal file
View file

@ -0,0 +1,16 @@
# Deploy the application to fly.io
deploy-fly:
fly deploy --ha=false -c deploy/fly.toml -i {{DOCKER_IMAGE}}
# Read local jwt key and set it as fly secret
deploy-fly-set-jwt-key-secrets:
#!/bin/bash
# https://github.com/superfly/flyctl/issues/589
cat <<EOF | fly secrets import -c deploy/fly.toml
JWT_PRIVATE_KEY="""{{JWT_PRIVATE_KEY}}"""
JWT_PUBLIC_KEY="""{{JWT_PUBLIC_KEY}}"""
EOF
# Deploy locally with docker compose
deploy-docker: build-docker
docker compose --file dpeloy/docker-compose.yaml up

View file

@ -7,6 +7,7 @@
"sqlite@latest",
"sqlite-web@latest",
"go@1.22",
"tailwindcss@latest"
"tailwindcss@latest",
"temporal-cli@latest"
]
}

View file

@ -191,6 +191,54 @@
}
}
},
"temporal-cli@latest": {
"last_modified": "2024-05-29T10:04:41Z",
"resolved": "github:NixOS/nixpkgs/ac82a513e55582291805d6f09d35b6d8b60637a1#temporal-cli",
"source": "devbox-search",
"version": "1.18.1",
"systems": {
"aarch64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/xnv5dw4i4da79zj9albbngb5y576k7zz-temporal-cli-1.18.1",
"default": true
}
],
"store_path": "/nix/store/xnv5dw4i4da79zj9albbngb5y576k7zz-temporal-cli-1.18.1"
},
"aarch64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/qhswqm1sprbvabsy7jzdfh63aihxgmd4-temporal-cli-1.18.1",
"default": true
}
],
"store_path": "/nix/store/qhswqm1sprbvabsy7jzdfh63aihxgmd4-temporal-cli-1.18.1"
},
"x86_64-darwin": {
"outputs": [
{
"name": "out",
"path": "/nix/store/wkdwmyp26fp41nwyfrcnnhlzyw326czw-temporal-cli-1.18.1",
"default": true
}
],
"store_path": "/nix/store/wkdwmyp26fp41nwyfrcnnhlzyw326czw-temporal-cli-1.18.1"
},
"x86_64-linux": {
"outputs": [
{
"name": "out",
"path": "/nix/store/mirn2wzr63kbwjsd9rx0510nma8x9kqc-temporal-cli-1.18.1",
"default": true
}
],
"store_path": "/nix/store/mirn2wzr63kbwjsd9rx0510nma8x9kqc-temporal-cli-1.18.1"
}
}
},
"watchexec@latest": {
"last_modified": "2024-01-27T14:55:31Z",
"resolved": "github:NixOS/nixpkgs/160b762eda6d139ac10ae081f8f78d640dd523eb#watchexec",

22
go.mod
View file

@ -15,11 +15,11 @@ require (
github.com/rubenv/sql-migrate v1.6.1
github.com/sirupsen/logrus v1.9.3
github.com/spf13/viper v1.19.0
github.com/temporalio/ui-server/v2 v2.27.2
github.com/temporalio/ui-server/v2 v2.23.0
go.k6.io/k6 v0.51.0
go.temporal.io/api v1.34.1-0.20240531204243-10273725c6ea
go.temporal.io/sdk v1.26.1
go.temporal.io/server v1.25.0-113.0.0.20240601002043-57f4709bfaa0
go.temporal.io/api v1.29.2
go.temporal.io/sdk v1.26.0
go.temporal.io/server v1.23.0
golang.org/x/exp v0.0.0-20240531132922-fd00a4e0eefc
golang.org/x/oauth2 v0.20.0
gopkg.in/yaml.v3 v3.0.1
@ -42,7 +42,7 @@ require (
github.com/andybalholm/brotli v1.1.0 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/apache/thrift v0.20.0 // indirect
github.com/aws/aws-sdk-go v1.53.14 // indirect
github.com/aws/aws-sdk-go v1.53.15 // indirect
github.com/benbjohnson/clock v1.3.5 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
@ -51,7 +51,7 @@ require (
github.com/cactus/go-statsd-client/v5 v5.1.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chromedp/cdproto v0.0.0-20240529195259-de715aab5f80 // indirect
github.com/chromedp/cdproto v0.0.0-20240602235142-49d0e97b7881 // indirect
github.com/chromedp/sysutil v1.0.0 // indirect
github.com/coreos/go-oidc/v3 v3.10.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
@ -60,7 +60,6 @@ require (
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
@ -89,7 +88,6 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/securecookie v1.1.2 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosimple/unidecode v1.0.1 // indirect
@ -122,7 +120,6 @@ require (
github.com/mstoykov/atlas v0.0.0-20220811071828-388f114305dd // indirect
github.com/mstoykov/k6-taskqueue-lib v0.1.0 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/nexus-rpc/sdk-go v0.0.8-0.20240502185337-2b47041a2cc2 // indirect
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d // indirect
github.com/olivere/elastic/v7 v7.0.32 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
@ -131,17 +128,16 @@ require (
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/prometheus/common v0.54.0 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/redis/go-redis/v9 v9.5.2 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/robfig/cron v1.2.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/locafero v0.5.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/serenize/snaker v0.0.0-20201027110005-a7ad2135616e // indirect
github.com/sony/gobreaker v1.0.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
@ -192,10 +188,10 @@ require (
google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect
google.golang.org/grpc v1.64.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.3 // indirect
gopkg.in/guregu/null.v3 v3.5.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/square/go-jose.v2 v2.6.0 // indirect
gopkg.in/validator.v2 v2.0.1 // indirect
modernc.org/gc/v3 v3.0.0-20240304020402-f0dba7c97c2b // indirect
modernc.org/libc v1.51.0 // indirect

42
go.sum
View file

@ -31,8 +31,8 @@ github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
github.com/apache/thrift v0.20.0 h1:631+KvYbsBZxmuJjYwhezVsrfc/TbqtZV4QcxOX1fOI=
github.com/apache/thrift v0.20.0/go.mod h1:hOk1BQqcp2OLzGsyVXdfMk7YFlMxK3aoEVhjD06QhB8=
github.com/aws/aws-sdk-go v1.53.14 h1:SzhkC2Pzag0iRW8WBb80RzKdGXDydJR9LAMs2GyKJ2M=
github.com/aws/aws-sdk-go v1.53.14/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/aws/aws-sdk-go v1.53.15 h1:FtZmkg7xM8RfP2oY6p7xdKBYrRgkITk9yve2QV7N938=
github.com/aws/aws-sdk-go v1.53.15/go.mod h1:LF8svs817+Nz+DmiMQKTO3ubZ/6IaTpq3TjupRn3Eqk=
github.com/benbjohnson/clock v0.0.0-20160125162948-a620c1cc9866/go.mod h1:UMqtWQTnOe4byzwe7Zhwh8f8s+36uszN51sJrSIZlTE=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
@ -48,6 +48,8 @@ github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4Yn
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b h1:AP/Y7sqYicnjGDfD5VcY4CIfh1hRXBUavxrvELjTiOE=
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b/go.mod h1:ac9efd0D1fsDb3EJvhqgXRbFx7bs2wqZ10HQPeU8U/Q=
github.com/brianvoe/gofakeit/v6 v6.22.0 h1:BzOsDot1o3cufTfOk+fWKE9nFYojyDV+XHdCWL2+uyE=
github.com/brianvoe/gofakeit/v6 v6.22.0/go.mod h1:Ow6qC71xtwm79anlwKRlWZW6zVq9D2XHE4QSSMP/rU8=
github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs=
github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c=
github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA=
@ -118,8 +120,6 @@ github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nos
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I=
github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s=
github.com/go-faker/faker/v4 v4.4.1 h1:LY1jDgjVkBZWIhATCt+gkl0x9i/7wC61gZx73GTFb+Q=
github.com/go-faker/faker/v4 v4.4.1/go.mod h1:HRLrjis+tYsbFtIHufEPTAIzcZiRu0rS9EYl2Ccwme4=
github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU=
github.com/go-gorp/gorp/v3 v3.1.0 h1:ItKF/Vbuj31dmV4jxA1qblpSwkl9g1typ24xoe70IGs=
github.com/go-gorp/gorp/v3 v3.1.0/go.mod h1:dLEjIyyRNiXvNZ8PSmzpt1GsWAUK8kjVhEpjH8TixEw=
@ -209,8 +209,6 @@ github.com/googleapis/enterprise-certificate-proxy v0.3.2 h1:Vie5ybvEvT75RniqhfF
github.com/googleapis/enterprise-certificate-proxy v0.3.2/go.mod h1:VLSiSSBs/ksPL8kq3OBOQ6WRI2QnaFynd1DCjZ62+V0=
github.com/googleapis/gax-go/v2 v2.12.4 h1:9gWcmF85Wvq4ryPFvGFaOgPIs1AQX0d0bcbGw4Z96qg=
github.com/googleapis/gax-go/v2 v2.12.4/go.mod h1:KYEYLorsnIGDi/rPC8b5TdlB9kbKoFubselGIoBMCwI=
github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY=
github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ=
github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA=
github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo=
github.com/gorilla/sessions v1.2.2 h1:lqzMYz6bOfvn2WriPUjNByzeXIlVzURcPmgMczkmTjY=
@ -306,8 +304,6 @@ github.com/mstoykov/k6-taskqueue-lib v0.1.0 h1:M3eww1HSOLEN6rIkbNOJHhOVhlqnqkhYj
github.com/mstoykov/k6-taskqueue-lib v0.1.0/go.mod h1:PXdINulapvmzF545Auw++SCD69942FeNvUztaa9dVe4=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/nexus-rpc/sdk-go v0.0.8-0.20240502185337-2b47041a2cc2 h1:NhCabJX4shhYcqtw52H5gFhLToXDhDKZy3KjB81UcTo=
github.com/nexus-rpc/sdk-go v0.0.8-0.20240502185337-2b47041a2cc2/go.mod h1:uBe8fX151zUW9DhXxwHjji19d6YfnNUqJ81tR3JbwHY=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ=
github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U=
@ -341,8 +337,8 @@ github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJL
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.53.0 h1:U2pL9w9nmJwJDa4qqLQ3ZaePJ6ZTwt7cMD3AG3+aLCE=
github.com/prometheus/common v0.53.0/go.mod h1:BrxBKv3FWBIGXw89Mg1AeBq7FSyRzXWI3l3e7W3RN5U=
github.com/prometheus/common v0.54.0 h1:ZlZy0BgJhTwVZUn7dLOkwCZHUkrAqd3WYtcFCWnM1D8=
github.com/prometheus/common v0.54.0/go.mod h1:/TQgMJP5CuVYveyT7n/0Ix8yLNNXy9yRSkhnLTHPDIQ=
github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc=
github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk=
github.com/rcrowley/go-metrics v0.0.0-20141108142129-dee209f2455f/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
@ -361,8 +357,8 @@ github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU
github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4=
github.com/rubenv/sql-migrate v1.6.1 h1:bo6/sjsan9HaXAsNxYP/jCEDUGibHp8JmOBw7NTGRos=
github.com/rubenv/sql-migrate v1.6.1/go.mod h1:tPzespupJS0jacLfhbwto/UjSX+8h2FdWB7ar+QlHa0=
github.com/sagikazarmark/locafero v0.4.0 h1:HApY1R9zGo4DBgr7dqsTH/JJxLTTsOt7u6keLGt6kNQ=
github.com/sagikazarmark/locafero v0.4.0/go.mod h1:Pe1W6UlPYUk/+wc/6KFhbORCfqzgYEpgQ3O5fPuL3H4=
github.com/sagikazarmark/locafero v0.5.0 h1:zXz2JnQDgE5gDg0R9ThkNT0orQzm47i8IuO6hk6XSYY=
github.com/sagikazarmark/locafero v0.5.0/go.mod h1:77OmuIc6VTraTXKXIs/uvUxKGUXjE1GbemJYHqdNjX0=
github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6gto+ugjYE=
github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ=
github.com/samuel/go-thrift v0.0.0-20190219015601-e8b6b52668fe/go.mod h1:Vrkh1pnjV9Bl8c3P9zH0/D4NlOHWP5d4/hF4YTULaec=
@ -372,8 +368,6 @@ github.com/sirupsen/logrus v1.0.2-0.20170726183946-abee6f9b0679/go.mod h1:pMByvH
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/sony/gobreaker v1.0.0 h1:feX5fGGXSl3dYd4aHZItw+FpHLvvoaqkawKjVNiFMNQ=
github.com/sony/gobreaker v1.0.0/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJOjmxWY=
github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo=
github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0=
github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8=
@ -410,8 +404,8 @@ github.com/temporalio/sqlparser v0.0.0-20231115171017-f4060bcfa6cb/go.mod h1:143
github.com/temporalio/tchannel-go v1.22.1-0.20220818200552-1be8d8cffa5b/go.mod h1:c+V9Z/ZgkzAdyGvHrvC5AsXgN+M9Qwey04cBdKYzV7U=
github.com/temporalio/tchannel-go v1.22.1-0.20240528171429-1db37fdea938 h1:sEJGhmDo+0FaPWM6f0v8Tjia0H5pR6/Baj6+kS78B+M=
github.com/temporalio/tchannel-go v1.22.1-0.20240528171429-1db37fdea938/go.mod h1:ezRQRwu9KQXy8Wuuv1aaFFxoCNz5CeNbVOOkh3xctbY=
github.com/temporalio/ui-server/v2 v2.27.2 h1:MWRJM0GQ1Zb/hECkW/4H6606aYEZolMgH377+LVpP94=
github.com/temporalio/ui-server/v2 v2.27.2/go.mod h1:ttZpCFyLQmLyIbuaP8Zqu6kkoqSM7X4tefAXwF4NcqY=
github.com/temporalio/ui-server/v2 v2.23.0 h1:h5z0k4nLfsKICoenvvIng7NjsRJ3GWc0CKuCtaRgyp0=
github.com/temporalio/ui-server/v2 v2.23.0/go.mod h1:TKQ+QW229khWmUaR1CooYOS5953zZfBXxo8t1Kc5CBY=
github.com/tidwall/gjson v1.17.1 h1:wlYEnwqAHgzmhNUFfw7Xalt2JzQvsMx2Se4PcoFCT/U=
github.com/tidwall/gjson v1.17.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
@ -470,12 +464,12 @@ go.opentelemetry.io/otel/trace v1.27.0 h1:IqYb813p7cmbHk0a5y6pD5JPakbVfftRXABGt5
go.opentelemetry.io/otel/trace v1.27.0/go.mod h1:6RiD1hkAprV4/q+yd2ln1HG9GoPx39SuvvstaLBl+l4=
go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94=
go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A=
go.temporal.io/api v1.34.1-0.20240531204243-10273725c6ea h1:EbqSMAjepkhgXXgPehZPHkJx5SWBpenC3FJk735ZPFE=
go.temporal.io/api v1.34.1-0.20240531204243-10273725c6ea/go.mod h1:1Q2owKQyz6Gdn7rbbSdbsC4Tmuk6uGIJp5oRJlUlyFE=
go.temporal.io/sdk v1.26.1 h1:ggmFBythnuuW3yQRp0VzOTrmbOf+Ddbe00TZl+CQ+6U=
go.temporal.io/sdk v1.26.1/go.mod h1:ph3K/74cry+JuSV9nJH+Q+Zeir2ddzoX2LjWL/e5yCo=
go.temporal.io/server v1.25.0-113.0.0.20240601002043-57f4709bfaa0 h1:o4JH5I1rJO3OfeLq9Fb5eIkPVa7j0TkV2EnCuOfyWmA=
go.temporal.io/server v1.25.0-113.0.0.20240601002043-57f4709bfaa0/go.mod h1:jrN8LWJbUprAc4m2hDd5z6gEYyk1T0yjo7FKcrRRAsk=
go.temporal.io/api v1.29.2 h1:FHY/czjvNIFEL0NSKdX1yFzg1W93iIVarYCdAeeC/O8=
go.temporal.io/api v1.29.2/go.mod h1:d6quqrlxUpLx6ug6PAj721Q42US+LwrO143DX7qoNO0=
go.temporal.io/sdk v1.26.0 h1:QAi7irgKvJI+5cKmvy+1lkdCDJJDDNpIQAoXdr3dcyM=
go.temporal.io/sdk v1.26.0/go.mod h1:rcAf1YWlbWgMsjJEuz7XiQd6UYxTQDOk2AqRRIDwq/U=
go.temporal.io/server v1.23.0 h1:gOVJOfsxVv/7FjVv8Ff6IC8lcMZfB2jXgF8Ghfbw/Jw=
go.temporal.io/server v1.23.0/go.mod h1:ZZ4x5eVQpsp1eV09KydfZPTNF58PQqY6vXjbeXc+yK4=
go.temporal.io/version v0.3.0 h1:dMrei9l9NyHt8nG6EB8vAwDLLTwx2SvRyucCSumAiig=
go.temporal.io/version v0.3.0/go.mod h1:UA9S8/1LaKYae6TyD9NaPMJTZb911JcbqghI2CBSP78=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
@ -674,14 +668,14 @@ gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/go-jose/go-jose.v2 v2.6.3 h1:nt80fvSDlhKWQgSWyHyy5CfmlQr+asih51R8PTWNKKs=
gopkg.in/go-jose/go-jose.v2 v2.6.3/go.mod h1:zzZDPkNNw/c9IE7Z9jr11mBZQhKQTMzoEEIoEdZlFBI=
gopkg.in/guregu/null.v3 v3.5.0 h1:xTcasT8ETfMcUHn0zTvIYtQud/9Mx5dJqD554SZct0o=
gopkg.in/guregu/null.v3 v3.5.0/go.mod h1:E4tX2Qe3h7QdL+uZ3a0vqvYwKQsRSQKM5V4YltdgH9Y=
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI=
gopkg.in/square/go-jose.v2 v2.6.0/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/validator.v2 v2.0.1 h1:xF0KWyGWXm/LM2G1TrEjqOu4pa6coO9AlWSf3msVfDY=

View file

@ -17,6 +17,7 @@ ARCH := "amd64 arm64"
export CGO_ENABLED := "0"
import 'build/Justfile'
import 'deploy/Justfile'
_default:
@just --list
@ -86,10 +87,18 @@ migration-new name:
echo "Created migration file: $FILENAME"
update-dependencies:
# Updating temporal dependencies is a bit tricky
# as finding the right combination of api, server and ui-server
# that work together is not easy.
# Any version of ui-server > 2.23.0 < 2.27.2 is broken for us.
# Using latest of everything results (at the time of writing) in to
# working server but broken ui-server (404 when it tries to list namespaces).
go get -u -t \
go.k6.io/k6@v0.51.0 \
go.temporal.io/server@v1.25.0-113.0.0.20240601002043-57f4709bfaa0 \
go.temporal.io/api@v1.34.1-0.20240531204243-10273725c6ea \
github.com/temporalio/ui-server/v2@v2.23.0 \
go.temporal.io/server@v1.23.0 \
go.temporal.io/api@v1.29.2 \
go.temporal.io/sdk@v1.26.0 \
./...
go mod tidy

40
pkg/temporal/log.go Normal file
View file

@ -0,0 +1,40 @@
package temporal
import (
"context"
"log/slog"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/log/tag"
)
type slogLogger struct {
log *slog.Logger
level slog.Level
}
var _ log.Logger = slogLogger{}
func (s slogLogger) Debug(msg string, tags ...tag.Tag) { s.Log(slog.LevelDebug, msg, tags) }
func (s slogLogger) Info(msg string, tags ...tag.Tag) { s.Log(slog.LevelInfo, msg, tags) }
func (s slogLogger) Warn(msg string, tags ...tag.Tag) { s.Log(slog.LevelWarn, msg, tags) }
func (s slogLogger) Error(msg string, tags ...tag.Tag) { s.Log(slog.LevelError, msg, tags) }
// Panics and fatals are just errors
func (s slogLogger) DPanic(msg string, tags ...tag.Tag) { s.Log(slog.LevelError, msg, tags) }
func (s slogLogger) Panic(msg string, tags ...tag.Tag) { s.Log(slog.LevelError, msg, tags) }
func (s slogLogger) Fatal(msg string, tags ...tag.Tag) { s.Log(slog.LevelError, msg, tags) }
func (s slogLogger) Log(level slog.Level, msg string, tags []tag.Tag) {
if level >= s.level && s.log.Enabled(context.Background(), level) {
s.log.LogAttrs(context.Background(), level, msg, logTagsToAttrs(tags)...)
}
}
func logTagsToAttrs(tags []tag.Tag) []slog.Attr {
attrs := make([]slog.Attr, len(tags))
for i, tag := range tags {
attrs[i] = slog.Any(tag.Key(), tag.Value())
}
return attrs
}

View file

@ -2,23 +2,22 @@ package temporal
import (
"context"
"log/slog"
"os"
"path/filepath"
"go.temporal.io/server/common/authorization"
"go.temporal.io/server/common/config"
"go.temporal.io/server/common/log"
"go.temporal.io/server/common/primitives"
"go.temporal.io/server/schema/sqlite"
t "go.temporal.io/server/temporal"
)
func NewServer(cfg *config.Config, tokenKeyProvider authorization.TokenKeyProvider) (t.Server, error) {
logger := log.NewZapLogger(log.BuildZapLogger(log.Config{
Stdout: true,
Level: "debug",
OutputFile: "",
}))
func NewServer(l *slog.Logger, cfg *config.Config, tokenKeyProvider authorization.TokenKeyProvider) (t.Server, error) {
logger := slogLogger{
log: l,
level: slog.LevelDebug,
}
sqlConfig := cfg.Persistence.DataStores[PersistenceStoreName].SQL

View file

@ -1,6 +1,8 @@
package temporal
import (
"log/slog"
"github.com/mentos1386/zdravko/internal/config"
"github.com/temporalio/ui-server/v2/server"
t "go.temporal.io/server/temporal"
@ -12,9 +14,11 @@ type Temporal struct {
}
func NewTemporal(cfg *config.TemporalConfig) (*Temporal, error) {
logger := slog.Default()
serverConfig := NewServerConfig(cfg)
tokenKeyProvider := TokenKeyProvider{config: cfg}
server, err := NewServer(serverConfig, &tokenKeyProvider)
server, err := NewServer(logger, serverConfig, &tokenKeyProvider)
if err != nil {
return nil, err
}

View file

@ -9,16 +9,11 @@ import (
func NewUiConfig(cfg *internal.TemporalConfig) *config.Config {
return &config.Config{
BannerText: "Hello world!",
Host: cfg.ListenAddress,
Port: 8223,
TemporalGRPCAddress: "0.0.0.0:7233",
EnableUI: true,
PublicPath: "/settings/temporal",
ForwardHeaders: []string{"Authorization"},
Codec: config.Codec{
Endpoint: "",
},
}
}