diff --git a/.gitea/workflows/pr.yml b/.gitea/workflows/pr.yml index bc74f7e..301bac0 100644 --- a/.gitea/workflows/pr.yml +++ b/.gitea/workflows/pr.yml @@ -17,7 +17,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96.1 + toolchain: 1.97 - uses: Swatinem/rust-cache@v2 - run: | mkdir -p ~/.ssh @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96.1 + toolchain: 1.97 - run: rustup component add rustfmt - uses: Swatinem/rust-cache@v2 - run: | @@ -56,7 +56,7 @@ jobs: - uses: actions/checkout@v6 - uses: actions-rust-lang/setup-rust-toolchain@v1 with: - toolchain: 1.96.1 + toolchain: 1.97 - run: rustup component add clippy - uses: Swatinem/rust-cache@v2 - run: | diff --git a/Cargo.lock b/Cargo.lock index 054e9d5..97c6f3c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,9 +81,9 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64-ng" -version = "1.3.5" +version = "1.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b87dbd7e45c4885ad3432a2d125ddb155c5ee87046ab23bad043dfe84fedfa2" +checksum = "78dbdaa3c8250efc13282f483f2ae92733e407c9cf6ffc2fe7918ce1ee420724" [[package]] name = "bitflags" @@ -126,13 +126,13 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ae3f5d315924270530207e2a68396c3cc547f6dca3fbdca317cfb1a51edb593" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" [[package]] name = "catapult" -version = "0.3.3" +version = "0.3.4" dependencies = [ "reqwest", "serde_json", @@ -1121,9 +1121,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.8.2" +version = "2.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88904434abc2901f197fe8cc55f0445e7ded921dba5911dad2e2b39b48e663c4" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" [[package]] name = "mime" @@ -1423,9 +1423,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.12.4" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1292b7759ae1cb9ec195452d1390a074f0cd8541ab7a5a8c31cd6db45d4a6ba" +checksum = "2a0e75113e14dc5acb068cd0786884f214f1312650a3d36d269f5c4f3cdee8a2" dependencies = [ "aho-corasick", "memchr", @@ -1435,9 +1435,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +checksum = "1f388202e4b80542a0921078cc23b6333bcf1409c1e3f86404cae4766a6131db" dependencies = [ "aho-corasick", "memchr", @@ -2044,8 +2044,8 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "swoosh" -version = "0.5.2" -source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.2#50e4b209f521d8985d73a33b4a8f1db69334100a" +version = "0.5.3" +source = "git+ssh://git@git.kundeng.us/phoenix/swoosh.git?tag=v0.5.3#1c49242bdfe8fe487ea751c89bcbf545c4b8ac3f" dependencies = [ "base64-ng", "reqwest", @@ -2122,8 +2122,8 @@ dependencies = [ [[package]] name = "textsender_models" -version = "0.5.1" -source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.1#151eeaacf64e255bde56a48df03f4c46ec77c235" +version = "0.5.2" +source = "git+ssh://git@git.kundeng.us/phoenix/textsender_models.git?tag=v0.5.2#02061bf7a380657b7bc76d64d1824388bef8e55a" dependencies = [ "const_format", "dotenvy", @@ -2198,9 +2198,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" +checksum = "bb4ebadaa0af04fab11ae01eb5f9fdb5f9c5b875506e210e71c07873528baa7f" dependencies = [ "tinyvec_macros", ] diff --git a/Cargo.toml b/Cargo.toml index 16d71b4..2ae04b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "catapult" -version = "0.3.3" -rust-version = "1.96.1" +version = "0.3.4" +rust-version = "1.97" edition = "2024" [dependencies] @@ -9,8 +9,8 @@ tokio = { version = "1.52.3", features = ["full"] } reqwest = { version = "0.13.4", features = ["json", "stream", "multipart"] } serde_json = { version = "1.0.150" } time = { version = "0.3.53", features = ["formatting", "macros", "parsing", "serde"] } -uuid = { version = "1.23.3", features = ["v4", "serde"] } -textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.1" } -swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.2" } +uuid = { version = "1.23.4", features = ["v4", "serde"] } +textsender_models = { git = "ssh://git@git.kundeng.us/phoenix/textsender_models.git", tag = "v0.5.2" } +swoosh = { git = "ssh://git@git.kundeng.us/phoenix/swoosh.git", tag = "v0.5.3" } [dev-dependencies] diff --git a/Dockerfile b/Dockerfile index 9659b78..9cd5194 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,4 @@ -# Stage 1: Build the application -FROM rust:1.96.1 as builder +FROM rust:1.97 as builder # Set the working directory inside the container WORKDIR /usr/src/app @@ -11,35 +10,23 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ openssh-client git \ && rm -rf /var/lib/apt/lists/* -# << --- ADD HOST KEY HERE --- >> -# Replace 'yourgithost.com' with the actual hostname (e.g., github.com) RUN mkdir -p -m 0700 ~/.ssh && \ ssh-keyscan git.kundeng.us >> ~/.ssh/known_hosts -# Copy Cargo manifests COPY Cargo.toml Cargo.lock ./ -# Build *only* dependencies to leverage Docker cache -# This dummy build caches dependencies as a separate layer RUN --mount=type=ssh mkdir src && \ echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \ cargo build --release --quiet && \ rm -rf src target/release/deps/catapult* -# Copy the actual source code COPY src ./src # If you have other directories like `templates` or `static`, copy them too COPY .env ./.env -# << --- SSH MOUNT ADDED HERE --- >> -# Build *only* dependencies to leverage Docker cache -# This dummy build caches dependencies as a separate layer -# Mount the SSH agent socket for this command RUN --mount=type=ssh \ cargo build --release --quiet -# Stage 2: Create the final, smaller runtime image -# Use a minimal base image like debian-slim or even distroless for security/size FROM debian:trixie-slim # Install runtime dependencies if needed (e.g., SSL certificates) @@ -48,12 +35,8 @@ RUN apt-get update && apt-get install -y ca-certificates libssl-dev libssl3 && r # Set the working directory WORKDIR /usr/local/bin -# Copy the compiled binary from the builder stage -# Replace 'catapult' with the actual name of your binary (usually the crate name) COPY --from=builder /usr/src/app/target/release/catapult . -# Copy other necessary files like .env (if used for runtime config) or static assets -# It's generally better to configure via environment variables in Docker though COPY --from=builder /usr/src/app/.env . # Set the command to run your application diff --git a/README.md b/README.md new file mode 100644 index 0000000..0fe2367 --- /dev/null +++ b/README.md @@ -0,0 +1,25 @@ +# Getting started +Docker isn't required, but it is the quickest way to get started. + +Copy over the `.env.docker.sample` to `.env`. From that point, make edits to the +file to get it working. + +### Messaging configuration +The service vendor used to send the messages is `twilio`. After signing up and being +provided credentials, update the `TWILIO_*` variables. + +### Client-Server interaction +In order for `catapult` to function properly, credentials need to be provided via +`SERVICE_USERNAME` and `SERVICE_PASSPHRASE`. The credentials are created from making +an API call to register a service user in `textsender_auth`. So, you need to have credentials +set in the `.env` file and use those same credentials to create the account in the +API call. + +### API sources +The `AUTH_URL` and `API_URL` variables need to be set for the base URL for the +`textsender_auth` and `textsender_api` respectively. + + +Since this is meant to run along with `textsender_auth` and `textsender_api`, it isn't +meant to be run by itself. So no need to build or run the container in isolation, but +that capability is present. diff --git a/docker-compose.yaml b/docker-compose.yaml index 68c84f6..a6e9b98 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -4,8 +4,8 @@ services: songparser: build: context: . - ssh: ["default"] # Uses host's SSH agent + ssh: ["default"] container_name: catapult env_file: - .env - restart: unless-stopped # Optional: Restart policy + restart: unless-stopped