diff --git a/architecture.d2 b/architecture.d2 new file mode 100644 index 0000000..7b36327 --- /dev/null +++ b/architecture.d2 @@ -0,0 +1,27 @@ +browser -> backend.server: REST API + +GitHub: { + shape: cloud + icon: https://icons.terrastruct.com/dev%2Fgithub.svg +} + +GitHub -> backend.server: webhook events + +backend.server <-> backend.storage.Postgres: read/write data +backend.server <-> backend.storage.Redis: store KV data +backend.server <-> backend.storage.Influx: read data + +backend.storage.Postgres.shape: cylinder +backend.storage.Redis.shape: cylinder +backend.storage.Influx.shape: cylinder + +backend.gh-updater -- backend.storage.Postgres: listen to build status changes +backend.gh-updater -> GitHub: write check status + +backend.executors.executor 1 -> backend.storage.Postgres: build status data +backend.executors.executor 2 -> backend.storage.Postgres: build status data +backend.executors.executor n -> backend.storage.Postgres: build status data + +backend.executors.executor 1 -> backend.storage.Influx: build logs +backend.executors.executor 2 -> backend.storage.Influx: build logs +backend.executors.executor n -> backend.storage.Influx: build logs diff --git a/backend/cmd/server/main.go b/backend/cmd/server/main.go index f3ffa6d..77aa606 100644 --- a/backend/cmd/server/main.go +++ b/backend/cmd/server/main.go @@ -5,9 +5,6 @@ import ( "crypto/tls" "encoding/base64" "fmt" - "github.com/bee-ci/bee-ci-system/internal/common/ghservice" - "github.com/golang-jwt/jwt/v5" - "github.com/redis/go-redis/v9" "log/slog" "net/http" "os" @@ -15,6 +12,10 @@ import ( "strconv" "time" + "github.com/bee-ci/bee-ci-system/internal/common/ghservice" + "github.com/golang-jwt/jwt/v5" + "github.com/redis/go-redis/v9" + influxdb2 "github.com/influxdata/influxdb-client-go/v2" "github.com/bee-ci/bee-ci-system/internal/common/middleware" diff --git a/backend/internal/server/webhook/webhook.go b/backend/internal/server/webhook/webhook.go index 0425f7e..3dbc083 100644 --- a/backend/internal/server/webhook/webhook.go +++ b/backend/internal/server/webhook/webhook.go @@ -7,7 +7,6 @@ import ( "embed" "encoding/json" "fmt" - "github.com/bee-ci/bee-ci-system/internal/common/ghservice" "html/template" "io" "log" @@ -18,6 +17,8 @@ import ( "strconv" "time" + "github.com/bee-ci/bee-ci-system/internal/common/ghservice" + "github.com/golang-jwt/jwt/v5" "github.com/google/go-github/v64/github"