Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration proto and start gRPC/HTTP servers using config #31

Merged
merged 7 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,17 @@
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
load("@gazelle//:def.bzl", "gazelle")

# gazelle:go_grpc_compilers @rules_go//proto:go_proto,@rules_go//proto:go_grpc_v2
# gazelle:prefix github.com/buildbarn/bb-portal
# gazelle:go_naming_convention_external import
# gazelle:resolve proto go pkg/proto/configuration/auth/auth.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/auth
# gazelle:resolve proto go pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global
# gazelle:resolve proto go pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc
# gazelle:resolve proto go pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http
# gazelle:resolve proto pkg/proto/configuration/auth/auth.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/auth:auth_proto
# gazelle:resolve proto pkg/proto/configuration/global/global.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/global:global_proto
# gazelle:resolve proto pkg/proto/configuration/grpc/grpc.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/grpc:grpc_proto
# gazelle:resolve proto pkg/proto/configuration/http/http.proto @com_github_buildbarn_bb_storage//pkg/proto/configuration/http:http_proto
gazelle(
name = "gazelle",
)
Expand Down
2 changes: 2 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ bazel_dep(name = "com_github_buildbarn_bb_storage")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "googleapis", version = "0.0.0-20240819-fe8ba054a")
bazel_dep(name = "googletest", version = "1.15.2")
bazel_dep(name = "protobuf", version = "27.3")
bazel_dep(name = "rules_go", version = "0.50.1")
bazel_dep(name = "rules_jsonnet", version = "0.6.0")
bazel_dep(name = "rules_oci", version = "1.8.0")
Expand Down Expand Up @@ -58,6 +59,7 @@ use_repo(
"com_github_fsnotify_fsnotify",
"com_github_google_shlex",
"com_github_google_uuid",
"com_github_gorilla_mux",
"com_github_hashicorp_go_multierror",
"com_github_hedwigz_entviz",
"com_github_machinebox_graphql",
Expand Down
105 changes: 105 additions & 0 deletions MODULE.bazel.lock

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

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ npm install
From repository root, run:

```
go run cmd/bb_portal/main.go
bazel run //cmd/bb_portal -- --config-file=$PWD/config/portal.jsonnet
```

The backend runs a reverse proxy for the frontend.
Expand All @@ -42,10 +42,9 @@ npm run dev
### Change where the backend listens

You can run the backend on different bind addresses, but you'll need to update
the frontend too:
the frontend too. Modify the backend ports in the config file, and run the frontend:

```
go run ../cmd/bb_portal/main.go --bind-http=:9091 --bind-grpc=:9092 &
NEXT_PUBLIC_BES_BACKEND_URL=http://localhost:9091 NEXT_PUBLIC_BES_GRPC_BACKEND_URL=grpc://localhost:9092 npm run dev
```

Expand Down
30 changes: 20 additions & 10 deletions cmd/bb_portal/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,37 @@ load("@rules_oci//oci:defs.bzl", "oci_image", "oci_image_index")

go_library(
name = "bb_portal_lib",
srcs = ["main.go"],
srcs = [
"main.go",
"portal_service.go",
],
importpath = "github.com/buildbarn/bb-portal/cmd/bb_portal",
visibility = ["//visibility:private"],
deps = [
"//ent/gen/ent",
"//ent/gen/ent/migrate",
"//internal/api",
"//internal/api/grpc",
"//internal/api/grpc/bes",
"//internal/graphql",
"//pkg/cas",
"//pkg/processing",
"//pkg/proto/configuration/bb_portal",
"@com_github_99designs_gqlgen//graphql/handler",
"@com_github_99designs_gqlgen//graphql/handler/debug",
"@com_github_99designs_gqlgen//graphql/playground",
"@com_github_buildbarn_bb_storage//pkg/global",
"@com_github_buildbarn_bb_storage//pkg/grpc",
"@com_github_buildbarn_bb_storage//pkg/http",
"@com_github_buildbarn_bb_storage//pkg/program",
"@com_github_buildbarn_bb_storage//pkg/util",
"@com_github_fsnotify_fsnotify//:fsnotify",
"@com_github_gorilla_mux//:mux",
"@com_github_mattn_go_sqlite3//:go-sqlite3",
"@io_entgo_contrib//entgql",
"@org_golang_google_genproto//googleapis/devtools/build/v1:build",
"@org_golang_google_grpc//:grpc",
],
)

go_binary(
name = "bb_portal",
cgo = True, # keep
embed = [":bb_portal_lib"],
visibility = ["//visibility:public"],
)

multiarch_go_image(
name = "bb_portal_container",
binary = ":bb_portal",
Expand All @@ -41,3 +45,9 @@ container_push_official(
component = "bb-portal",
image = ":bb_portal_container",
)

go_binary(
name = "bb_portal",
embed = [":bb_portal_lib"],
visibility = ["//visibility:public"],
)
Loading
Loading