Skip to content

Commit

Permalink
Merge pull request #178 from kubeagi/bjwswang
Browse files Browse the repository at this point in the history
fix: remove post-upgrade to arcadia;update graphql-server readme
  • Loading branch information
bjwswang authored Nov 3, 2023
2 parents 66806e1 + 85b9996 commit 4286100
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 33 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,5 @@ arctl: fmt vet ## Build manager binary.
# graphql-server go
gql-gen:
@go run github.com/99designs/[email protected] generate
build-graphql-server:
@CGO_ENABLED=0 GOOS=linux go build -o go-bff-server graphql-server/go-server/main.go
build-graphql-server: gql-gen
@CGO_ENABLED=0 GOOS=linux go build -o bin/graphql-server graphql-server/go-server/main.go
1 change: 0 additions & 1 deletion assets/dataset_flow.drawio

This file was deleted.

Binary file removed assets/dataset_flow.drawio.png
Binary file not shown.
2 changes: 1 addition & 1 deletion charts/arcadia/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: arcadia
description: A Helm chart(KubeBB Component) for KubeAGI Arcadia
type: application
version: 0.1.14
version: 0.1.15
appVersion: "0.0.1"

keywords:
Expand Down
2 changes: 1 addition & 1 deletion charts/arcadia/templates/post-oss.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ metadata:
name: {{ .Release.Name }}-minio
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/hook": post-install,post-upgrade
"helm.sh/hook": post-install
"helm.sh/hook-weight": "1"
spec:
displayName: "内置系统数据源"
Expand Down
57 changes: 38 additions & 19 deletions graphql-server/go-server/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# graphql go server



## How to develop

**There can only be one Query structure in all schemas, and Mutation can have one or none.**
Expand Down Expand Up @@ -52,33 +56,48 @@ All we have to do is just implement the `FindX` function. And the content of the

## How to run

in the root dir of the project
At the root dir of the project

1. Build graphql server

```shell
# 1. build
make build-graphql-server
```

# 2. run parameters
$ ./go-bff-server -h
Usage of ./main:
2. Try graphql-server

```shell
$ ./bin/graphql-server -h
Usage of ./bin/graphql-server:
-host string
bind to the host, default is 0.0.0.0
-port int
service listening port (default 8081)
-enable-playground
whether to enable the graphql playground
-enable-oidc
whether to enable oidc authentication
-client-id string
oidc client id
oidc client id
-client-secret string
oidc client secret
-enable-playgroud
whether to open the graphql playground (default true)
-host string
bind to the host, default is 0.0.0.0
oidc client secret
-master-url string
k8s master url
-issuer-url string
oidc issuer url
oidc issuer url
-kubeconfig string
Paths to a kubeconfig. Only required if out-of-cluster.
-master-url string
k8s master url
-port int
service listening port (default 8081)
Paths to a kubeconfig. Only required if out-of-cluster.
```
3. Run graphql-server
# 3. run
./go-bff-server --client-id=bff-client --client-secret=some-secret --master-url=https://k8s-adress --issuer-url=https://oidc-server
> If you don't want to try playground,do not pass flag `-enable-plaground`
```shell
./bin/graphql-server -enable-playground --client-id=bff-client --client-secret=some-secret --master-url=https://k8s-adress --issuer-url=https://oidc-server
```
4. Try apis with plaground
Open http://localhost:8081/ in your browser!
20 changes: 11 additions & 9 deletions graphql-server/go-server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ import (
)

var (
host = flag.String("host", "", "bind to the host, default is 0.0.0.0")
port = flag.Int("port", 8081, "service listening port")
enablePlayground = flag.Bool("enable-playgroud", true, "whether to open the graphql playground")

issuerURL = flag.String("issuer-url", "", "oidc issuer url")
masterURL = flag.String("master-url", "", "k8s master url")
clientSecret = flag.String("client-secret", "", "oidc client secret")
clientID = flag.String("client-id", "", "oidc client id")
host = flag.String("host", "", "bind to the host, default is 0.0.0.0")
port = flag.Int("port", 8081, "service listening port")

enablePlayground = flag.Bool("enable-playground", false, "enable the graphql playground")

// Flags fro oidc client
issuerURL = flag.String("issuer-url", "", "oidc issuer url(required when enable odic)")
masterURL = flag.String("master-url", "", "k8s master url(required when enable odic)")
clientID = flag.String("client-id", "", "oidc client id(required when enable odic)")
clientSecret = flag.String("client-secret", "", "oidc client secret(required when enable odic)")
)

func main() {
Expand All @@ -61,7 +63,7 @@ func main() {
})

if *enablePlayground {
http.Handle("/", auth.AuthInterceptor(oidc.Verifier, playground.Handler("Arcadia-BFF-Server", "/query")))
http.Handle("/", auth.AuthInterceptor(oidc.Verifier, playground.Handler("Arcadia-Graphql-Server", "/query")))
}
http.Handle("/query", auth.AuthInterceptor(oidc.Verifier, srv.ServeHTTP))

Expand Down

0 comments on commit 4286100

Please sign in to comment.