Skip to content

Commit

Permalink
Merge branch 'main' into issue/#19
Browse files Browse the repository at this point in the history
  • Loading branch information
tkc66-buzz committed Oct 15, 2022
2 parents aa3d258 + 55aacd9 commit 324ec72
Show file tree
Hide file tree
Showing 54 changed files with 1,982 additions and 865 deletions.
5 changes: 3 additions & 2 deletions .github/renovate.json5
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
"groupName": "all minor, patch, or digest dependencies on Go",
},
{
"matchManagers": ["dockerfile"],
"groupName": "all dependencies on Dockerfile",
"matchManagers": ["dockerfile", "docker-compose"],
"groupName": "all dependencies on Docker",
},
{
"matchManagers": ["github-actions"],
Expand All @@ -22,6 +22,7 @@
"enabledManagers": [
"gomod",
"dockerfile",
"docker-compose",
"github-actions",
],
}
2 changes: 1 addition & 1 deletion cmd/cndctl/cmd/scene.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/go-logr/logr"
"github.com/spf13/cobra"

"github.com/cloudnativedaysjp/cnd-operation-server/pkg/infrastructure/obsws"
"github.com/cloudnativedaysjp/cnd-operation-server/pkg/infra/obsws"
pb "github.com/cloudnativedaysjp/cnd-operation-server/pkg/ws-proxy/schema"
)

Expand Down
2 changes: 1 addition & 1 deletion cmd/cndctl/cmd/track.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var trackListCmd = &cobra.Command{
//
// Print
//
for _, track := range resp.Track {
for _, track := range resp.Tracks {
fmt.Printf("%s (trackId: %d)\n", track.ObsHost, track.TrackId)
}
},
Expand Down
2 changes: 1 addition & 1 deletion cmd/server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ FROM gcr.io/distroless/static-debian11:nonroot
WORKDIR /
COPY --from=builder /workspace/server .

ENTRYPOINT ["/cndctl"]
ENTRYPOINT ["/server"]
19 changes: 14 additions & 5 deletions cmd/server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,12 @@ func LoadConf(filename string) (*Config, error) {
}

type Config struct {
Debug DebugConfig `json:"debug"`
WsProxyBindAddr string `json:"bindAddr" default:":20080"`
Dreamkast DreamkastConfig `json:"dreamkast" validate:"required"`
Redis RedisConfig `json:"redis " validate:"required"`
Tracks []TrackConfig `json:"tracks" validate:"required"`
Debug DebugConfig `json:"debug"`
WsProxy WsProxyConfig `json:"wsProxy" validate:"required"`
Metrics MetricsConfig `json:"metrics"`
Dreamkast DreamkastConfig `json:"dreamkast" validate:"required"`
Redis RedisConfig `json:"redis " validate:"required"`
Tracks []TrackConfig `json:"tracks" validate:"required"`
}

type DebugConfig struct {
Expand All @@ -51,6 +52,14 @@ type DebugConfig struct {
DisableWsProxy bool `json:"disableWsProxy"`
}

type MetricsConfig struct {
BindAddr string `json:"bindAddr" default:":20081"`
}

type WsProxyConfig struct {
BindAddr string `json:"bindAddr" default:":20080"`
}

type DreamkastConfig struct {
EventAbbr string `json:"eventAbbr" validate:"required"`
EndpointUrl string `json:"endpointUrl" validate:"required"`
Expand Down
28 changes: 0 additions & 28 deletions cmd/server/example.yaml

This file was deleted.

10 changes: 8 additions & 2 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (

"github.com/cloudnativedaysjp/cnd-operation-server/cmd/server/config"
"github.com/cloudnativedaysjp/cnd-operation-server/pkg/dkwatcher"
"github.com/cloudnativedaysjp/cnd-operation-server/pkg/metrics"
"github.com/cloudnativedaysjp/cnd-operation-server/pkg/model"
"github.com/cloudnativedaysjp/cnd-operation-server/pkg/notifier"
"github.com/cloudnativedaysjp/cnd-operation-server/pkg/obswatcher"
Expand All @@ -33,7 +34,12 @@ func main() {

ctx, cancel := context.WithCancel(context.Background())
eg, ctx := errgroup.WithContext(ctx)
talkStream := make(chan model.Talk, 16)
talkStream := make(chan model.CurrentAndNextTalk, 16)

// metrics
go func() {
_ = metrics.RunCndOperationServer(conf.Metrics.BindAddr)
}()

// obswatcher
if !conf.Debug.DisableObsWatcher {
Expand Down Expand Up @@ -104,7 +110,7 @@ func main() {
return server.Run(ctx, server.Config{
Development: conf.Debug.Development,
Debug: conf.Debug.Debug,
BindAddr: conf.WsProxyBindAddr,
BindAddr: conf.WsProxy.BindAddr,
Obs: configObs,
})
})
Expand Down
1 change: 1 addition & 0 deletions development/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.env
36 changes: 36 additions & 0 deletions development/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
development
===

## 事前準備

手元で Websocket を有効化した OBS を立ち上げ、検証用にシーン・ソースを用意します。

### Download

* [Download OBS](https://obsproject.com/ja/download)
* [Download obs-websocket](https://github.com/obsproject/obs-websocket/releases/)

### 検証用シーン・ソースの準備

TBW

## 検証環境の起動

Docker Compose を用い、cnd-operation-server, seaman (SlackBot), dk-mock-server (Dreamkast API の Mock Server) を立ち上げます。

* `.env` ファイルの作成

```
SLACK_BOT_TOKEN=...
SLACK_APP_TOKEN=...
SWITHCER01_SLACK_CHANNEL_ID=...
GITHUB_ACCESS_TOKEN=...
SWITCHER01_HOST=...
SWITCHER01_PASSWORD=...
```

* コンテナの起動

```bash
docker compose up -d
```
13 changes: 13 additions & 0 deletions development/cnd-operation-server.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
wsProxy:
bindAddr: :20080
dreamkast:
eventAbbr: cnsec2022
endpointUrl: ${DK_ENDPOINT_URL}
tracks:
- dkTrackId: 29
obs:
host: ${SWITCHER01_HOST}
password: ${SWITCHER01_PASSWORD}
slack:
botToken: ${SLACK_BOT_TOKEN}
channelId: ${SWITCHER01_SLACK_CHANNEL_ID}
Loading

0 comments on commit 324ec72

Please sign in to comment.