Skip to content

Commit

Permalink
working
Browse files Browse the repository at this point in the history
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
  • Loading branch information
golanglemonade committed Sep 28, 2024
1 parent a4f14b9 commit 27249f0
Show file tree
Hide file tree
Showing 40 changed files with 414 additions and 366 deletions.
8 changes: 4 additions & 4 deletions cmd/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (

"github.com/theopenlane/utils/cache"

"github.com/theopenlane/core/internal/db"
ent "github.com/theopenlane/core/internal/ent/generated"
"github.com/theopenlane/core/internal/entdb"
"github.com/theopenlane/core/internal/httpserve/authmanager"
"github.com/theopenlane/core/internal/httpserve/config"
"github.com/theopenlane/core/internal/httpserve/server"
Expand Down Expand Up @@ -117,12 +117,12 @@ func serve(ctx context.Context) error {
riverqueue.WithConnectionURI(so.Config.Settings.JobQueue.ConnectionURI),
}

dbClient, err := db.New(ctx, so.Config.Settings.DB, entOpts, jobOpts)
dbClient, err := entdb.New(ctx, so.Config.Settings.DB, jobOpts, entOpts...)
if err != nil {
return err
}

defer dbClient.Close()
defer dbClient.CloseAll()

// Add Driver to the Handlers Config
so.Config.Handler.DBClient = dbClient
Expand All @@ -132,7 +132,7 @@ func serve(ctx context.Context) error {

// add ready checks
so.AddServerOptions(
serveropts.WithReadyChecks(dbClient.Config, fgaClient, redisClient),
serveropts.WithReadyChecks(dbClient.Config, fgaClient, redisClient, dbClient.Job),
)

// add auth options
Expand Down
4 changes: 3 additions & 1 deletion docker/docker-compose-riverboat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ services:
riverboat:
# the taskfile will set the tag based on the architecture, if you are running on x86_64 it will use the amd64-latest tag
# if you run without the taskfile and the env var set it will default to arm64-latest
image: ghcr.io/theopenlane/riverboat:${RIVERBOAT_TAG:-arm64-latest}
# image: ghcr.io/theopenlane/riverboat:${RIVERBOAT_TAG:-arm64-latest}
image: ghcr.io/theopenlane/riverboat:arm64-78-90832455
container_name: riverboat
environment:
# this needs to use host.docker.internal since it is a seperate docker-compose file
- RIVERBOAT_JOBQUEUE_DATABASEHOST=postgres://postgres:password@host.docker.internal:5432/jobs?sslmode=disable
- RIVERBOAT_RUNMIGRATIONS=true
command:
- serve
- --debug
Expand Down
14 changes: 6 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ module github.com/theopenlane/core

go 1.23.1

replace github.com/theopenlane/riverboat => ../riverboat

require (
ariga.io/entcache v0.1.0
entgo.io/contrib v0.6.0
Expand Down Expand Up @@ -45,8 +43,8 @@ require (
github.com/prometheus/client_golang v1.20.4
github.com/ravilushqa/otelgqlgen v0.17.0
github.com/redis/go-redis/v9 v9.6.1
github.com/riverqueue/river v0.12.0
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.12.0
github.com/riverqueue/river v0.12.1
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.12.1
github.com/rs/zerolog v1.33.0
github.com/samber/lo v1.47.0
github.com/spf13/cobra v1.8.1
Expand All @@ -61,7 +59,7 @@ require (
github.com/theopenlane/httpsling v0.2.1
github.com/theopenlane/iam v0.2.0
github.com/theopenlane/newman v0.1.1
github.com/theopenlane/riverboat v0.0.3
github.com/theopenlane/riverboat v0.0.4
github.com/theopenlane/utils v0.2.1
github.com/vektah/gqlparser/v2 v2.5.16
github.com/wundergraph/graphql-go-tools v1.67.4
Expand Down Expand Up @@ -195,9 +193,9 @@ require (
github.com/prometheus/procfs v0.15.1 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/resend/resend-go/v2 v2.11.0 // indirect
github.com/riverqueue/river/riverdriver v0.12.0 // indirect
github.com/riverqueue/river/rivershared v0.12.0 // indirect
github.com/riverqueue/river/rivertype v0.12.0 // indirect
github.com/riverqueue/river/riverdriver v0.12.1 // indirect
github.com/riverqueue/river/rivershared v0.12.1 // indirect
github.com/riverqueue/river/rivertype v0.12.1 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
Expand Down
26 changes: 14 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,18 @@ github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/resend/resend-go/v2 v2.11.0 h1:Ja5eXizUCbvyLgbiP8sFsJW/UN1b7d6IEUqi80IlgiU=
github.com/resend/resend-go/v2 v2.11.0/go.mod h1:ihnxc7wPpSgans8RV8d8dIF4hYWVsqMK5KxXAr9LIos=
github.com/riverqueue/river v0.12.0 h1:ZkzSH0wyXtg8lSJdLSVl4sdZ9aNUiCi/CG9LzSbanpA=
github.com/riverqueue/river v0.12.0/go.mod h1:uMocd8FYK6YFHMyYzptAhGETtrjh9oTzXdQBzBOlIT0=
github.com/riverqueue/river/riverdriver v0.12.0 h1:ONm3MfrmA/Yg6oaus5LP9w8vj3OvTlS5y+F45JmJR3I=
github.com/riverqueue/river/riverdriver v0.12.0/go.mod h1:/gc34Xm61CSZl/m96LcreD4L8LPAlN7VadFDTOVsgEs=
github.com/riverqueue/river/riverdriver/riverdatabasesql v0.12.0 h1:P8rgOutF3DqDiLKgetUy38X9JZKWOzsEGW/oC0qkOjM=
github.com/riverqueue/river/riverdriver/riverdatabasesql v0.12.0/go.mod h1:QGsr8DbI/DTDZCsmdDVnKQfltnzcFwj3TgVmj1N25Fc=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.12.0 h1:2Y77a6pe/UXQU3vn2ombU8sA1iIy2c7GJJ3XXM9Qqds=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.12.0/go.mod h1:qYxaATboRtB3tAPlBGF4zxUpfcPo61jPPO3xAa+j450=
github.com/riverqueue/river/rivershared v0.12.0 h1:zLAh2A9quwBbGIXzUtedQUupz1VnWwV/R3biV1UVIfY=
github.com/riverqueue/river/rivershared v0.12.0/go.mod h1:PbbRy9ZgezvfFSpLC+TwRCEd6+dgsvkWXfqaSQO+4SQ=
github.com/riverqueue/river/rivertype v0.12.0 h1:fgAIUc09QUjW/8seNJ7BL5GvNvdpqX9ggPk4sPxa7Vc=
github.com/riverqueue/river/rivertype v0.12.0/go.mod h1:3WRQEDlLKZky/vGwFcZC3uKjC+/8izE6ucHwCsuir98=
github.com/riverqueue/river v0.12.1 h1:TS3FVioPStlvb7yj1dYgtgX+zn/3JkLdPn+S6qNBcZ0=
github.com/riverqueue/river v0.12.1/go.mod h1:j7O42JlHo76YgXkAFX66E63Ke890/oSUUlui/ImyLuU=
github.com/riverqueue/river/riverdriver v0.12.1 h1:MqAh6mw9h/m/nNXImJTXXtCefTDPdmZSlgsUdSYUHe0=
github.com/riverqueue/river/riverdriver v0.12.1/go.mod h1:E4hf4wPidG0xYrwsez4R9u4LvLdjlDu9m4iJFpb1DfQ=
github.com/riverqueue/river/riverdriver/riverdatabasesql v0.12.1 h1:E2pYemeaaiqOqr1x1Cq872IdulGu5z/iIHChqxPJwfA=
github.com/riverqueue/river/riverdriver/riverdatabasesql v0.12.1/go.mod h1:+5DVUCfdPS3ZtsRm4V0GzQfXJI9MsFvq3BNqW/Nei3E=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.12.1 h1:stodaBk+GKMU4Uwoj2tShG5L/EK/E5gWOQwZhsJ65QY=
github.com/riverqueue/river/riverdriver/riverpgxv5 v0.12.1/go.mod h1:kwV0SdmvBYOj3hsI4sn3tQQQ5NqXrq68yDvKb1Jms1E=
github.com/riverqueue/river/rivershared v0.12.1 h1:7y03CM6iYrSoT1k6ylneTIoK74qQ27yi1aoT3dozU6Y=
github.com/riverqueue/river/rivershared v0.12.1/go.mod h1:IpJ63Jz/Rx61nKhJ45K9IdJR0VEHf3qnFlEPI9l11HM=
github.com/riverqueue/river/rivertype v0.12.1 h1:iTciVhZ/yQQQBMAouivPrSlrQH8MEK5uCVtzu3eITu8=
github.com/riverqueue/river/rivertype v0.12.1/go.mod h1:3WRQEDlLKZky/vGwFcZC3uKjC+/8izE6ucHwCsuir98=
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
Expand Down Expand Up @@ -524,6 +524,8 @@ github.com/theopenlane/iam v0.2.0 h1:TGFk4ToN6XVKQXJvyA2cNiVQfWmDnpDD9oV2B2qJndk
github.com/theopenlane/iam v0.2.0/go.mod h1:8nPT57sPCoOzf5QeSbfEonDkZBTQpwIYnN8L8ibJbW8=
github.com/theopenlane/newman v0.1.1 h1:pxGPRcy8kXQplfv4Sp1N3XUkWmx/scZvp7oj+y2l8wI=
github.com/theopenlane/newman v0.1.1/go.mod h1:A37pInKEYsdvUmjQzTDv7x5T4KhMxoFW105DA3XvH4Y=
github.com/theopenlane/riverboat v0.0.4 h1:4ADdCMIyArm3a8gW7EwmCbpX+Ti8hKHHgK6M79KS3YI=
github.com/theopenlane/riverboat v0.0.4/go.mod h1:yvXaeXRnPGe8xHj08K6SlUHGQAnR72mDxK5VFFpu6sY=
github.com/theopenlane/utils v0.2.1 h1:T6VfvOQDcAXBa1NFVL4QCsCbHvVQkp6Tl4hGJVd7TwQ=
github.com/theopenlane/utils v0.2.1/go.mod h1:ydEtwhmEvkVt3KKmNqiQiSY5b3rKH7U4umZ3QbFDsxU=
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
Expand Down
85 changes: 0 additions & 85 deletions internal/db/client.go

This file was deleted.

2 changes: 0 additions & 2 deletions internal/db/doc.go

This file was deleted.

5 changes: 0 additions & 5 deletions internal/ent/entc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
"github.com/theopenlane/emailtemplates"
"github.com/theopenlane/iam/entfga"
"github.com/theopenlane/iam/fgax"
"github.com/theopenlane/riverboat/pkg/riverqueue"
"gocloud.dev/secrets"

"github.com/theopenlane/entx"
Expand Down Expand Up @@ -103,10 +102,6 @@ func main() {
entc.DependencyName("Emailer"),
entc.DependencyType(&emailtemplates.Config{}),
),
entc.Dependency(
entc.DependencyName("Job"),
entc.DependencyType(&riverqueue.Client{}),
),
entc.Dependency(
entc.DependencyName("TOTP"),
entc.DependencyType(&totp.Manager{}),
Expand Down
66 changes: 57 additions & 9 deletions internal/ent/generated/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 27249f0

Please sign in to comment.