From c107162377185073f224a8e40366721603003783 Mon Sep 17 00:00:00 2001 From: max funk Date: Wed, 21 Aug 2024 17:10:13 -0700 Subject: [PATCH 1/5] add rust measure service to workspace --- Cargo.toml | 1 + project.yaml | 26 +++++ services/measure/Cargo.toml | 16 +++ services/measure/makefile | 3 + services/measure/src/main.rs | 184 +++++++++++++++++++++++++++++++++++ 5 files changed, 230 insertions(+) create mode 100644 services/measure/Cargo.toml create mode 100644 services/measure/makefile create mode 100644 services/measure/src/main.rs diff --git a/Cargo.toml b/Cargo.toml index dc00e349..8de8049d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ members = [ "services/balance-by-account", "services/event", "services/graphql", + "services/measure", "services/request-approve", "services/request-by-id", "services/request-create", diff --git a/project.yaml b/project.yaml index 171f8ae4..ae960c28 100644 --- a/project.yaml +++ b/project.yaml @@ -599,6 +599,32 @@ services: - REDIS_PORT - REDIS_USERNAME - REDIS_PASSWORD + measure: + runtime: rust1.x + min_code_cov: null + type: app + local_dev: true + params: [] + deploy: false + build_src_path: null + dependents: [] + env_var: + set: + MEASURE_PORT: + ssm: null + default: 10010 + get: + - PGHOST + - PGPORT + - PGUSER + - PGPASSWORD + - PGDATABASE + - REDIS_DB + - REDIS_HOST + - REDIS_PORT + - REDIS_USERNAME + - REDIS_PASSWORD + - MEASURE_PORT auto-confirm: runtime: rust1.x min_code_cov: null diff --git a/services/measure/Cargo.toml b/services/measure/Cargo.toml new file mode 100644 index 00000000..093fd96b --- /dev/null +++ b/services/measure/Cargo.toml @@ -0,0 +1,16 @@ +[package] +name = "measure" +version = "0.1.0" +edition = "2021" +rust-version.workspace = true + +[dependencies] +axum = { version = "0.7.5", features = ["ws"] } +tracing = "0.1.40" +tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } +tokio = { version = "1.35.1", features = ["macros", "rt-multi-thread"] } +shutdown = { path = "../../crates/shutdown" } +futures = "0.3.30" +serde = { version = "1.0.208", features = ["serde_derive"] } +fred = {version = "9.1.1", default-features = false, features = ["i-pubsub"] } +pg = { path = "../../crates/pg" } \ No newline at end of file diff --git a/services/measure/makefile b/services/measure/makefile new file mode 100644 index 00000000..bd8fbfe1 --- /dev/null +++ b/services/measure/makefile @@ -0,0 +1,3 @@ +RELATIVE_PROJECT_ROOT_PATH=$(shell REL_PATH="."; while [ $$(ls "$$REL_PATH" | grep project.yaml | wc -l | xargs) -eq 0 ]; do REL_PATH="$$REL_PATH./.."; done; printf '%s' "$$REL_PATH") +include $(RELATIVE_PROJECT_ROOT_PATH)/make/shared.mk +include $(RELATIVE_PROJECT_ROOT_PATH)/make/rust.mk \ No newline at end of file diff --git a/services/measure/src/main.rs b/services/measure/src/main.rs new file mode 100644 index 00000000..3155223a --- /dev/null +++ b/services/measure/src/main.rs @@ -0,0 +1,184 @@ +use axum::{ + extract::{ + connect_info::ConnectInfo, + // https://github.com/tokio-rs/axum/blob/main/examples/websockets/src/main.rs + ws::{Message, WebSocket, WebSocketUpgrade}, + Query, + State, + }, + response::IntoResponse, + routing::get, + Router, +}; +use fred::prelude::*; +use futures::{sink::SinkExt, stream::StreamExt}; +use pg::postgres::{ConnectionPool, DatabaseConnection, DB}; +use serde::Deserialize; +use shutdown::shutdown_signal; +use std::{env, net::SocketAddr}; + +fn redis_conn_uri() -> String { + let redis_db = std::env::var("REDIS_DB").unwrap(); + let redis_host = std::env::var("REDIS_HOST").unwrap(); + let redis_port = std::env::var("REDIS_PORT").unwrap(); + let redis_username = std::env::var("REDIS_USERNAME").unwrap(); + let redis_password = std::env::var("REDIS_PASSWORD").unwrap(); + format!( + "redis://{redis_username}:{redis_password}@{redis_host}:{redis_port}/{redis_db}", + redis_db = redis_db, + redis_host = redis_host, + redis_port = redis_port, + redis_username = redis_username, + redis_password = redis_password + ) +} + +#[derive(Debug, Deserialize)] +struct Params { + measure: String, + date: String, + country: String, + region: String, + // sub_region: String, + municipality: String, +} + +impl Params { + fn redis_gdp_key(&self) -> String { + format!( + "{}:{}:{}:{}:{}", // 2024-08-20:gdp:usa:cal:sac + self.date, self.measure, self.country, self.region, self.municipality + ) + } +} + +// example websocket uri with query params: +// wscat -c 'ws://localhost:10010/ws?measure=gdp&date=2024-08-21&country=United%20States%20of%20America®ion=California&municipality=Sacramento' + +#[tokio::main] +async fn main() { + let conn_uri = DB::create_conn_uri_from_env_vars(); + let pool = DB::new_pool(&conn_uri).await; + + let app = Router::new().route("/ws", get(ws_handler)).with_state(pool); + + let hostname_or_ip = env::var("HOSTNAME_OR_IP").unwrap_or("0.0.0.0".to_string()); + let port = env::var("MEASURE_PORT").unwrap(); + let serve_addr = format!("{hostname_or_ip}:{port}"); + + let listener = tokio::net::TcpListener::bind(serve_addr.clone()) + .await + .unwrap(); + + tracing::info!("listening on {}", serve_addr); + + axum::serve( + listener, + app.into_make_service_with_connect_info::(), + ) + .with_graceful_shutdown(shutdown_signal()) + .await + .unwrap(); +} + +async fn ws_handler( + ws: WebSocketUpgrade, + State(pool): State, + query: Query, + ConnectInfo(addr): ConnectInfo, +) -> impl IntoResponse { + ws.on_upgrade(move |socket| handle_socket(socket, addr, pool, query.0)) +} + +/// spawn websocket per connection +async fn handle_socket(socket: WebSocket, _who: SocketAddr, pool: ConnectionPool, params: Params) { + // get abbreviated location names from postgres + let conn = pool.get_conn().await; + let abbreviations = redis_names(&conn, params).await; + + // concat abbreviated location names to colon separated redis key: 2024-08-20:gdp:usa:cal:sac + let redis_gdp_key = abbreviations.redis_gdp_key(); + + // connect to redis + let redis_uri = redis_conn_uri(); + let redis_config = RedisConfig::from_url(&redis_uri).unwrap(); + let redis_client = Builder::from_config(redis_config).build().unwrap(); + redis_client.init().await.unwrap(); + + // subscribe to redis channel named after redis key + redis_client.subscribe(redis_gdp_key).await.unwrap(); + + // proxy redis subscription to websocket + proxy_redis_subscription(redis_client, socket).await +} + +async fn proxy_redis_subscription(redis_client: RedisClient, socket: WebSocket) { + let (mut ws_tx, mut ws_rx) = socket.split(); + let mut redis_stream = redis_client.message_rx(); + while let Ok(message) = redis_stream.recv().await { + let message = message.value.as_string().unwrap(); + ws_tx.send(Message::Text(message)).await.unwrap(); + + tokio::select! { + ws_msg = ws_rx.next() => { + if let Some(Ok(Message::Close(_))) = ws_msg { + break; + } + }, + redis_msg = redis_stream.recv() => { + match redis_msg { + Ok(message) => { + let message = message.value.as_string().unwrap(); + ws_tx.send(Message::Text(message)).await.unwrap(); + } + Err(e) => { + tracing::error!("error receiving message: {}", e); + break; + } + } + } + } + } +} + +async fn redis_names(pg_conn: &DatabaseConnection, ws_params: Params) -> Params { + let country = query_key(pg_conn, ws_params.country).await; + let region = query_key(pg_conn, ws_params.region).await; + let municipality = query_key(pg_conn, ws_params.municipality).await; + Params { + measure: ws_params.measure, + date: ws_params.date, + country, + region, + municipality, + } +} + +async fn query_key(pg_conn: &DatabaseConnection, place: String) -> String { + pg_conn + .0 + .query_one("SELECT value FROM redis_name WHERE key = $1", &[&place]) + .await + .unwrap() + .get(0) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_creates_a_redis_gdp_key() { + let params = Params { + measure: "gdp".to_string(), + date: "2024-08-20".to_string(), + country: "usa".to_string(), + region: "cal".to_string(), + municipality: "sac".to_string(), + }; + assert_eq!( + params.redis_gdp_key(), + "2024-08-20:gdp:usa:cal:sac".to_string() + ); + } +} From 0e1766795af8ebd760260b6c007de3cefc41fea0 Mon Sep 17 00:00:00 2001 From: max funk Date: Wed, 21 Aug 2024 17:10:30 -0700 Subject: [PATCH 2/5] cargo lock --- Cargo.lock | 124 +++++++++++++++++++++++++++-------------------------- 1 file changed, 63 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f079a0e6..4c01fb7b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -234,7 +234,7 @@ checksum = "eb1c9aed04854fb55a9d3fbab94e013cfc7ca5e3cead0b49b439884f8a467039" dependencies = [ "async-graphql", "async-trait", - "axum 0.7.4", + "axum 0.7.5", "bytes", "futures-util", "serde_json", @@ -729,7 +729,7 @@ dependencies = [ "aws-smithy-types", "bytes", "fastrand 2.0.1", - "h2 0.3.22", + "h2", "http 0.2.9", "http-body 0.4.5", "hyper 0.14.28", @@ -855,7 +855,7 @@ dependencies = [ "serde_json", "serde_path_to_error", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "tokio", "tower", "tower-http 0.4.4", @@ -865,9 +865,9 @@ dependencies = [ [[package]] name = "axum" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1236b4b292f6c4d6dc34604bb5120d85c3fe1d1aa596bd5cc52ca054d13e7b9e" +checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" dependencies = [ "async-trait", "axum-core 0.4.3", @@ -877,7 +877,7 @@ dependencies = [ "http 1.0.0", "http-body 1.0.0", "http-body-util", - "hyper 1.1.0", + "hyper 1.4.1", "hyper-util", "itoa", "matchit", @@ -891,7 +891,7 @@ dependencies = [ "serde_path_to_error", "serde_urlencoded", "sha1", - "sync_wrapper", + "sync_wrapper 1.0.1", "tokio", "tokio-tungstenite", "tower", @@ -932,7 +932,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower-layer", "tower-service", "tracing", @@ -957,7 +957,7 @@ dependencies = [ name = "balance-by-account" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "openssl", "pg", "service", @@ -1190,9 +1190,9 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", @@ -1200,7 +1200,7 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -1715,9 +1715,9 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "fred" -version = "9.0.3" +version = "9.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915e065b377f6e16d5c01eae96bf31eeaf81e1e300b76f938761b3c21307cad8" +checksum = "8ee218b8980043b550540530d38d7435fd55bbc9ee07526a05d9a30595097e02" dependencies = [ "arc-swap", "async-trait", @@ -1753,9 +1753,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "531ac96c6ff5fd7c62263c5e3c67a603af4fcaee2e1a0ae5565ba3a11e69e549" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1784,9 +1784,9 @@ checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.27" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1997dd9df74cdac935c76252744c1ed5794fac083242ea4fe77ef3ed60ba0f83" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1937,7 +1937,7 @@ dependencies = [ "async-graphql", "async-graphql-axum", "aws_lambda_events 0.13.0", - "axum 0.7.4", + "axum 0.7.5", "http 1.0.0", "httpclient", "openssl", @@ -2027,25 +2027,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "h2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991910e35c615d8cab86b5ab04be67e6ad24d2bf5f4f11fdbbed26da999bbeab" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http 1.0.0", - "indexmap 2.1.0", - "slab", - "tokio", - "tokio-util", - "tracing", -] - [[package]] name = "handlebars" version = "4.5.0" @@ -2257,7 +2238,7 @@ dependencies = [ "futures-channel", "futures-core", "futures-util", - "h2 0.3.22", + "h2", "http 0.2.9", "http-body 0.4.5", "httparse", @@ -2273,20 +2254,20 @@ dependencies = [ [[package]] name = "hyper" -version = "1.1.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5aa53871fc917b1a9ed87b683a5d86db645e23acb32c2e0785a353e522fb75" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", "futures-util", - "h2 0.4.1", "http 1.0.0", "http-body 1.0.0", "httparse", "httpdate", "itoa", "pin-project-lite", + "smallvec", "tokio", "want", ] @@ -2322,16 +2303,16 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.2" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdea9aac0dbe5a9240d68cfd9501e2db94222c6dc06843e06640b9e07f0fdc67" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ "bytes", "futures-channel", "futures-util", "http 1.0.0", "http-body 1.0.0", - "hyper 1.1.0", + "hyper 1.4.1", "pin-project-lite", "socket2 0.5.5", "tokio", @@ -2532,7 +2513,7 @@ dependencies = [ "http-body 1.0.0", "http-body-util", "http-serde", - "hyper 1.1.0", + "hyper 1.4.1", "hyper-util", "lambda_runtime_api_client", "serde", @@ -2556,7 +2537,7 @@ dependencies = [ "http 1.0.0", "http-body 1.0.0", "http-body-util", - "hyper 1.1.0", + "hyper 1.4.1", "hyper-util", "tokio", "tower", @@ -2668,6 +2649,21 @@ dependencies = [ "digest", ] +[[package]] +name = "measure" +version = "0.1.0" +dependencies = [ + "axum 0.7.5", + "fred", + "futures", + "pg", + "serde", + "shutdown", + "tokio", + "tracing", + "tracing-subscriber", +] + [[package]] name = "memchr" version = "2.7.1" @@ -3632,7 +3628,7 @@ dependencies = [ name = "request-approve" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "openssl", "pg", "service", @@ -3647,7 +3643,7 @@ dependencies = [ name = "request-by-id" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "openssl", "pg", "service", @@ -3662,7 +3658,7 @@ dependencies = [ name = "request-create" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "httpclient", "openssl", "pg", @@ -3679,7 +3675,7 @@ dependencies = [ name = "requests-by-account" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "openssl", "pg", "service", @@ -3701,7 +3697,7 @@ dependencies = [ "encoding_rs", "futures-core", "futures-util", - "h2 0.3.22", + "h2", "http 0.2.9", "http-body 0.4.5", "hyper 0.14.28", @@ -3718,7 +3714,7 @@ dependencies = [ "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 0.1.2", "system-configuration", "tokio", "tokio-native-tls", @@ -3974,9 +3970,9 @@ checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" [[package]] name = "serde" -version = "1.0.197" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] @@ -4003,9 +3999,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", @@ -4218,9 +4214,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.10.0" +version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" @@ -4373,6 +4369,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "system-configuration" version = "0.6.0" @@ -4822,7 +4824,7 @@ dependencies = [ name = "transaction-by-id" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "openssl", "pg", "service", @@ -4837,7 +4839,7 @@ dependencies = [ name = "transactions-by-account" version = "0.1.0" dependencies = [ - "axum 0.7.4", + "axum 0.7.5", "openssl", "pg", "service", From 200d0b4ce39b4da55e771d4e8eaf5188323a5228 Mon Sep 17 00:00:00 2001 From: max funk Date: Wed, 21 Aug 2024 17:10:44 -0700 Subject: [PATCH 3/5] measure service in docker --- docker/compose.yaml | 25 ++++++++++++++++++++++++- docker/measure.Dockerfile | 20 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 docker/measure.Dockerfile diff --git a/docker/compose.yaml b/docker/compose.yaml index 05ba2139..1a446b64 100644 --- a/docker/compose.yaml +++ b/docker/compose.yaml @@ -223,7 +223,30 @@ services: REDIS_PORT: 6379 REDIS_USERNAME: default REDIS_PASSWORD: test - RUST_BACKTRACE: 1 + depends_on: + redis: + condition: service_healthy + postgres: + condition: service_healthy + measure: + image: measure:latest + build: + context: ../ + dockerfile: ./docker/measure.Dockerfile + ports: + - "10010:10010" + environment: + PGDATABASE: mxfactorial + PGUSER: test + PGPASSWORD: test + PGHOST: postgres + PGPORT: 5432 + REDIS_DB: 0 + REDIS_HOST: redis + REDIS_PORT: 6379 + REDIS_USERNAME: default + REDIS_PASSWORD: test + MEASURE_PORT: 10010 depends_on: redis: condition: service_healthy diff --git a/docker/measure.Dockerfile b/docker/measure.Dockerfile new file mode 100644 index 00000000..a3c57366 --- /dev/null +++ b/docker/measure.Dockerfile @@ -0,0 +1,20 @@ +FROM rust:latest AS builder + +WORKDIR /app + +COPY . ./ + +RUN rustup target add x86_64-unknown-linux-musl +RUN apt update && \ + apt install -y musl-tools perl make + +RUN USER=root cargo build \ + --manifest-path=services/measure/Cargo.toml \ + --target x86_64-unknown-linux-musl \ + --release + +FROM alpine:latest + +COPY --from=builder /app/target/x86_64-unknown-linux-musl/release/measure /app/measure + +CMD [ "/app/measure" ] \ No newline at end of file From a53cb5948967a21061930a36372a317c3c96b73f Mon Sep 17 00:00:00 2001 From: max funk Date: Wed, 21 Aug 2024 17:10:53 -0700 Subject: [PATCH 4/5] measure service in workflow --- .github/workflows/build-all-images.yaml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/build-all-images.yaml b/.github/workflows/build-all-images.yaml index 5ff1491a..a356368a 100644 --- a/.github/workflows/build-all-images.yaml +++ b/.github/workflows/build-all-images.yaml @@ -200,6 +200,25 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: push image run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + measure: + name: measure + runs-on: ubuntu-latest + env: + SERVICE_NAME: measure + steps: + - uses: actions/checkout@v4 + - name: build image + run: bash scripts/build-image-job.sh --service-name $SERVICE_NAME --build-ctx . + - name: tag image + run: docker tag $SERVICE_NAME:latest ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest + - name: log into container registry + uses: docker/login-action@v3 + with: + registry: ${{ env.GITHUB_REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: push image + run: docker push ${{ env.GITHUB_REGISTRY }}/${{ github.repository }}/$SERVICE_NAME:latest auto_confirm: name: auto-confirm runs-on: ubuntu-latest From 8e9ead6d792ab8b5f27aa26ab9e1868581ae01ce Mon Sep 17 00:00:00 2001 From: max funk Date: Wed, 21 Aug 2024 17:11:02 -0700 Subject: [PATCH 5/5] drop unused condition --- scripts/manage-redis.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/manage-redis.sh b/scripts/manage-redis.sh index 0fb028ad..c36863da 100644 --- a/scripts/manage-redis.sh +++ b/scripts/manage-redis.sh @@ -3,7 +3,7 @@ set -e # print use -if [[ "$#" -ne 0 ]] && [[ "$#" -ne 1 ]]; then +if [[ "$#" -ne 1 ]]; then cat <<-'EOF' use: bash scripts/manage-redis.sh --start # OR --stop OR --flush