From 2afce8268276f98e5f7944f9db0c6bd40c1f8b80 Mon Sep 17 00:00:00 2001 From: phoenix Date: Fri, 17 Jul 2026 16:52:07 -0400 Subject: [PATCH] Updating name --- .env.docker.sample | 4 +-- .env.local.sample | 4 +-- .github/workflows/workflow.yml | 30 ++++++++-------- Cargo.lock | 62 +++++++++++++++++----------------- Cargo.toml | 2 +- Dockerfile | 24 ++----------- README.md | 12 +++---- docker-compose.yaml | 22 ++++++------ 8 files changed, 71 insertions(+), 89 deletions(-) diff --git a/.env.docker.sample b/.env.docker.sample index c448c30..26dcfbb 100644 --- a/.env.docker.sample +++ b/.env.docker.sample @@ -5,8 +5,8 @@ RUST_LOG=debug ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com SECRET_MAIN_KEY=refero34o8rfhfjn983thf39fhc943rf923n3h ROOT_DIRECTORY=/home/icarus/mydata -POSTGRES_MAIN_USER=icarus +POSTGRES_MAIN_USER=soaricarus POSTGRES_MAIN_PASSWORD=password -POSTGRES_MAIN_DB=icarus_db +POSTGRES_MAIN_DB=soaricarus_db POSTGRES_MAIN_HOST=main_db DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB} diff --git a/.env.local.sample b/.env.local.sample index c448c30..26dcfbb 100644 --- a/.env.local.sample +++ b/.env.local.sample @@ -5,8 +5,8 @@ RUST_LOG=debug ALLOWED_ORIGINS=https://soaricarus.com,https://www.soaricarus.com SECRET_MAIN_KEY=refero34o8rfhfjn983thf39fhc943rf923n3h ROOT_DIRECTORY=/home/icarus/mydata -POSTGRES_MAIN_USER=icarus +POSTGRES_MAIN_USER=soaricarus POSTGRES_MAIN_PASSWORD=password -POSTGRES_MAIN_DB=icarus_db +POSTGRES_MAIN_DB=soaricarus_db POSTGRES_MAIN_HOST=main_db DATABASE_URL=postgres://${POSTGRES_MAIN_USER}:${POSTGRES_MAIN_PASSWORD}@${POSTGRES_MAIN_HOST}:5432/${POSTGRES_MAIN_DB} diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml index 939fbdf..6656b06 100644 --- a/.github/workflows/workflow.yml +++ b/.github/workflows/workflow.yml @@ -23,12 +23,12 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: | mkdir -p ~/.ssh - echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key - chmod 600 ~/.ssh/icarus_models_deploy_key + echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key + chmod 600 ~/.ssh/soaricarus_models_deploy_key ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts eval $(ssh-agent -s) - ssh-add -v ~/.ssh/icarus_models_deploy_key + ssh-add -v ~/.ssh/soaricarus_models_deploy_key cargo check @@ -75,12 +75,12 @@ jobs: ROOT_DIRECTORY: "/tmp" run: | mkdir -p ~/.ssh - echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key - chmod 600 ~/.ssh/icarus_models_deploy_key + echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key + chmod 600 ~/.ssh/soaricarus_models_deploy_key ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts eval $(ssh-agent -s) - ssh-add -v ~/.ssh/icarus_models_deploy_key + ssh-add -v ~/.ssh/soaricarus_models_deploy_key cargo test @@ -96,12 +96,12 @@ jobs: - run: rustup component add rustfmt - run: | mkdir -p ~/.ssh - echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key - chmod 600 ~/.ssh/icarus_models_deploy_key + echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key + chmod 600 ~/.ssh/soaricarus_models_deploy_key ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts eval $(ssh-agent -s) - ssh-add -v ~/.ssh/icarus_models_deploy_key + ssh-add -v ~/.ssh/soaricarus_models_deploy_key cargo fmt --all -- --check clippy: @@ -116,12 +116,12 @@ jobs: - run: rustup component add clippy - run: | mkdir -p ~/.ssh - echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key - chmod 600 ~/.ssh/icarus_models_deploy_key + echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key + chmod 600 ~/.ssh/soaricarus_models_deploy_key ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts eval $(ssh-agent -s) - ssh-add -v ~/.ssh/icarus_models_deploy_key + ssh-add -v ~/.ssh/soaricarus_models_deploy_key cargo clippy -- -D warnings build: @@ -135,10 +135,10 @@ jobs: - uses: Swatinem/rust-cache@v2 - run: | mkdir -p ~/.ssh - echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/icarus_models_deploy_key - chmod 600 ~/.ssh/icarus_models_deploy_key + echo "${{ secrets.MYREPO_TOKEN }}" > ~/.ssh/soaricarus_models_deploy_key + chmod 600 ~/.ssh/soaricarus_models_deploy_key ssh-keyscan ${{ secrets.MYHOST }} >> ~/.ssh/known_hosts eval $(ssh-agent -s) - ssh-add -v ~/.ssh/icarus_models_deploy_key + ssh-add -v ~/.ssh/soaricarus_models_deploy_key cargo build --release diff --git a/Cargo.lock b/Cargo.lock index 3091dfa..83129eb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1038,37 +1038,6 @@ dependencies = [ "tower-service", ] -[[package]] -name = "icarus" -version = "0.5.2" -dependencies = [ - "axum", - "axum-extra", - "common-multipart-rfc7578", - "futures", - "icarus_envy", - "icarus_meta", - "icarus_models", - "josekit", - "jsonwebtoken", - "mime_guess", - "openssl", - "serde", - "serde_json", - "sqlx", - "tempfile", - "time", - "tokio", - "tokio-util", - "tower", - "tower-http", - "tracing-subscriber", - "url", - "utoipa", - "utoipa-swagger-ui", - "uuid", -] - [[package]] name = "icarus_envy" version = "0.8.0" @@ -2213,6 +2182,37 @@ dependencies = [ "serde", ] +[[package]] +name = "soaricarus" +version = "0.5.2" +dependencies = [ + "axum", + "axum-extra", + "common-multipart-rfc7578", + "futures", + "icarus_envy", + "icarus_meta", + "icarus_models", + "josekit", + "jsonwebtoken", + "mime_guess", + "openssl", + "serde", + "serde_json", + "sqlx", + "tempfile", + "time", + "tokio", + "tokio-util", + "tower", + "tower-http", + "tracing-subscriber", + "url", + "utoipa", + "utoipa-swagger-ui", + "uuid", +] + [[package]] name = "socket2" version = "0.6.4" diff --git a/Cargo.toml b/Cargo.toml index a89619d..e0c2e58 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "icarus" +name = "soaricarus" version = "0.5.2" edition = "2024" rust-version = "1.95" diff --git a/Dockerfile b/Dockerfile index 60baf2b..6c68cf9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,3 @@ -# Stage 1: Build the application FROM rust:1.95 as builder # Set the working directory inside the container @@ -17,34 +16,24 @@ RUN mkdir -p -m 0700 ~/.ssh && \ echo " User git" >> ~/.ssh/config && \ chmod 600 ~/.ssh/config -# << --- ADD HOST KEY HERE --- >> RUN 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/icarus* # Clean up dummy build artifacts (replace icarus) + rm -rf src target/release/deps/soaricarus_api* # Copy the actual source code COPY src ./src -# If you have other directories like `templates` or `static`, copy them too COPY .env ./.env COPY migrations ./migrations -# << --- 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) @@ -53,18 +42,11 @@ 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 'icarus' with the actual name of your binary (usually the crate name) -COPY --from=builder /usr/src/app/target/release/icarus . +COPY --from=builder /usr/src/app/target/release/soaricarus_api . -# 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 . COPY --from=builder /usr/src/app/migrations ./migrations -# Expose the port your Axum app listens on (e.g., 3000 or 8000) EXPOSE 8000 -# Set the command to run your application -# Ensure this matches the binary name copied above -CMD ["./icarus"] +CMD ["./soaricarus_api"] diff --git a/README.md b/README.md index d863bee..4db7ef2 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -# Icarus -Web API for the Icarus project. +# soaricarus_api +Core web API for the soaricarus project. ### Requires -`icarus_auth` v0.8.x +`soaricarus_auth` v0.8.x `songparser` v0.6.x ### Compatible with -`icarus-dm` v0.9.x +`soaricarus-dm` v0.9.x ## Getting Started -Quickest way to get started is with docker. Make sure `icarus_auth` and `songparser` repositories +Quickest way to get started is with docker. Make sure `soaricarus_auth` and `songparser` repositories are located in the root of the parent directory. Check the respective repositories to ensure they -are setup correctly before configuring `Icarus`. +are setup correctly before configuring `soaricarus_api`. Copy the `.env.docker.sample` file to `.env`. Ensure that the `ROOT_DIRECTORY` variable is populated and exists on the docker image's filesystem. The credentials for the database doesn't need to be diff --git a/docker-compose.yaml b/docker-compose.yaml index 3920674..6d97aff 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -21,7 +21,7 @@ services: # --- Web API auth --- auth_api: build: - context: ../icarus_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile) + context: ../soaricarus_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile) ssh: ["default"] dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name container_name: auth_api @@ -29,12 +29,12 @@ services: ports: - "8001:8001" env_file: - - ../icarus_auth/.env + - ../soaricarus_auth/.env depends_on: auth_db: condition: service_healthy networks: - - icarus-network + - soaricarus-network # Optional: Mount local code for development (live reload) # volumes: # - ./path/to/your/web-api-repo:/app @@ -55,13 +55,13 @@ services: - auth_api - auth_db networks: - - icarus-network + - soaricarus-network # PostgreSQL Database Service main_db: image: postgres:18.4-alpine - container_name: icarus_db + container_name: soaricarus_db environment: # These MUST match the user, password, and database name in the DATABASE_URL above POSTGRES_USER: ${POSTGRES_MAIN_USER:-icarus} @@ -81,17 +81,17 @@ services: start_period: 10s restart: always networks: - - icarus-network + - soaricarus-network # --- icarus web auth api db --- auth_db: image: postgres:18.4-alpine - container_name: icarus_auth_db + container_name: soaricarus_auth_db environment: # These MUST match the user, password, and database name in the DATABASE_URL above - POSTGRES_USER: ${POSTGRES_AUTH_USER:-icarus_op} + POSTGRES_USER: ${POSTGRES_AUTH_USER:-soaricarus_op} POSTGRES_PASSWORD: ${POSTGRES_AUTH_PASSWORD:-password} - POSTGRES_DB: ${POSTGRES_AUTH_DB:-icarus_auth_db} + POSTGRES_DB: ${POSTGRES_AUTH_DB:-soaricarus_auth_db} volumes: # Persist database data using a named volume - postgres_data_auth:/var/lib/postgresql @@ -106,7 +106,7 @@ services: start_period: 10s restart: always networks: - - icarus-network + - soaricarus-network volumes: postgres_data: @@ -115,5 +115,5 @@ volumes: driver: local # Use the default local driver networks: - icarus-network: + soaricarus-network: driver: bridge