diff --git a/.github/workflows/build-backend-container.yaml b/.github/workflows/build-backend-container.yaml new file mode 100644 index 0000000..6943af8 --- /dev/null +++ b/.github/workflows/build-backend-container.yaml @@ -0,0 +1,34 @@ +name: build-twitch-alerts + +on: + push: + branches: + - 'main' + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push API + uses: docker/build-push-action@v4 + with: + context: ./ + push: true + tags: nullchannel/twitch-alerts:${{ github.sha }} diff --git a/.github/workflows/build-ui-container.yaml b/.github/workflows/build-ui-container.yaml new file mode 100644 index 0000000..e583285 --- /dev/null +++ b/.github/workflows/build-ui-container.yaml @@ -0,0 +1,42 @@ +name: build-twitch-alerts + +on: + push: + branches: + - 'main' + workflow_dispatch: + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - + name: Checkout + uses: actions/checkout@v3 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v2 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Install Trunk + run: cargo install --locked trunk + - + name: Build UI + run: | + cd frontend/wasm + trunk build --release + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - + name: Build and push API + uses: docker/build-push-action@v4 + with: + context: ./frontend/wasm/ + push: true + tags: nullchannel/twitch-alerts:${{ github.sha }} diff --git a/Cargo.toml b/Cargo.toml index d46db59..fcf85f6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] + members = [ "ai_manager_service", "twitch_listener_service", @@ -12,10 +13,50 @@ members = [ "twitch_chat", "light_server", ] +resolver = "2" + exclude = [ "twitch_api" ] +[workspace.dependencies] +anyhow = "1.0" +sqlx = { version = "0.7.1", features = ["sqlite", "runtime-tokio-native-tls"] } +structopt = "0.3" +twitch_api = { git = "https://github.com/twitch-rs/twitch_api.git", features = [ + "reqwest", + "helix", + "eventsub", + "hmac", + "unsupported", + "mock_api"] } + +clap = { version = "4.1.8", features = ["derive", "env"] } +color-eyre = { version = "0.6", features = ["capture-spantrace"] } +dotenvy = "0.15.6" +eyre = { version = "0.6" } +futures = "0.3.26" +hyper = "0.14" +reqwest = { version = "0.12.4", features = ["json"] } +retainer = "0.3.0" +serde = { version = "1", features = ["derive"] } +serde_json = { version = "1" } +tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"] } +tokio-tungstenite = { version = "0.20.0", features = ["native-tls"] } +tracing = "0.1.37" +tracing-error = "0.2.0" +tracing-log = "0.1.3" +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } +url = "2.3.1" +messages = { path = "messages" } +ai_manager_service = { path = "ai_manager_service" } +twitch_listener_service = { path = "twitch_listener_service" } +frontend_api = { path = "frontend_api" } + +# trying to fix broken dependencies +twitch_oauth2 = { git = "https://github.com/twitch-rs/twitch_api/" } +twitch_types = { git = "https://github.com/twitch-rs/twitch_api/" } +# workaround for https://github.com/twitch-rs/twitch_api/issues/256 [patch.crates-io.twitch_types] git = "https://github.com/twitch-rs/twitch_api" [patch.crates-io.twitch_oauth2] diff --git a/alerts.db b/alerts.db index b644221..d7d96d2 100644 Binary files a/alerts.db and b/alerts.db differ diff --git a/alerts.db-shm b/alerts.db-shm deleted file mode 100644 index 6090bca..0000000 Binary files a/alerts.db-shm and /dev/null differ diff --git a/alerts.db-wal b/alerts.db-wal deleted file mode 100644 index 07ded73..0000000 Binary files a/alerts.db-wal and /dev/null differ diff --git a/frontend_api/src/lib.rs b/frontend_api/src/lib.rs index 352ec95..75ef402 100644 --- a/frontend_api/src/lib.rs +++ b/frontend_api/src/lib.rs @@ -24,6 +24,7 @@ pub type ConnectionMap = Arc>>; pub struct FrontendApi { address: String, connection_state: ConnectionMap, + message_queue: std::collections::VecDeque, } impl FrontendApi { @@ -31,6 +32,7 @@ impl FrontendApi { FrontendApi { address: addr, connection_state: ConnectionMap::new(Mutex::new(HashMap::new())), + message_queue: std::collections::VecDeque::new(), } } diff --git a/monolith/Cargo.toml b/monolith/Cargo.toml index 631e122..7283c13 100644 --- a/monolith/Cargo.toml +++ b/monolith/Cargo.toml @@ -7,42 +7,36 @@ edition = "2021" [dependencies] -anyhow = "1.0" -sqlx = { version = "0.7.1", features = ["sqlite", "runtime-tokio-native-tls"] } -structopt = "0.3" -twitch_api = { git = "https://github.com/twitch-rs/twitch_api.git", features = [ - "reqwest", - "helix", - "eventsub", - "hmac", - "unsupported", - "mock_api"] } +anyhow = { workspace = true } +sqlx = { workspace = true } +structopt = { workspace = true } +twitch_api = { workspace = true } -clap = { version = "4.1.8", features = ["derive", "env"] } -color-eyre = { version = "0.6", features = ["capture-spantrace"] } -dotenvy = "0.15.6" -eyre = { version = "0.6" } -futures = "0.3.26" -hyper = "0.14" -reqwest = { version = "0.12.4", features = ["json"] } -retainer = "0.3.0" -serde = { version = "1", features = ["derive"] } -serde_json = { version = "1" } -tokio = { version = "1.26.0", features = ["macros", "rt-multi-thread"] } -tokio-tungstenite = { version = "0.20.0", features = ["native-tls"] } -tracing = "0.1.37" -tracing-error = "0.2.0" -tracing-log = "0.1.3" -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -url = "2.3.1" -messages = { path = "../messages" } -ai_manager_service = { path = "../ai_manager_service" } -twitch_listener_service = { path = "../twitch_listener_service" } -frontend_api = { path = "../frontend_api" } +clap = { workspace = true } +color-eyre = { workspace = true } +dotenvy = { workspace = true } +eyre = { workspace = true } +futures = { workspace = true } +hyper = { workspace = true } +reqwest = { workspace = true } +retainer = { workspace = true } +serde = { workspace = true } +serde_json = { workspace = true } +tokio = { workspace = true } +tokio-tungstenite = { workspace = true } +tracing = { workspace = true } +tracing-error = { workspace = true } +tracing-log = { workspace = true } +tracing-subscriber = { workspace = true } +url = { workspace = true } +messages = { workspace = true } +ai_manager_service = { workspace = true } +twitch_listener_service = { workspace = true } +frontend_api = { workspace = true } # trying to fix broken dependencies -twitch_oauth2 = { git = "https://github.com/twitch-rs/twitch_api/" } -twitch_types = { git = "https://github.com/twitch-rs/twitch_api/" } +twitch_oauth2 = { workspace = true } +twitch_types = { workspace = true } # workaround for https://github.com/twitch-rs/twitch_api/issues/256 [patch.crates-io.twitch_types] git = "https://github.com/twitch-rs/twitch_api"