From 9b531be41190379d0e952dc4d2bd923e0125da8e Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 13 Dec 2024 13:43:30 -0500 Subject: [PATCH 01/74] Add GitHub Actions workflow for building and deploying containers --- .../workflows/build_and_deploy_containers.yml | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 .github/workflows/build_and_deploy_containers.yml diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml new file mode 100644 index 00000000..bb4d5b34 --- /dev/null +++ b/.github/workflows/build_and_deploy_containers.yml @@ -0,0 +1,110 @@ +name: Build and Deploy Containers + +on: + push: + branches: + - '**feature/**' # Run on feature branches + pull_request: + branches: + # - main # Run on pull requests to merge into main + workflow_dispatch: # Allow manual triggering + +env: + CARGO_TERM_COLOR: always + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + +jobs: + build_test_run: + name: Build and Test + runs-on: ubuntu-22.04 + + steps: + # Checkout the repository + - name: Checkout + uses: actions/checkout@v3 + + # Install Rust toolchain + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-gnu + + # Use cached dependencies + - name: Use cached dependencies + uses: Swatinem/rust-cache@v2 + with: + key: "ubuntu-22.04-x86_64-unknown-linux-gnu" + + # Install seaORM CLI + - name: Install seaORM CLI + run: cargo install sea-orm-cli + + # Build the project + - name: Build + run: cargo build --all-targets + + # Run tests + - name: Test + run: cargo test + + build_and_push_docker: + name: Build and Push Docker Images + runs-on: ubuntu-22.04 + needs: build_test_run # Ensure tests pass before building Docker images + + steps: + # Checkout the repository + - name: Checkout + uses: actions/checkout@v3 + + # Log in to GitHub Container Registry + - name: Log in to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Set up Docker Buildx + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + # Cache Docker layers + - name: Cache Docker layers + uses: actions/cache@v3 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- + + # Build and push Rust backend image + - name: Build and Push Rust Backend Image + run: | + BRANCH_NAME=$(echo ${{ github.ref_name }} | cut -c1-10) + IMAGE_TAG=$(echo ${{ github.sha }} | cut -c1-10) + echo "Building and pushing Rust backend image with tag: ${BRANCH_NAME}-rust-backend-${IMAGE_TAG}" + docker buildx build --platform linux/amd64,linux/arm64 \ + --cache-from type=local,src=/tmp/.buildx-cache \ + --cache-to type=local,dest=/tmp/.buildx-cache-new \ + -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${BRANCH_NAME}-rust-backend-${IMAGE_TAG} \ + -f Dockerfile \ + --push . + + # Build and push Next.js frontend image + - name: Build and Push Next.js Frontend Image + run: | + BRANCH_NAME=$(echo ${{ github.ref_name }} | cut -c1-10) + IMAGE_TAG=$(echo ${{ github.sha }} | cut -c1-10) + echo "Building and pushing Next.js frontend image with tag: ${BRANCH_NAME}-nextjs-frontend-${IMAGE_TAG}" + docker buildx build --platform linux/amd64,linux/arm64 \ + --cache-from type=local,src=/tmp/.buildx-cache \ + --cache-to type=local,dest=/tmp/.buildx-cache-new \ + -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${BRANCH_NAME}-nextjs-frontend-${IMAGE_TAG} \ + -f web/Dockerfile \ + --push . + + # Move new cache to the original location + - name: Move new cache + run: mv /tmp/.buildx-cache-new /tmp/.buildx-cache \ No newline at end of file From 6ae121a5502c70ddf8811a5635407a5472246d8b Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 13 Dec 2024 13:50:04 -0500 Subject: [PATCH 02/74] fixed error with pr to main. --- .github/workflows/build_and_deploy_containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index bb4d5b34..4f3b744e 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -6,7 +6,7 @@ on: - '**feature/**' # Run on feature branches pull_request: branches: - # - main # Run on pull requests to merge into main + - main # Run on pull requests to merge into main workflow_dispatch: # Allow manual triggering env: From d6d2b6dad84a9ca6b3dc51a08627de21d66a366c Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 13 Dec 2024 14:45:40 -0500 Subject: [PATCH 03/74] updates env vars to be injected into images on build --- .../workflows/build_and_deploy_containers.yml | 48 ++++++++++++++++++- 1 file changed, 46 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 4f3b744e..8a5421dc 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -2,8 +2,8 @@ name: Build and Deploy Containers on: push: - branches: - - '**feature/**' # Run on feature branches + branches-ignore: + - main # Run on branches that are not main pull_request: branches: - main # Run on pull requests to merge into main @@ -24,6 +24,28 @@ jobs: - name: Checkout uses: actions/checkout@v3 + # Set environment variables from secrets + - name: Set environment variables + run: | + echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV + echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV + echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV + echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV + echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV + echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV + echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> $GITHUB_ENV + echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV + echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV + echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV + echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV + echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV + echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV + echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV + echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV + echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV + # Install Rust toolchain - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable @@ -58,6 +80,28 @@ jobs: - name: Checkout uses: actions/checkout@v3 + # Set environment variables from secrets + - name: Set environment variables + run: | + echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV + echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV + echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV + echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV + echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV + echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV + echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> $GITHUB_ENV + echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV + echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV + echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV + echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV + echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV + echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV + echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV + echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV + echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV + # Log in to GitHub Container Registry - name: Log in to GitHub Container Registry uses: docker/login-action@v2 From 83913c38d0cf39ea5f29eacc8bfaa7adf5bcedc4 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 13 Dec 2024 14:54:42 -0500 Subject: [PATCH 04/74] updates database url --- .github/workflows/build_and_deploy_containers.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 8a5421dc..91bb7bbb 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -33,7 +33,8 @@ jobs: echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV - echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> $GITHUB_ENV + echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV + echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV From 13b648d6b306d9c55de479c81f9e7e68971f6f48 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 14 Dec 2024 19:01:47 -0500 Subject: [PATCH 05/74] Enhance GitHub Actions workflow for building and deploying containers with updated actions, improved environment variable handling, and added artifact attestations for images. --- .../workflows/build_and_deploy_containers.yml | 115 ++++++++++-------- 1 file changed, 65 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 91bb7bbb..968cb6ed 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -10,19 +10,26 @@ on: workflow_dispatch: # Allow manual triggering env: - CARGO_TERM_COLOR: always REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BACKEND_IMAGE_NAME: rust-backend + FRONTEND_IMAGE_NAME: nextjs-frontend jobs: build_test_run: name: Build and Test runs-on: ubuntu-22.04 + permissions: + contents: read + packages: write + attestations: write + id-token: write steps: # Checkout the repository - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Set environment variables from secrets - name: Set environment variables @@ -34,7 +41,6 @@ jobs: echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV - echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV @@ -79,41 +85,19 @@ jobs: steps: # Checkout the repository - name: Checkout - uses: actions/checkout@v3 - - # Set environment variables from secrets - - name: Set environment variables - run: | - echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV - echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV - echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV - echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV - echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV - echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV - echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" >> $GITHUB_ENV - echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV - echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV - echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV - echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV - echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV - echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV - echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV - echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV - echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV + uses: actions/checkout@v4 # Log in to GitHub Container Registry - - name: Log in to GitHub Container Registry + - name: Log in to the Container registry uses: docker/login-action@v2 with: - registry: ghcr.io + registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} # Set up Docker Buildx - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 # Cache Docker layers - name: Cache Docker layers @@ -124,32 +108,63 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- + # Extract metadata (tags, labels) for Docker + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }}, ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + # Build and push Rust backend image - name: Build and Push Rust Backend Image - run: | - BRANCH_NAME=$(echo ${{ github.ref_name }} | cut -c1-10) - IMAGE_TAG=$(echo ${{ github.sha }} | cut -c1-10) - echo "Building and pushing Rust backend image with tag: ${BRANCH_NAME}-rust-backend-${IMAGE_TAG}" - docker buildx build --platform linux/amd64,linux/arm64 \ - --cache-from type=local,src=/tmp/.buildx-cache \ - --cache-to type=local,dest=/tmp/.buildx-cache-new \ - -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${BRANCH_NAME}-rust-backend-${IMAGE_TAG} \ - -f Dockerfile \ - --push . + id: push_backend + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + context: . + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + ${{ steps.meta.outputs.tags }}-${{ github.sha }} + ${{ github.actor }}/${{ env.BACKEND_IMAGE_NAME }}:${{ github.sha }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + file: Dockerfile # Build and push Next.js frontend image - name: Build and Push Next.js Frontend Image - run: | - BRANCH_NAME=$(echo ${{ github.ref_name }} | cut -c1-10) - IMAGE_TAG=$(echo ${{ github.sha }} | cut -c1-10) - echo "Building and pushing Next.js frontend image with tag: ${BRANCH_NAME}-nextjs-frontend-${IMAGE_TAG}" - docker buildx build --platform linux/amd64,linux/arm64 \ - --cache-from type=local,src=/tmp/.buildx-cache \ - --cache-to type=local,dest=/tmp/.buildx-cache-new \ - -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${BRANCH_NAME}-nextjs-frontend-${IMAGE_TAG} \ - -f web/Dockerfile \ - --push . + id: push_frontend + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 + context: web + push: true + tags: | + ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + ${{ steps.meta.outputs.tags }}-${{ github.sha }} + ${{ github.actor }}/${{ env.FRONTEND_IMAGE_NAME }}:${{ github.sha }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new + file: web/Dockerfile # Move new cache to the original location - name: Move new cache - run: mv /tmp/.buildx-cache-new /tmp/.buildx-cache \ No newline at end of file + run: mv /tmp/.buildx-cache-new /tmp/.buildx-cache + + # Generate artifact attestation for Rust backend image + - name: Generate artifact attestation for Rust Backend Image + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-rust-backend + subject-digest: ${{ steps.push_backend.outputs.digest }} + push-to-registry: true + + # Generate artifact attestation for Next.js frontend image + - name: Generate artifact attestation for Next.js Frontend Image + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-nextjs-frontend + subject-digest: ${{ steps.push_frontend.outputs.digest }} + push-to-registry: true \ No newline at end of file From 68b63c79c0fd573b1f8907353f06512db5f11744 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 14 Dec 2024 19:21:01 -0500 Subject: [PATCH 06/74] correcting attestations --- .github/workflows/build_and_deploy_containers.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 968cb6ed..12d1f3c4 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -124,9 +124,8 @@ jobs: context: . push: true tags: | - ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - ${{ steps.meta.outputs.tags }}-${{ github.sha }} - ${{ github.actor }}/${{ env.BACKEND_IMAGE_NAME }}:${{ github.sha }} + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new @@ -141,9 +140,8 @@ jobs: context: web push: true tags: | - ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - ${{ steps.meta.outputs.tags }}-${{ github.sha }} - ${{ github.actor }}/${{ env.FRONTEND_IMAGE_NAME }}:${{ github.sha }} + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new From 05da9f8df683570681904123fe4bfcf58bd05b65 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 14 Dec 2024 19:21:55 -0500 Subject: [PATCH 07/74] Fix subject-name formatting in artifact attestation for backend and frontend images --- .github/workflows/build_and_deploy_containers.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 12d1f3c4..c19d52ab 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -125,7 +125,7 @@ jobs: push: true tags: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new @@ -141,7 +141,7 @@ jobs: push: true tags: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new @@ -155,7 +155,7 @@ jobs: - name: Generate artifact attestation for Rust Backend Image uses: actions/attest-build-provenance@v2 with: - subject-name: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-rust-backend + subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }} subject-digest: ${{ steps.push_backend.outputs.digest }} push-to-registry: true @@ -163,6 +163,6 @@ jobs: - name: Generate artifact attestation for Next.js Frontend Image uses: actions/attest-build-provenance@v2 with: - subject-name: ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-nextjs-frontend + subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }} subject-digest: ${{ steps.push_frontend.outputs.digest }} push-to-registry: true \ No newline at end of file From 696dd2b17d647f1e07bf35e89d383d67ba5fe8c7 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 7 Feb 2025 20:59:05 -0500 Subject: [PATCH 08/74] fixes docker compose and build_and_run script. --- build_and_run.sh | 28 ++++++++++++++++++++++++ docker-compose.yaml | 52 ++++++++++++++++++--------------------------- 2 files changed, 49 insertions(+), 31 deletions(-) create mode 100755 build_and_run.sh diff --git a/build_and_run.sh b/build_and_run.sh new file mode 100755 index 00000000..9e634966 --- /dev/null +++ b/build_and_run.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# filepath: build_and_run.sh +# This script builds and runs the Docker images using docker-compose. +# It uses the .env file (default: .env.local) for environment variables. +# Usage: ./build_and_run.sh [optional_env_file] +# If you don't pass an env file, it defaults to .env.local. + +set -e + +# Use first argument as env file if provided, else default to .env.local +ENV_FILE=${1:-.env.local} + +if [ ! -f "$ENV_FILE" ]; then + echo "ERROR: ${ENV_FILE} not found. Please create it with the required environment variables." + exit 1 +fi + +echo "Using environment file: ${ENV_FILE}" + +# Export ENV_FILE variable so docker-compose can use it +export ENV_FILE + +echo "Building and running Docker images via docker-compose using ${ENV_FILE}..." +docker-compose --env-file="${ENV_FILE}" up --build -d + +echo "Docker containers are up and running on your localhost." +echo "To view logs, run: docker-compose logs -f" +echo "To stop the containers, run: docker-compose down" diff --git a/docker-compose.yaml b/docker-compose.yaml index f6026221..6af2cdbe 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,25 +1,22 @@ +version: '3.8' services: # Local PostgreSQL container (used for local development when needed) - postgres: - image: postgres:17 # Use PostgreSQL version 17 - container_name: postgres # Name the container "postgres" - environment: - POSTGRES_USER: ${POSTGRES_USER} # Set PostgreSQL user from environment variable - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Set PostgreSQL password from environment variable - POSTGRES_DB: ${POSTGRES_DB} # Set PostgreSQL database name from environment variable + db: + image: postgres:latest # Use latest PostgreSQL version + env_file: + - ${ENV_FILE:-.env.local} # Override by setting ENV_FILE; defaults to .env.local ports: - - "${POSTGRES_PORT}:5432" # Map host port to container's PostgreSQL port + - "${DB_PORT:-5432}:5432" # Map host port from .env variable to container's PostgreSQL port volumes: - - postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data + - db_data:/var/lib/postgresql/data # Persist PostgreSQL data - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql # Initialize database with setup.sql - - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_plaform_rs.sql # Initialize with refactor_platform_rs.sql + - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_platform_rs.sql # Initialize with refactor_platform_rs.sql - ./migration/src/setup_default_user.sql:/docker-entrypoint-initdb.d/2-setup_default_user.sql # Initialize with setup_default_user.sql networks: - backend_network # Connect to backend_network # Rust application that connects to either local or remote PostgreSQL - rust-app: - image: rust-backend # Use the built image + backend: build: context: . # Build context is current directory dockerfile: Dockerfile # Use specified Dockerfile @@ -41,39 +38,32 @@ services: TIPTAP_URL: ${TIPTAP_URL} TIPTAP_AUTH_KEY: ${TIPTAP_AUTH_KEY} TIPTAP_JWT_SIGNING_KEY: ${TIPTAP_JWT_SIGNING_KEY} + env_file: + - ${ENV_FILE:-.env.local} # Same override capability ports: - "${BACKEND_PORT}:${BACKEND_PORT}" # Map host port to container's service port depends_on: - - postgres # Ensure postgres service starts before rust-app + - db # Ensure db service starts before backend networks: - backend_network # Connect to backend_network command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] # Wait for Postgres and run the app - nextjs-app: + frontend: build: - context: https://github.com/refactor-group/refactor-platform-fe.git#main # change to fs directory to run locally + context: . dockerfile: Dockerfile - target: runner # Use runner target - args: - NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} - NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} - NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} - NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} - FRONTEND_SERVICE_PORT: ${FRONTEND_SERVICE_PORT} - FRONTEND_SERVICE_INTERFACE: ${FRONTEND_SERVICE_INTERFACE} - environment: - NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} - NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} - NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} - NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} + env_file: + - ${ENV_FILE:-.env.local} ports: - - "${FRONTEND_SERVICE_PORT}:${FRONTEND_SERVICE_PORT}" # Map host port to frontend container's service port + - "${FRONTEND_PORT}:${FRONTEND_PORT}" # Map a different host port to distinguish frontend depends_on: - - rust-app # Ensure postgres service starts before rust-app + - backend + # Override command to run the frontend binary instead of the backend binary + command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] networks: backend_network: driver: bridge # Use bridge network driver volumes: - postgres_data: # Define postgres_data volume + db_data: # Define db_data volume From e92b8ee36150759b8d2b5712c5926462fff5f278 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 7 Feb 2025 21:50:00 -0500 Subject: [PATCH 09/74] update docker-compose to use environment variables for backend command --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 6af2cdbe..8be59fc3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -46,7 +46,7 @@ services: - db # Ensure db service starts before backend networks: - backend_network # Connect to backend_network - command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] # Wait for Postgres and run the app + command: ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs -l \\\"$BACKEND_LOG_FILTER_LEVEL\\\" -i \\\"$BACKEND_INTERFACE\\\" -p \\\"$BACKEND_PORT\\\" -d \\\"$DATABASE_URL\\\" --allowed-origins=\\\"$BACKEND_ALLOWED_ORIGINS\\\""] # Wait for Postgres and run the app frontend: build: @@ -59,7 +59,7 @@ services: depends_on: - backend # Override command to run the frontend binary instead of the backend binary - command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] + command: ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs -l \\\"$BACKEND_LOG_FILTER_LEVEL\\\" -i \\\"$BACKEND_INTERFACE\\\" -p \\\"$BACKEND_PORT\\\" -d \\\"$DATABASE_URL\\\" --allowed-origins=\\\"$BACKEND_ALLOWED_ORIGINS\\\""] networks: backend_network: From e7b0d5d8ebb4b677749cb4ce30d4b0048086153e Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Mon, 10 Feb 2025 15:18:28 -0500 Subject: [PATCH 10/74] Update README and Container-README with additional information and GitHub Actions workflow details --- README.md | 2 +- docs/runbooks/Container-README.md | 80 +++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a99a039..123e3012 100644 --- a/README.md +++ b/README.md @@ -140,7 +140,7 @@ _This Rust-based backend/web API connects to a PostgreSQL database. It uses Dock docker-compose logs ``` -_For additional commands, database utilities, and debugging tips, check the [Container README](docs/runbooks/Container-README.md)._ +_For additional information, commands, database utilities, gh actions workflow description and debugging tips, check the [Container README](docs/runbooks/Container-README.md)._ --- diff --git a/docs/runbooks/Container-README.md b/docs/runbooks/Container-README.md index 950d1bde..2366d8d8 100644 --- a/docs/runbooks/Container-README.md +++ b/docs/runbooks/Container-README.md @@ -371,3 +371,83 @@ volumes: ```bash docker run -it --entrypoint /bin/bash rust-backend:latest ``` + +--- + +# GitHub Actions Workflow for Container Deployment + +### 🚀 Workflow Overview: Build, Test, and Deploy with Containers + +This workflow automates the process of building, testing, and deploying the Refactor Coaching & Mentoring Platform using Docker containers. It's triggered on pushes to branches other than `main`, pull requests to `main`, and can also be manually triggered. + +### ⚙️ Key Components + +1. **Environment Setup**: + * Defines environment variables like `REGISTRY` (ghcr.io), `IMAGE_NAME`, `BACKEND_IMAGE_NAME`, and `FRONTEND_IMAGE_NAME`. + * Sets up secrets for PostgreSQL credentials, ports, and other configurations. These secrets are stored securely in GitHub. + +2. **Build and Test Job (`build_test_run`)**: + * Runs on Ubuntu. + * Checks out the code using `actions/checkout@v4`. + * Sets environment variables from GitHub secrets. + * Installs the Rust toolchain using `dtolnay/rust-toolchain@stable`. + * Caches dependencies using `Swatinem/rust-cache@v2` to speed up subsequent builds. + * Installs `sea-orm-cli`. + * Builds the Rust project using `cargo build --all-targets`. + * Runs tests using `cargo test`. + +3. **Build and Push Docker Images Job (`build_and_push_docker`)**: + * Depends on the `build_test_run` job to ensure tests pass before building images. + * Logs into the GitHub Container Registry (ghcr.io) using `docker/login-action@v2`. + * Sets up Docker Buildx using `docker/setup-buildx-action@v3` for multi-platform builds (amd64 and arm64). + * Caches Docker layers using `actions/cache@v3` to speed up image builds. + * Extracts metadata for Docker images using `docker/metadata-action@v4`. + * Builds and pushes the Rust backend image using `docker/build-push-action@v6`. + * Context: The root directory (`.`). + * Dockerfile: Uses the Dockerfile in the root. + * Tags: Creates tags for the image, including `latest` and a tag based on the Git SHA. + * Builds and pushes the Next.js frontend image using `docker/build-push-action@v6`. + * Context: The web directory. + * Dockerfile: Uses the Dockerfile. + * Tags: Creates tags for the image, similar to the backend. + * Generates artifact attestation for both images using `actions/attest-build-provenance@v2`. + +### 🛠️ Rust Workspace and Build Process + +* **Rust Workspace**: The project is structured as a Rust workspace, defined by the main Cargo.toml file. This allows managing multiple related crates (e.g., entity, entity_api, migration, service, web) in a single repository. +* **Build Targets**: The `cargo build --all-targets` command builds all binaries, examples, and tests defined in the workspace. +* **Release Build**: The Dockerfile uses `cargo build --release` to create optimized release builds. + +### 🐳 Docker and Docker Compose + +* **Docker**: Docker is used to containerize the Rust backend and Next.js frontend applications. Each application has its own Dockerfile that specifies the build environment, dependencies, and entry point. +* **Docker Compose**: While the workflow doesn't directly use `docker-compose`, the `docker-compose.yaml` file defines how the different services (e.g., backend, frontend, database) are orchestrated and linked together for local development. + +### 📦 GitHub Container Registry (GHCR) + +* The workflow pushes the built Docker images to the GitHub Container Registry (GHCR). GHCR is a container registry provided by GitHub that allows storing and managing Docker images alongside the code. +* Images are tagged with `latest` and the Git SHA for versioning. + +### ✅ Improvements and Optimizations + +1. **Multi-Arch Builds**: The workflow already supports multi-architecture builds (amd64 and arm64), which is great for deploying to different platforms. +2. **Cache**: Docker layer caching is implemented to speed up builds. +3. **Secrets**: Secrets are used to securely manage sensitive information. + +### 📝 Summary for Newcomers + +This GitHub Actions workflow automates building, testing, and deploying our Rust-based platform using Docker containers. Here's the gist: + +1 **Code Changes**: When code is pushed (excluding `main` branch) or a pull request is made to `main`, the workflow kicks off. +2. **Build & Test**: It builds the Rust code and runs tests to ensure everything works. +3. **Containerize**: It creates Docker images for the backend and frontend. +4. **Push to GHCR**: It pushes these images to GitHub's container registry (GHCR). + +This setup ensures that our application is automatically built, tested, and containerized whenever we make changes, making deployment a breeze! 🌬️ + +### ⚠️ Potential Corrections + +1. **Workflow Triggers**: Consider adding a trigger for the `main` branch to rebuild and deploy on merges to main. +2. **Image Tagging**: Implement a more robust tagging strategy (e.g., semantic versioning) for production releases. +3. **Deployment**: The workflow currently builds and pushes images but doesn't deploy them. Add a deployment step to deploy the images to a staging or production environment. +4. **Error Handling**: Implement error handling and logging to provide better insights into workflow failures. \ No newline at end of file From fbdf807c0a539556a30c0f5cae2508d9a020a1db Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Feb 2025 14:39:08 -0500 Subject: [PATCH 11/74] added comment to dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index d9c7bb30..6d2df2c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* # Install the necessary Rust target for ARM64 (Raspberry Pi 5) -RUN rustup target add aarch64-unknown-linux-gnu +RUN rustup target add aarch64-unknown-linux-gnu # Replace with either both or generic target could be dynamic # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ From df486019340b6faf29957be9da3ce4eddd4f59dd Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 13 Dec 2024 13:43:30 -0500 Subject: [PATCH 12/74] Add GitHub Actions workflow for building and deploying containers --- .../workflows/build_and_deploy_containers.yml | 212 ++++++++---------- 1 file changed, 93 insertions(+), 119 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index c19d52ab..b6848c11 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -2,167 +2,141 @@ name: Build and Deploy Containers on: push: - branches-ignore: - - main # Run on branches that are not main + branches: + - main pull_request: branches: - - main # Run on pull requests to merge into main - workflow_dispatch: # Allow manual triggering + - main + types: [opened, synchronize, reopened] + workflow_dispatch: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BACKEND_IMAGE_NAME: rust-backend - FRONTEND_IMAGE_NAME: nextjs-frontend jobs: build_test_run: - name: Build and Test runs-on: ubuntu-22.04 - permissions: - contents: read - packages: write - attestations: write - id-token: write steps: - # Checkout the repository - - name: Checkout - uses: actions/checkout@v4 + # Checkout code + - uses: actions/checkout@v4 + + # Enable QEMU for multi-arch builds (arm64 on x86) + - name: Set up Rust + QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: linux/amd64,linux/arm64 - # Set environment variables from secrets - - name: Set environment variables + # Install ARM cross-compiler + - name: Install cross-compilation toolchain run: | - echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV - echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV - echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV - echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV - echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV - echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV - echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV - echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV - echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV - echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV - echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV - echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV - echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV - echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV - echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV - echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV - - # Install Rust toolchain - - name: Install Rust toolchain + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + + # Install Rust toolchain with both x86_64 and arm64 targets + - name: Set up Rust targets uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu - # Use cached dependencies - - name: Use cached dependencies - uses: Swatinem/rust-cache@v2 - with: - key: "ubuntu-22.04-x86_64-unknown-linux-gnu" + # Cache Rust build artifacts to speed up builds + - uses: Swatinem/rust-cache@v2 - # Install seaORM CLI - - name: Install seaORM CLI + # Install sea-orm-cli globally + - name: Install sea-orm-cli run: cargo install sea-orm-cli - # Build the project - - name: Build - run: cargo build --all-targets + # Configure the Rust linker for arm64 builds + - name: Set linker for cross-compilation + run: | + mkdir -p ~/.cargo + echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml + echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml + + # Build release binaries for ARM64 + - name: Build release binaries + run: cargo build --release --workspace --target aarch64-unknown-linux-gnu - # Run tests - - name: Test - run: cargo test + # Run tests for x86_64 (native) + - name: Run tests + run: cargo test --release build_and_push_docker: - name: Build and Push Docker Images runs-on: ubuntu-22.04 - needs: build_test_run # Ensure tests pass before building Docker images + needs: build_test_run + permissions: + contents: read + packages: write + attestations: write + id-token: write steps: - # Checkout the repository - - name: Checkout - uses: actions/checkout@v4 + # Checkout source code + - uses: actions/checkout@v4 - # Log in to GitHub Container Registry - - name: Log in to the Container registry + # Authenticate to GitHub Container Registry + - name: Docker login uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - # Set up Docker Buildx - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Cache Docker layers - - name: Cache Docker layers - uses: actions/cache@v3 + # Set up Docker Buildx for multi-platform builds + - uses: docker/setup-buildx-action@v3 with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - - # Extract metadata (tags, labels) for Docker - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }}, ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + install: true + + # Show current Docker cache usage + - name: Show Docker Build Cache (Before) + run: | + echo -e "\033[1;34m🔍 Checking buildx cache BEFORE build...\033[0m" + docker buildx du || echo -e "\033[1;33m⚠️ No cache found yet.\033[0m" + + # Compute image name based on branch name and tag as `latest` + - name: Determine Image Tags + id: tags + run: | + BRANCH_NAME=${GITHUB_HEAD_REF:-${GITHUB_REF##*/}} + IMAGE_NAME="${{ env.REGISTRY }}/${{ github.repository }}/${BRANCH_NAME}" + echo "backend_tags=$IMAGE_NAME:latest" >> $GITHUB_OUTPUT + echo "backend_image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT - # Build and push Rust backend image - - name: Build and Push Rust Backend Image + # Build and push multi-arch Docker image with GHA cache + - name: Build + Push Backend id: push_backend - uses: docker/build-push-action@v6 + uses: docker/build-push-action@v5 with: - platforms: linux/amd64,linux/arm64 context: . - push: true - tags: | - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - file: Dockerfile - - # Build and push Next.js frontend image - - name: Build and Push Next.js Frontend Image - id: push_frontend - uses: docker/build-push-action@v6 - with: + file: ./Dockerfile platforms: linux/amd64,linux/arm64 - context: web push: true - tags: | - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - file: web/Dockerfile - - # Move new cache to the original location - - name: Move new cache - run: mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - # Generate artifact attestation for Rust backend image - - name: Generate artifact attestation for Rust Backend Image + provenance: true + tags: ${{ steps.tags.outputs.backend_tags }} + cache-from: type=gha + cache-to: type=gha,mode=max + + # Show updated Docker cache state + - name: Show Docker Build Cache (After) + run: | + echo -e "\033[1;34m📦 Checking buildx cache AFTER build...\033[0m" + docker buildx du || echo -e "\033[1;31m❌ Failed to get updated cache info\033[0m" + + # Generate SBOM + attestation only on main branch + - name: Attest Backend + if: github.ref == 'refs/heads/main' && github.event_name == 'push' uses: actions/attest-build-provenance@v2 with: - subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }} + subject-name: ${{ steps.tags.outputs.backend_image_name }} subject-digest: ${{ steps.push_backend.outputs.digest }} push-to-registry: true - # Generate artifact attestation for Next.js frontend image - - name: Generate artifact attestation for Next.js Frontend Image - uses: actions/attest-build-provenance@v2 - with: - subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }} - subject-digest: ${{ steps.push_frontend.outputs.digest }} - push-to-registry: true \ No newline at end of file + # Output how to pull and run the pushed image + - name: Print Usage Instructions + run: | + echo -e "\033[1;32m✅ Backend Image Pushed:\033[0m" + echo " docker pull ${{ steps.tags.outputs.backend_image_name }}:latest" + echo "" + echo -e "\033[1;36m▶️ Run Backend:\033[0m" + echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" \ No newline at end of file From 737e1d4f29c15d8abad4a6bc983db489adae50af Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Feb 2025 16:39:15 -0500 Subject: [PATCH 13/74] Update Dockerfile and docker-compose for improved configuration and structure - Change base image in Dockerfile to rust:1.70-slim - Use environment variable for backend port in Dockerfile - Update volume paths in docker-compose to point to the docs directory - Specify build target in docker-compose for runtime - Adjust frontend build context in docker-compose --- Dockerfile | 14 +- README.md | 266 +++++++++++++++++++++++++----- docs/runbooks/Container-README.md | 119 +++++++------ 3 files changed, 286 insertions(+), 113 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6d2df2c6..a250acb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,7 @@ +# syntax=docker/dockerfile:1 + # Stage 1: Build Stage -FROM rust:latest AS builder +FROM rust:1.70-slim AS builder # Set the working directory inside the container WORKDIR /usr/src/app @@ -13,7 +15,7 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* # Install the necessary Rust target for ARM64 (Raspberry Pi 5) -RUN rustup target add aarch64-unknown-linux-gnu # Replace with either both or generic target could be dynamic +RUN rustup target add aarch64-unknown-linux-gnu # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ @@ -31,11 +33,6 @@ COPY . . # Build the project RUN cargo build --release --workspace -# logs the contents of the /usr/src/app directory to the docker build log and outputs them to the console -RUN ls -la /usr/src/app/target/release/ - -RUN file /usr/src/app/target/release/* - # Stage 2: Runtime Stage FROM debian:stable-slim AS runtime @@ -63,9 +60,8 @@ RUN useradd -m appuser && \ USER appuser # Expose the necessary ports -EXPOSE 4000 +EXPOSE ${BACKEND_PORT} -# Default command starts an interactive bash shell # Set ENTRYPOINT to default to run the Rust binary with arguments ENTRYPOINT ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs -l \"$BACKEND_LOG_FILTER_LEVEL\" -i \"$BACKEND_INTERFACE\" -p \"$BACKEND_PORT\" -d \"$DATABASE_URL\" --allowed-origins=$BACKEND_ALLOWED_ORIGINS"] diff --git a/README.md b/README.md index 123e3012..8e87ff3b 100644 --- a/README.md +++ b/README.md @@ -6,46 +6,45 @@ ## Intro -A Rust-based backend that provides a web API for various client applications (e.g. a web frontend) that facilitate the coaching and mentoring of software engineers. +A Rust-based backend that provides a web API for various client applications (e.g., a web frontend) that facilitate the coaching and mentoring of software engineers. -The platform itself is useful for professional independent coaches, informal mentors and engineering leaders who work with individual software engineers and/or teams by providing a single application that facilitates and enhances your coaching practice. +The platform itself is useful for professional independent coaches, informal mentors, and engineering leaders who work with individual software engineers and/or teams by providing a single application that facilitates and enhances your coaching practice. ## Basic Local DB Setup and Management -## Running the Database Setup Script +### Running the Database Setup Script -1. Ensure you have PostgreSQL installed and running on your machine. If you're using macOS, you can use -[Postgres.app](https://postgresapp.com/) or install it with Homebrew: +1. Ensure you have PostgreSQL installed and running on your machine. If you're using macOS, you can use [Postgres.app](https://postgresapp.com/) or install it with Homebrew: - ```shell - brew install postgresql - ``` + ```shell + brew install postgresql + ``` 2. Make sure you have the `dbml2sql` and SeaORM CLI tools installed. You can install them with: - ```shell - npm install -g @dbml/cli - ``` + ```shell + npm install -g @dbml/cli + ``` - ```shell - cargo install sea-orm-cli - ``` + ```shell + cargo install sea-orm-cli + ``` 3. Run the script with default settings: - ```shell - ./scripts/rebuild_db.sh - ``` + ```shell + ./scripts/rebuild_db.sh + ``` - This will create a database named `refactor_platform`, a user named `refactor`, and a schema named `refactor_platform`. + This will create a database named `refactor_platform`, a user named `refactor`, and a schema named `refactor_platform`. 4. If you want to use different settings, you can provide them as arguments to the script: - ```shell - ./scripts/rebuild_db.sh my_database my_user my_schema - ``` + ```shell + ./scripts/rebuild_db.sh my_database my_user my_schema + ``` - This will create a database named `my_database`, a user named `my_user`, and a schema named `my_schema`. + This will create a database named `my_database`, a user named `my_user`, and a schema named `my_schema`. 5. If you want seeded test data in your database, run: @@ -53,8 +52,53 @@ The platform itself is useful for professional independent coaches, informal men cargo run --bin seed_db ``` -Please note that the script assumes that the password for the new PostgreSQL user is `password`. If you want to use a different password, you'll need to modify the script accordingly. + Please note that the script assumes that the password for the new PostgreSQL user is `password`. If you want to use a different password, you'll need to modify the script accordingly. + +<<<<<<< HEAD +======= +### Set Up Database Manually + +Note: these are commands meant to run against a real PostgreSQL server with an admin-level user. + +```sql +-- create new database `refactor_platform` +CREATE DATABASE refactor_platform; +``` + +Change to the `refactor_platform` DB visually if using an app like Postico, otherwise change using the PostgreSQL CLI: + +```sh +\c refactor_platform +``` + +```sql +-- create new database user `refactor` +CREATE USER refactor WITH PASSWORD 'password'; +-- create a new schema owned by user `refactor` +CREATE SCHEMA IF NOT EXISTS refactor_platform AUTHORIZATION refactor; +-- check to see that the schema `refactor_platform` exists in the results +SELECT schema_name FROM information_schema.schemata; +-- grant all privileges on schema `refactor_platform` to user `refactor` +GRANT ALL PRIVILEGES ON SCHEMA refactor_platform TO refactor; +``` + +### Run Migrations + +Note: this assumes a database name of `refactor_platform`. + +```bash +DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli migrate up -s refactor_platform +``` + +### Generate a New Entity from Database + +Note that to generate a new entity using the CLI you must ignore all other tables using the `--ignore-tables` option. You must add the option for _each_ table you are ignoring. + +```bash +DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} +``` +>>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) ## Starting the Backend To run the backend directly outside of a container: @@ -62,7 +106,11 @@ To run the backend directly outside of a container: The first example will start the backend with log level DEBUG and attempt to connect to a Postgres DB server on the same machine with user `refactor` and password `password` on port `5432` and selecting the database named `refactor_platform`. ```bash +<<<<<<< HEAD cargo run -- --tiptap-url https://.collab.tiptap.cloud --tiptap-auth-key= --tiptap-jwt-signing-key= --tiptap-app-id= +======= +cargo run -- -l DEBUG -d postgres://refactor:password@localhost:5432/refactor_platform +>>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) ``` To run with a custom Postgresql connection string: @@ -83,9 +131,13 @@ cargo run -- --allowed-origins="http://192.168.1.2:3000,https://192.168.1.2:3000 _This Rust-based backend/web API connects to a PostgreSQL database. It uses Docker and Docker Compose for local development and deployment, including utilities for database management and migrations. You can run PostgreSQL locally (via Docker) or remotely by configuring environment variables._ +<<<<<<< HEAD --- ### Building and Running Locally or Remotely in Containers +======= +### Quickstart +>>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) 1. **Install Prerequisites**: - [Docker](https://www.docker.com/products/docker-desktop) (20+) @@ -105,15 +157,15 @@ _This Rust-based backend/web API connects to a PostgreSQL database. It uses Dock 4. **Build and Start the Platform**: - Local PostgreSQL: - ```bash - docker-compose --env-file .env.local up --build - ``` + ```bash + docker-compose --env-file .env.local up --build + ``` - Remote PostgreSQL: - ```bash - docker-compose --env-file .env.remote-db up --build - ``` + ```bash + docker-compose --env-file .env.remote-db up --build + ``` 5. **Access the API**: - Visit `http://localhost:` in your browser or API client. @@ -122,30 +174,149 @@ _This Rust-based backend/web API connects to a PostgreSQL database. It uses Dock - **Stop all containers**: - ```bash - docker-compose down - ``` - + ```bash + docker-compose down + ``` + **Note**: This will stop all containers, including the database. - + - **Rebuild and restart**: - ```bash - docker-compose up --build - ``` + ```bash + docker-compose up --build + ``` - **View logs**: - ```bash - docker-compose logs - ``` + ```bash + docker-compose logs + ``` -_For additional information, commands, database utilities, gh actions workflow description and debugging tips, check the [Container README](docs/runbooks/Container-README.md)._ +_For additional information, commands, database utilities, GitHub Actions workflow description, and debugging tips, check the [Container README](docs/runbooks/Container-README.md)._ + +--- + +## Running with Pre-built Images from GHCR + +To quickly run the application using pre-built images from GitHub Container Registry (ghcr.io), follow these steps: + +1. **Install Prerequisites**: + - [Docker](https://www.docker.com/products/docker-desktop) (20+) + - [Docker Compose](https://docs.docker.com/compose/install/) (1.29+) + +2. **Create or Update `.env.local`**: + - Create a `.env.local` file (if it doesn't exist) in the project root. + - Ensure the following variables are set correctly: + + ```env + POSTGRES_USER=refactor + POSTGRES_PASSWORD=somepassword + POSTGRES_DB=refactor + POSTGRES_HOST=postgres + POSTGRES_PORT=5432 + BACKEND_PORT=8000 + FRONTEND_PORT=3000 + ``` + +3. **Update `docker-compose.yaml`**: + - Modify the `docker-compose.yaml` to pull images from GHCR instead of building them. Replace the `build:` sections in `backend` and `frontend` services with `image:` directives pointing to the appropriate GHCR image. Example: + + ```yaml + version: '3.8' + services: + db: + image: postgres:latest + # ... other db config ... + + backend: + image: ghcr.io//refactor-platform-rs/rust-backend:latest # Replace with actual image URL + # ... other backend config ... + + frontend: + image: ghcr.io//refactor-platform-rs/nextjs-frontend:latest # Replace with actual image URL + # ... other frontend config ... + ``` + + - Adjust the image tags (e.g., `:latest`, `:`) as needed. + +4. **Run Docker Compose**: + + ```bash + docker-compose up -d + ``` + + This command pulls the specified images from GHCR and starts the application. + +5. **Access the Application**: + - Visit `http://localhost:` (e.g., `http://localhost:3000`) in your browser to access the frontend. + - Access the backend API at `http://localhost:` (e.g., `http://localhost:8000`). + +## Building and Running Locally with Source Code + +If you have the source code and want to build and run the containers locally, follow these steps: + +1. **Install Prerequisites**: + - [Docker](https://www.docker.com/products/docker-desktop) (20+) + - [Docker Compose](https://docs.docker.com/compose/install/) (1.29+) + - [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) + +2. **Clone the Repository**: + + ```bash + git clone + cd + ``` + +3. **Set Environment Variables**: + - Create a `.env.local` file in the project root and set the necessary environment variables (e.g., database credentials, ports). Example: + + ```env + POSTGRES_USER=refactor + POSTGRES_PASSWORD=somepassword + POSTGRES_DB=refactor + POSTGRES_HOST=postgres + POSTGRES_PORT=5432 + BACKEND_PORT=8000 + FRONTEND_PORT=3000 + ``` + +4. **Build and Run with Docker Compose**: + + ```bash + docker-compose up --build -d + ``` + + This command builds the images locally using the `Dockerfile` in the project root and the `web` directory, and then starts the containers. + +5. **Access the Application**: + - Visit `http://localhost:` (e.g., `http://localhost:3000`) in your browser to access the frontend. + - Access the backend API at `http://localhost:` (e.g., `http://localhost:8000`). + +### Image Naming Conventions + +When building locally, the images are tagged according to the following conventions: + +- **Backend Image**: `ghcr.io//refactor-platform-rs/rust-backend:` +- **Frontend Image**: `ghcr.io//refactor-platform-rs/nextjs-frontend:` + +Where `` is typically `latest` or a commit SHA. + +### Building with Docker Buildx + +To build for multiple architectures (e.g., `linux/amd64`, `linux/arm64`), use Docker Buildx: + +```bash +docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io//refactor-platform-rs/rust-backend:latest --push . +docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io//refactor-platform-rs/nextjs-frontend:latest --push web +``` + +Remember to replace `` with your actual GitHub username. --- ## Project Directory Structure +<<<<<<< HEAD `docs` - project documentation including architectural records, DB schema, API docs, etc `domain` - Layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. @@ -209,4 +380,15 @@ Note that to generate a new Entity using the CLI you must ignore all other table ```bash DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} -``` \ No newline at end of file +``` +======= +- `docs` - project documentation including architectural records, DB schema, API docs, etc. +- `domain` - layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. +- `entity_api` - data operations on the various `Entity` models +- `entity` - shape of the data models and the relationships to each other +- `migration` - relational DB SQL migrations +- `scripts` - contains handy developer-related scripts that make working with this codebase more straightforward +- `service` - CLI flags, environment variables, config handling, and backend daemon setup +- `src` - contains a main function that initializes logging and calls all sub-services +- `web` - API endpoint definition, routing, handling of request/responses, controllers +>>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) diff --git a/docs/runbooks/Container-README.md b/docs/runbooks/Container-README.md index 2366d8d8..7b9eb112 100644 --- a/docs/runbooks/Container-README.md +++ b/docs/runbooks/Container-README.md @@ -95,7 +95,7 @@ BACKEND_API_VERSION="0.0.1" FRONTEND_SERVICE_INTERFACE=0.0.0.0 FRONTEND_SERVICE_PORT=3000 -PLATFORM=linux/arm64 # For Raspberry Pi 5 or Apple Silicon +PLATFORM=linux/arm64 # For Raspberry Pi 5 or Apple Silicon CONTAINER_NAME="refactor-platform" # App user configuration @@ -110,8 +110,7 @@ TIPTAP_JWT_SIGNING_KEY=tiptap-jwt-signing-key ### 3. **Review `docker-compose.yaml`** -The `docker-compose.yaml` file uses environment variables defined in your `.env` file setting important -configuration variables for both the Rust backend and the Next.js frontend applications. +The `docker-compose.yaml` file uses environment variables defined in your `.env` file setting important configuration variables for both the Rust backend and the Next.js frontend applications. ```yaml services: @@ -162,7 +161,7 @@ services: networks: - backend_network command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] - + nextjs-app: build: context: https://github.com/refactor-group/refactor-platform-fe.git#main @@ -190,7 +189,7 @@ networks: driver: bridge volumes: - postgres_data + postgres_data: ``` --- @@ -219,7 +218,7 @@ docker-compose --env-file .env.local up --build docker-compose --env-file .env.remote-db up --build ``` -The web API will be accessible at `http://localhost:` +The web API will be accessible at `http://localhost:`. --- @@ -245,10 +244,6 @@ If you have a DBML file (`schema.dbml`), convert it to SQL: docker-compose run -v $(pwd)/sql:/app/sql -v $(pwd)/schema.dbml:/app/schema.dbml rust-app dbml2sql ``` -```bash -docker-compose run -v $(pwd)/sql:/app/sql -v $(pwd)/schema.dbml:/app/schema.dbml rust-app dbml2sql -``` - --- ## Managing Containers @@ -345,13 +340,13 @@ volumes: ``` - Access a running container: - + ```bash docker exec -it bash ``` - Restart a single service: - + ```bash docker-compose restart rust-app ``` @@ -361,20 +356,20 @@ volumes: ## Interactive Testing - Test interactively: - + ```bash docker run -it rust-backend:latest ``` - Debug inside the container: - + ```bash docker run -it --entrypoint /bin/bash rust-backend:latest ``` --- -# GitHub Actions Workflow for Container Deployment +## GitHub Actions Workflow for Container Deployment ### 🚀 Workflow Overview: Build, Test, and Deploy with Containers @@ -382,72 +377,72 @@ This workflow automates the process of building, testing, and deploying the Refa ### ⚙️ Key Components -1. **Environment Setup**: - * Defines environment variables like `REGISTRY` (ghcr.io), `IMAGE_NAME`, `BACKEND_IMAGE_NAME`, and `FRONTEND_IMAGE_NAME`. - * Sets up secrets for PostgreSQL credentials, ports, and other configurations. These secrets are stored securely in GitHub. - -2. **Build and Test Job (`build_test_run`)**: - * Runs on Ubuntu. - * Checks out the code using `actions/checkout@v4`. - * Sets environment variables from GitHub secrets. - * Installs the Rust toolchain using `dtolnay/rust-toolchain@stable`. - * Caches dependencies using `Swatinem/rust-cache@v2` to speed up subsequent builds. - * Installs `sea-orm-cli`. - * Builds the Rust project using `cargo build --all-targets`. - * Runs tests using `cargo test`. - -3. **Build and Push Docker Images Job (`build_and_push_docker`)**: - * Depends on the `build_test_run` job to ensure tests pass before building images. - * Logs into the GitHub Container Registry (ghcr.io) using `docker/login-action@v2`. - * Sets up Docker Buildx using `docker/setup-buildx-action@v3` for multi-platform builds (amd64 and arm64). - * Caches Docker layers using `actions/cache@v3` to speed up image builds. - * Extracts metadata for Docker images using `docker/metadata-action@v4`. - * Builds and pushes the Rust backend image using `docker/build-push-action@v6`. - * Context: The root directory (`.`). - * Dockerfile: Uses the Dockerfile in the root. - * Tags: Creates tags for the image, including `latest` and a tag based on the Git SHA. - * Builds and pushes the Next.js frontend image using `docker/build-push-action@v6`. - * Context: The web directory. - * Dockerfile: Uses the Dockerfile. - * Tags: Creates tags for the image, similar to the backend. - * Generates artifact attestation for both images using `actions/attest-build-provenance@v2`. +1. **Environment Setup**: + - Defines environment variables like `REGISTRY` (ghcr.io), `IMAGE_NAME`, `BACKEND_IMAGE_NAME`, and `FRONTEND_IMAGE_NAME`. + - Sets up secrets for PostgreSQL credentials, ports, and other configurations. These secrets are stored securely in GitHub. + +2. **Build and Test Job (`build_test_run`)**: + - Runs on Ubuntu. + - Checks out the code using `actions/checkout@v4`. + - Sets environment variables from GitHub secrets. + - Installs the Rust toolchain using `dtolnay/rust-toolchain@stable`. + - Caches dependencies using `Swatinem/rust-cache@v2` to speed up subsequent builds. + - Installs `sea-orm-cli`. + - Builds the Rust project using `cargo build --all-targets`. + - Runs tests using `cargo test`. + +3. **Build and Push Docker Images Job (`build_and_push_docker`)**: + - Depends on the `build_test_run` job to ensure tests pass before building images. + - Logs into the GitHub Container Registry (ghcr.io) using `docker/login-action@v2`. + - Sets up Docker Buildx using `docker/setup-buildx-action@v3` for multi-platform builds (amd64 and arm64). + - Caches Docker layers using `actions/cache@v3` to speed up image builds. + - Extracts metadata for Docker images using `docker/metadata-action@v4`. + - Builds and pushes the Rust backend image using `docker/build-push-action@v6`. + - Context: The root directory (`.`). + - Dockerfile: Uses the Dockerfile in the root. + - Tags: Creates tags for the image, including `latest` and a tag based on the Git SHA. + - Builds and pushes the Next.js frontend image using `docker/build-push-action@v6`. + - Context: The web directory. + - Dockerfile: Uses the Dockerfile. + - Tags: Creates tags for the image, similar to the backend. + - Generates artifact attestation for both images using `actions/attest-build-provenance@v2`. ### 🛠️ Rust Workspace and Build Process -* **Rust Workspace**: The project is structured as a Rust workspace, defined by the main Cargo.toml file. This allows managing multiple related crates (e.g., entity, entity_api, migration, service, web) in a single repository. -* **Build Targets**: The `cargo build --all-targets` command builds all binaries, examples, and tests defined in the workspace. -* **Release Build**: The Dockerfile uses `cargo build --release` to create optimized release builds. +- **Rust Workspace**: The project is structured as a Rust workspace, defined by the main Cargo.toml file. This allows managing multiple related crates (e.g., entity, entity_api, migration, service, web) in a single repository. +- **Build Targets**: The `cargo build --all-targets` command builds all binaries, examples, and tests defined in the workspace. +- **Release Build**: The Dockerfile uses `cargo build --release` to create optimized release builds. ### 🐳 Docker and Docker Compose -* **Docker**: Docker is used to containerize the Rust backend and Next.js frontend applications. Each application has its own Dockerfile that specifies the build environment, dependencies, and entry point. -* **Docker Compose**: While the workflow doesn't directly use `docker-compose`, the `docker-compose.yaml` file defines how the different services (e.g., backend, frontend, database) are orchestrated and linked together for local development. +- **Docker**: Docker is used to containerize the Rust backend and Next.js frontend applications. Each application has its own Dockerfile that specifies the build environment, dependencies, and entry point. +- **Docker Compose**: While the workflow doesn't directly use `docker-compose`, the `docker-compose.yaml` file defines how the different services (e.g., backend, frontend, database) are orchestrated and linked together for local development. ### 📦 GitHub Container Registry (GHCR) -* The workflow pushes the built Docker images to the GitHub Container Registry (GHCR). GHCR is a container registry provided by GitHub that allows storing and managing Docker images alongside the code. -* Images are tagged with `latest` and the Git SHA for versioning. +- The workflow pushes the built Docker images to the GitHub Container Registry (GHCR). GHCR is a container registry provided by GitHub that allows storing and managing Docker images alongside the code. +- Images are tagged with `latest` and the Git SHA for versioning. ### ✅ Improvements and Optimizations -1. **Multi-Arch Builds**: The workflow already supports multi-architecture builds (amd64 and arm64), which is great for deploying to different platforms. -2. **Cache**: Docker layer caching is implemented to speed up builds. -3. **Secrets**: Secrets are used to securely manage sensitive information. +1. **Multi-Arch Builds**: The workflow already supports multi-architecture builds (amd64 and arm64), which is great for deploying to different platforms. +2. **Cache**: Docker layer caching is implemented to speed up builds. +3. **Secrets**: Secrets are used to securely manage sensitive information. ### 📝 Summary for Newcomers This GitHub Actions workflow automates building, testing, and deploying our Rust-based platform using Docker containers. Here's the gist: -1 **Code Changes**: When code is pushed (excluding `main` branch) or a pull request is made to `main`, the workflow kicks off. -2. **Build & Test**: It builds the Rust code and runs tests to ensure everything works. -3. **Containerize**: It creates Docker images for the backend and frontend. -4. **Push to GHCR**: It pushes these images to GitHub's container registry (GHCR). +1. **Code Changes**: When code is pushed (excluding `main` branch) or a pull request is made to `main`, the workflow kicks off. +2. **Build & Test**: It builds the Rust code and runs tests to ensure everything works. +3. **Containerize**: It creates Docker images for the backend and frontend. +4. **Push to GHCR**: It pushes these images to GitHub's container registry (GHCR). This setup ensures that our application is automatically built, tested, and containerized whenever we make changes, making deployment a breeze! 🌬️ ### ⚠️ Potential Corrections -1. **Workflow Triggers**: Consider adding a trigger for the `main` branch to rebuild and deploy on merges to main. -2. **Image Tagging**: Implement a more robust tagging strategy (e.g., semantic versioning) for production releases. -3. **Deployment**: The workflow currently builds and pushes images but doesn't deploy them. Add a deployment step to deploy the images to a staging or production environment. -4. **Error Handling**: Implement error handling and logging to provide better insights into workflow failures. \ No newline at end of file +1. **Workflow Triggers**: Consider adding a trigger for the `main` branch to rebuild and deploy on merges to main. +2. **Image Tagging**: Implement a more robust tagging strategy (e.g., semantic versioning) for production releases. +3. **Deployment**: The workflow currently builds and pushes images but doesn't deploy them. Add a deployment step to deploy the images to a staging or production environment. +4. **Error Handling**: Implement error handling and logging to provide better insights into workflow failures. From 5c1dfe5a0010a50ce57177cf7ea85148d6d5f183 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Feb 2025 19:13:29 -0500 Subject: [PATCH 14/74] Update dependencies to latest versions including axum, sqlx, and utoipa --- Cargo.lock | 1 + Cargo.toml | 1 + README.md | 80 ------------------------------------------- entity/Cargo.toml | 12 +++---- entity_api/Cargo.toml | 5 ++- migration/Cargo.toml | 9 ++--- service/Cargo.toml | 12 ++++--- web/Cargo.toml | 20 +++++------ 8 files changed, 30 insertions(+), 110 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8812ace8..d5868f4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -878,6 +878,7 @@ version = "1.0.0-beta1" dependencies = [ "axum-login", "chrono", + "libsqlite3-sys", "sea-orm", "serde", "sqlx", diff --git a/Cargo.toml b/Cargo.toml index cc8af5c8..4cb41bb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ clap = { version = "4.5.20", features = ["cargo", "derive", "env"] } log = "0.4.22" simplelog = { version = "0.12.2", features = ["paris"] } tokio = "1.41.0" +libsqlite3-sys = "0.30.0" # or "0.31.0" [[bin]] name = "seed_db" diff --git a/README.md b/README.md index 8e87ff3b..0a30ef51 100644 --- a/README.md +++ b/README.md @@ -54,8 +54,6 @@ The platform itself is useful for professional independent coaches, informal men Please note that the script assumes that the password for the new PostgreSQL user is `password`. If you want to use a different password, you'll need to modify the script accordingly. -<<<<<<< HEAD -======= ### Set Up Database Manually Note: these are commands meant to run against a real PostgreSQL server with an admin-level user. @@ -98,7 +96,6 @@ Note that to generate a new entity using the CLI you must ignore all other table DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} ``` ->>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) ## Starting the Backend To run the backend directly outside of a container: @@ -106,11 +103,7 @@ To run the backend directly outside of a container: The first example will start the backend with log level DEBUG and attempt to connect to a Postgres DB server on the same machine with user `refactor` and password `password` on port `5432` and selecting the database named `refactor_platform`. ```bash -<<<<<<< HEAD -cargo run -- --tiptap-url https://.collab.tiptap.cloud --tiptap-auth-key= --tiptap-jwt-signing-key= --tiptap-app-id= -======= cargo run -- -l DEBUG -d postgres://refactor:password@localhost:5432/refactor_platform ->>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) ``` To run with a custom Postgresql connection string: @@ -131,13 +124,7 @@ cargo run -- --allowed-origins="http://192.168.1.2:3000,https://192.168.1.2:3000 _This Rust-based backend/web API connects to a PostgreSQL database. It uses Docker and Docker Compose for local development and deployment, including utilities for database management and migrations. You can run PostgreSQL locally (via Docker) or remotely by configuring environment variables._ -<<<<<<< HEAD ---- - -### Building and Running Locally or Remotely in Containers -======= ### Quickstart ->>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) 1. **Install Prerequisites**: - [Docker](https://www.docker.com/products/docker-desktop) (20+) @@ -316,72 +303,6 @@ Remember to replace `` with your actual GitHub username. ## Project Directory Structure -<<<<<<< HEAD -`docs` - project documentation including architectural records, DB schema, API docs, etc - -`domain` - Layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. - -`entity_api` - data operations on the various `Entity` models - -`entity` - shape of the data models and the relationships to each other - -`migration` - relational DB SQL migrations - -`scripts` - contains handy developer-related scripts that make working with this codebase more straightforward - -`service` - CLI flags, environment variables, config handling and backend daemon setup - -`src` - contains a main function that initializes logging and calls all sub-services - -`web` - API endpoint definition, routing, handling of request/responses, controllers - ---- - -## Advanced / Manual DB operations - -### Set Up Database Manually - -Note: these are commands meant to run against a real Postgresql server with an admin level user. - -```sql ---create new database `refactor_platform` -CREATE DATABASE refactor_platform; -``` - -Change to the refactor_platform DB visually if using app like Postico, otherwise change using the -Postgresql CLI: - -```sh -\c refactor_platform -``` - -```sql ---create new database user `refactor` -CREATE USER refactor WITH PASSWORD 'password'; ---create a new schema owned by user `refactor` -CREATE SCHEMA IF NOT EXISTS refactor_platform AUTHORIZATION refactor; ---Check to see that the schema `refactor_platform` exists in the results -SELECT schema_name FROM information_schema.schemata; ---Grant all privileges on schema `refactor_platform` to user `refactor` -GRANT ALL PRIVILEGES ON SCHEMA refactor_platform TO refactor; -``` - -### Run Migrations - -Note: this assumes a database name of `refactor_platform` - -```bash -DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli migrate up -s refactor_platform -``` - -### Generate a new Entity from Database - -Note that to generate a new Entity using the CLI you must ignore all other tables using the `--ignore-tables` option. You must add the option for _each_ table you are ignoring. - -```bash - DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} -``` -======= - `docs` - project documentation including architectural records, DB schema, API docs, etc. - `domain` - layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. - `entity_api` - data operations on the various `Entity` models @@ -391,4 +312,3 @@ Note that to generate a new Entity using the CLI you must ignore all other table - `service` - CLI flags, environment variables, config handling, and backend daemon setup - `src` - contains a main function that initializes logging and calls all sub-services - `web` - API endpoint definition, routing, handling of request/responses, controllers ->>>>>>> a66f9cd (Update Dockerfile and docker-compose for improved configuration and structure) diff --git a/entity/Cargo.toml b/entity/Cargo.toml index 35498cae..6ddb8e3b 100644 --- a/entity/Cargo.toml +++ b/entity/Cargo.toml @@ -8,15 +8,15 @@ name = "entity" path = "src/lib.rs" [dependencies] -axum-login = "0.16.0" +axum-login = "0.17.0" chrono = { version = "0.4.38", features = ["serde"] } serde = { version = "1.0.210", features = ["derive"] } -sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } -utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } - +sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.3" } # Updated version +utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } +libsqlite3-sys = "0.31.0" uuid = { version = "1.11.0", features = ["v4", "serde"] } [dependencies.sea-orm] version = "1.1.0" -features = [ "with-uuid" ] +features = ["with-uuid"] diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index 343ad2cc..f7a2a288 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -11,13 +11,12 @@ serde_json = "1.0.128" serde = { version = "1.0.210", features = ["derive"] } log = "0.4.22" -axum-login = "0.16.0" +axum-login = "0.17.0" async-trait = "0.1.83" password-auth = "1.0.0" slugify = "0.1.0" sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } -utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } +utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } [dependencies.sea-orm] version = "1.1.0" # sea-orm version diff --git a/migration/Cargo.toml b/migration/Cargo.toml index 44cce23a..f3afe95f 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -10,12 +10,9 @@ path = "src/lib.rs" [dependencies] async-std = { version = "1.13", features = ["attributes", "tokio1"] } -sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } +sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.3" } # Updated version [dependencies.sea-orm-migration] version = "1.1.0" -features = [ - "runtime-tokio-rustls", - "sqlx-postgres", -] +features = ["runtime-tokio-rustls", "sqlx-postgres"] diff --git a/service/Cargo.toml b/service/Cargo.toml index 76bafa92..7ee6440b 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -11,7 +11,7 @@ features = [ "debug-print", "runtime-tokio-native-tls", "sqlx-postgres", - "with-uuid" + "with-uuid", ] [dependencies] @@ -21,9 +21,11 @@ log = "0.4.22" simplelog = { version = "0.12.2", features = ["paris"] } serde = { version = "1.0.210", features = ["derive"] } serde_json = "1.0.128" -sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } +sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.3" } # Updated version tokio = { version = "1.40", features = ["full"] } -tower = "0.5.1" -utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } +tower = { version = "0.5.1", features = [ + "tower-http", +] } # Added feature for tower +utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } semver = { version = "1.0.23", features = ["serde"] } diff --git a/web/Cargo.toml b/web/Cargo.toml index 6689908c..464475ff 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -10,22 +10,22 @@ domain = { path = "../domain" } service = { path = "../service" } entity_api = { path = "../entity_api" } -axum = "0.7.7" -axum-login = "0.16.0" -chrono = { version = "0.4.38", features = ["serde"] } +axum = "0.8.1" +axum-login = "0.17.0" log = "0.4.22" tower-http = { version = "0.6.1", features = ["fs", "cors"] } serde_json = "1.0.128" serde = { version = "1.0.210", features = ["derive"] } -sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } -tokio = { version = "1.40.0", features = ["full"] } +sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } +tokio = { version = "1.40", features = [ + "full", +] } # Remove the ".0" for consistency tower = "0.5.1" -tower-sessions = { version = "0.13.0" } -tower-sessions-sqlx-store = { version = "0.14.1", features = ["postgres"] } +tower-sessions = { version = "0.14.0" } +tower-sessions-sqlx-store = { version = "0.15.0", features = ["postgres"] } time = "0.3.36" -utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } -utoipa-rapidoc = { version = "3.0.0", features = ["axum"] } +utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } +utoipa-rapidoc = { version = "6.0.0", features = ["axum"] } [dependencies.sea-orm] version = "1.1.0" # sea-orm version From 1fec2c196564eef27498c062d8ef6c676765d85d Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 21 Feb 2025 14:37:33 -0500 Subject: [PATCH 15/74] removes sqlite dependencies from Cargo files. --- Cargo.toml | 2 +- entity/Cargo.toml | 6 +++--- entity_api/Cargo.toml | 4 ++-- migration/Cargo.toml | 2 +- service/Cargo.toml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4cb41bb0..33724c6c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ clap = { version = "4.5.20", features = ["cargo", "derive", "env"] } log = "0.4.22" simplelog = { version = "0.12.2", features = ["paris"] } tokio = "1.41.0" -libsqlite3-sys = "0.30.0" # or "0.31.0" +#libsqlite3-sys = "0.30.0" # or "0.31.0" [[bin]] name = "seed_db" diff --git a/entity/Cargo.toml b/entity/Cargo.toml index 6ddb8e3b..9d00b6f2 100644 --- a/entity/Cargo.toml +++ b/entity/Cargo.toml @@ -8,13 +8,13 @@ name = "entity" path = "src/lib.rs" [dependencies] -axum-login = "0.17.0" +axum-login = "0.16.0" chrono = { version = "0.4.38", features = ["serde"] } serde = { version = "1.0.210", features = ["derive"] } sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.3" } # Updated version +# sqlx-sqlite = { version = "0.8.3" } # Updated version utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } -libsqlite3-sys = "0.31.0" +# libsqlite3-sys = "0.31.0" uuid = { version = "1.11.0", features = ["v4", "serde"] } [dependencies.sea-orm] diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index f7a2a288..2ef6a0f5 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -14,8 +14,8 @@ log = "0.4.22" axum-login = "0.17.0" async-trait = "0.1.83" password-auth = "1.0.0" -slugify = "0.1.0" -sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } +sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } +# sqlx-sqlite = { version = "0.8.3" } utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } [dependencies.sea-orm] diff --git a/migration/Cargo.toml b/migration/Cargo.toml index f3afe95f..a51b5c8d 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -11,7 +11,7 @@ path = "src/lib.rs" [dependencies] async-std = { version = "1.13", features = ["attributes", "tokio1"] } sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.3" } # Updated version +# sqlx-sqlite = { version = "0.8.3" } # Updated version [dependencies.sea-orm-migration] version = "1.1.0" diff --git a/service/Cargo.toml b/service/Cargo.toml index 7ee6440b..6eae19a2 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -22,7 +22,7 @@ simplelog = { version = "0.12.2", features = ["paris"] } serde = { version = "1.0.210", features = ["derive"] } serde_json = "1.0.128" sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.3" } # Updated version +# sqlx-sqlite = { version = "0.8.3" } # Updated version tokio = { version = "1.40", features = ["full"] } tower = { version = "0.5.1", features = [ "tower-http", From 9129073406f8b2c63c5d5e606590cb311631b05c Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 21 Feb 2025 15:57:57 -0500 Subject: [PATCH 16/74] removes sqlite deps, upgrades tower for service --- Cargo.toml | 1 - Dockerfile | 7 +++++-- entity_api/Cargo.toml | 1 - service/Cargo.toml | 4 +--- web/Cargo.toml | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 33724c6c..cc8af5c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,6 @@ clap = { version = "4.5.20", features = ["cargo", "derive", "env"] } log = "0.4.22" simplelog = { version = "0.12.2", features = ["paris"] } tokio = "1.41.0" -#libsqlite3-sys = "0.30.0" # or "0.31.0" [[bin]] name = "seed_db" diff --git a/Dockerfile b/Dockerfile index a250acb8..6ea89e42 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,8 +30,11 @@ COPY ./web/Cargo.toml ./web/Cargo.toml # Copy the complete source code into the container's working directory COPY . . -# Build the project -RUN cargo build --release --workspace +# clean the Cargo.lock file to avoid rebuilding the dependencies +RUN cargo clean + +# Build workspace and dependencies to leverage Docker cache +RUN cargo build --release --workspace --target aarch64-unknown-linux-gnu # Stage 2: Runtime Stage FROM debian:stable-slim AS runtime diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index 2ef6a0f5..5de5387a 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -15,7 +15,6 @@ axum-login = "0.17.0" async-trait = "0.1.83" password-auth = "1.0.0" sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -# sqlx-sqlite = { version = "0.8.3" } utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } [dependencies.sea-orm] diff --git a/service/Cargo.toml b/service/Cargo.toml index 6eae19a2..5fd61e87 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -24,8 +24,6 @@ serde_json = "1.0.128" sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } # sqlx-sqlite = { version = "0.8.3" } # Updated version tokio = { version = "1.40", features = ["full"] } -tower = { version = "0.5.1", features = [ - "tower-http", -] } # Added feature for tower +tower = { version = "0.5.2", features = ["util", "http"] } # or similar utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } semver = { version = "1.0.23", features = ["serde"] } diff --git a/web/Cargo.toml b/web/Cargo.toml index 464475ff..8a9e46e2 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -20,7 +20,7 @@ sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } tokio = { version = "1.40", features = [ "full", ] } # Remove the ".0" for consistency -tower = "0.5.1" +tower = { version = "0.5.2", features = ["util", "http"] } # or similar tower-sessions = { version = "0.14.0" } tower-sessions-sqlx-store = { version = "0.15.0", features = ["postgres"] } time = "0.3.36" From 1abc8927561cf6d7c74f7de5e0b5453916924c36 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 6 Mar 2025 15:10:53 -0500 Subject: [PATCH 17/74] merges remaining changes from main. --- README.md | 80 +++++++++++++++++++++++++++++++++++++++++++ entity_api/Cargo.toml | 7 ++++ web/Cargo.toml | 6 ++++ 3 files changed, 93 insertions(+) diff --git a/README.md b/README.md index 0a30ef51..ab8790ef 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ The platform itself is useful for professional independent coaches, informal men Please note that the script assumes that the password for the new PostgreSQL user is `password`. If you want to use a different password, you'll need to modify the script accordingly. +<<<<<<< HEAD ### Set Up Database Manually Note: these are commands meant to run against a real PostgreSQL server with an admin-level user. @@ -96,6 +97,8 @@ Note that to generate a new entity using the CLI you must ignore all other table DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} ``` +======= +>>>>>>> f61c08b (merges remaining changes from main.) ## Starting the Backend To run the backend directly outside of a container: @@ -103,7 +106,11 @@ To run the backend directly outside of a container: The first example will start the backend with log level DEBUG and attempt to connect to a Postgres DB server on the same machine with user `refactor` and password `password` on port `5432` and selecting the database named `refactor_platform`. ```bash +<<<<<<< HEAD cargo run -- -l DEBUG -d postgres://refactor:password@localhost:5432/refactor_platform +======= +cargo run -- --tiptap-url https://.collab.tiptap.cloud --tiptap-auth-key= --tiptap-jwt-signing-key= --tiptap-app-id= +>>>>>>> f61c08b (merges remaining changes from main.) ``` To run with a custom Postgresql connection string: @@ -124,7 +131,13 @@ cargo run -- --allowed-origins="http://192.168.1.2:3000,https://192.168.1.2:3000 _This Rust-based backend/web API connects to a PostgreSQL database. It uses Docker and Docker Compose for local development and deployment, including utilities for database management and migrations. You can run PostgreSQL locally (via Docker) or remotely by configuring environment variables._ +<<<<<<< HEAD ### Quickstart +======= +--- + +### Building and Running Locally or Remotely in Containers +>>>>>>> f61c08b (merges remaining changes from main.) 1. **Install Prerequisites**: - [Docker](https://www.docker.com/products/docker-desktop) (20+) @@ -303,6 +316,7 @@ Remember to replace `` with your actual GitHub username. ## Project Directory Structure +<<<<<<< HEAD - `docs` - project documentation including architectural records, DB schema, API docs, etc. - `domain` - layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. - `entity_api` - data operations on the various `Entity` models @@ -312,3 +326,69 @@ Remember to replace `` with your actual GitHub username. - `service` - CLI flags, environment variables, config handling, and backend daemon setup - `src` - contains a main function that initializes logging and calls all sub-services - `web` - API endpoint definition, routing, handling of request/responses, controllers +======= +`docs` - project documentation including architectural records, DB schema, API docs, etc + +`domain` - Layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. + +`entity_api` - data operations on the various `Entity` models + +`entity` - shape of the data models and the relationships to each other + +`migration` - relational DB SQL migrations + +`scripts` - contains handy developer-related scripts that make working with this codebase more straightforward + +`service` - CLI flags, environment variables, config handling and backend daemon setup + +`src` - contains a main function that initializes logging and calls all sub-services + +`web` - API endpoint definition, routing, handling of request/responses, controllers + +--- + +## Advanced / Manual DB operations + +### Set Up Database Manually + +Note: these are commands meant to run against a real Postgresql server with an admin level user. + +```sql +--create new database `refactor_platform` +CREATE DATABASE refactor_platform; +``` + +Change to the refactor_platform DB visually if using app like Postico, otherwise change using the +Postgresql CLI: + +```sh +\c refactor_platform +``` + +```sql +--create new database user `refactor` +CREATE USER refactor WITH PASSWORD 'password'; +--create a new schema owned by user `refactor` +CREATE SCHEMA IF NOT EXISTS refactor_platform AUTHORIZATION refactor; +--Check to see that the schema `refactor_platform` exists in the results +SELECT schema_name FROM information_schema.schemata; +--Grant all privileges on schema `refactor_platform` to user `refactor` +GRANT ALL PRIVILEGES ON SCHEMA refactor_platform TO refactor; +``` + +### Run Migrations + +Note: this assumes a database name of `refactor_platform` + +```bash +DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli migrate up -s refactor_platform +``` + +### Generate a new Entity from Database + +Note that to generate a new Entity using the CLI you must ignore all other tables using the `--ignore-tables` option. You must add the option for _each_ table you are ignoring. + +```bash + DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} +``` +>>>>>>> f61c08b (merges remaining changes from main.) diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index 5de5387a..260d8709 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -14,8 +14,15 @@ log = "0.4.22" axum-login = "0.17.0" async-trait = "0.1.83" password-auth = "1.0.0" +<<<<<<< HEAD sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } +======= +slugify = "0.1.0" +sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.2" } +utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } +>>>>>>> f61c08b (merges remaining changes from main.) [dependencies.sea-orm] version = "1.1.0" # sea-orm version diff --git a/web/Cargo.toml b/web/Cargo.toml index 8a9e46e2..517efa1e 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -10,8 +10,14 @@ domain = { path = "../domain" } service = { path = "../service" } entity_api = { path = "../entity_api" } +<<<<<<< HEAD axum = "0.8.1" axum-login = "0.17.0" +======= +axum = "0.7.7" +axum-login = "0.16.0" +chrono = { version = "0.4.38", features = ["serde"] } +>>>>>>> f61c08b (merges remaining changes from main.) log = "0.4.22" tower-http = { version = "0.6.1", features = ["fs", "cors"] } serde_json = "1.0.128" From 9810165d913b8f0b7e7ddb9cd70d83b9d9eeea38 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 6 Mar 2025 16:16:25 -0500 Subject: [PATCH 18/74] removing cargo clean, bc it can negate Docker layer Caching --- Dockerfile | 3 --- 1 file changed, 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ea89e42..dff4197f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,9 +30,6 @@ COPY ./web/Cargo.toml ./web/Cargo.toml # Copy the complete source code into the container's working directory COPY . . -# clean the Cargo.lock file to avoid rebuilding the dependencies -RUN cargo clean - # Build workspace and dependencies to leverage Docker cache RUN cargo build --release --workspace --target aarch64-unknown-linux-gnu From 3215b1f9216e8c285ef1297a06f4e286f4d0595f Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 6 Mar 2025 16:43:54 -0500 Subject: [PATCH 19/74] removes sqlite dependencies, update tower version to 0.5.1 --- entity_api/Cargo.toml | 1 - service/Cargo.toml | 3 +-- web/Cargo.toml | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index 260d8709..ba5388e7 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -20,7 +20,6 @@ utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } ======= slugify = "0.1.0" sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } >>>>>>> f61c08b (merges remaining changes from main.) diff --git a/service/Cargo.toml b/service/Cargo.toml index 5fd61e87..648a0bd0 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -22,8 +22,7 @@ simplelog = { version = "0.12.2", features = ["paris"] } serde = { version = "1.0.210", features = ["derive"] } serde_json = "1.0.128" sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -# sqlx-sqlite = { version = "0.8.3" } # Updated version tokio = { version = "1.40", features = ["full"] } -tower = { version = "0.5.2", features = ["util", "http"] } # or similar +tower = { version = "0.5.1", features = ["util", "http"] } # or similar utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } semver = { version = "1.0.23", features = ["serde"] } diff --git a/web/Cargo.toml b/web/Cargo.toml index 517efa1e..c1042209 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -26,7 +26,7 @@ sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } tokio = { version = "1.40", features = [ "full", ] } # Remove the ".0" for consistency -tower = { version = "0.5.2", features = ["util", "http"] } # or similar +tower = { version = "0.5.1", features = ["util", "http"] } # or similar tower-sessions = { version = "0.14.0" } tower-sessions-sqlx-store = { version = "0.15.0", features = ["postgres"] } time = "0.3.36" From ee9ead9c2d426d8fecb8b6170088848919627912 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 13 Mar 2025 21:39:56 -0400 Subject: [PATCH 20/74] merges in changes from test branch. --- .../workflows/build_and_deploy_containers.yml | 210 +++++++++++++++++- Dockerfile | 49 ++-- README.md | 203 ++++------------- docker-compose.yaml | 58 +++-- docs/runbooks/Container-README.md | 103 ++------- entity/Cargo.toml | 10 +- entity_api/Cargo.toml | 3 +- migration/Cargo.toml | 9 +- service/Cargo.toml | 9 +- web/Cargo.toml | 17 +- 10 files changed, 366 insertions(+), 305 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index b6848c11..5082d7d6 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -1,7 +1,9 @@ -name: Build and Deploy Containers +name: Build and Deploy Containers # Workflow name +# When workflows are triggered on: push: +<<<<<<< HEAD branches: - main pull_request: @@ -9,13 +11,31 @@ on: - main types: [opened, synchronize, reopened] workflow_dispatch: +======= + branches: + - main # When changes are pushed to main (including merged PRs) + pull_request: + types: [opened, synchronize, reopened] # Run when PRs are opened, updated, or reopened + workflow_dispatch: # Allow manual triggering from any branch +>>>>>>> ca9ea8f (merges in changes from test branch.) +# Global env vars available to all jobs env: +<<<<<<< HEAD REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} +======= + REGISTRY: ghcr.io # GitHub Container Registry URL + IMAGE_NAME: ${{ github.repository }} # Uses the format org/repo-name + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GH token for authentication + BACKEND_IMAGE_NAME: rust-backend # Backend Image name + FRONTEND_IMAGE_NAME: nextjs-frontend # Frontend Image name +>>>>>>> ca9ea8f (merges in changes from test branch.) jobs: + # Build and test the Rust project build_test_run: +<<<<<<< HEAD runs-on: ubuntu-22.04 steps: @@ -65,6 +85,83 @@ jobs: build_and_push_docker: runs-on: ubuntu-22.04 needs: build_test_run +======= + name: Build and Test + runs-on: ubuntu-22.04 # Use Ubuntu 22.04 runner + permissions: + contents: read # Permission to read repository contents + packages: write # Permission to write/publish packages + attestations: write # Permission to write security attestations + id-token: write # Permission for OIDC token (needed for security) + + steps: + # Checkout the code + - name: Checkout + uses: actions/checkout@v4 + + # Set env vars from GitHub Secrets + - name: Set environment variables + run: | + # Database connection parameters + echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV + echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV + echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV + echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV + echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV + echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV + # Construct database URL from individual parameters + echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV + # Backend configuration + echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV + echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV + echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV + echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV + # Container configuration + echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV + echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV + # DNS aliases for services in the compose network + echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV + echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV + echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV + # Tiptap integration parameters + echo "TIPTAP_URL=${{ secrets.TIPTAP_URL }}" >> $GITHUB_ENV + echo "TIPTAP_AUTH_KEY=${{ secrets.TIPTAP_AUTH_KEY }}" >> $GITHUB_ENV + echo "TIPTAP_JWT_SIGNING_KEY=${{ secrets.TIPTAP_JWT_SIGNING_KEY }}" >> $GITHUB_ENV # Fixed typo + + # Install Rust toolchain + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + with: + targets: x86_64-unknown-linux-gnu + + # Use cached dependencies to speed up builds + - name: Use cached dependencies + uses: Swatinem/rust-cache@v2 + with: + key: "ubuntu-22.04-x86_64-unknown-linux-gnu" # Cache key based on OS and architecture + + # Install seaORM CLI for database migrations/management + - name: Install seaORM CLI + run: cargo install sea-orm-cli + + # Build all project targets + - name: Build + run: cargo build --all-targets + + # Run all tests to ensure code quality + - name: Test + run: cargo test + + build_and_push_docker: + name: Build and Push Docker Images + runs-on: ubuntu-22.04 + needs: build_test_run # Only run this job if the first job succeeds + + # Adds permissions for the job + # This is needed for the attestations to work +>>>>>>> ca9ea8f (merges in changes from test branch.) permissions: contents: read packages: write @@ -72,11 +169,46 @@ jobs: id-token: write steps: +<<<<<<< HEAD # Checkout source code - uses: actions/checkout@v4 # Authenticate to GitHub Container Registry - name: Docker login +======= + # Checkout the code + - name: Checkout + uses: actions/checkout@v4 + + # Set env vars for this job + - name: Set environment variables + run: | + # Copy the same environment variables from the first job + echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV + echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV + echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV + echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV + echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV + echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV + echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV + echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV + echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV + echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV + echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV + echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV + echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV + echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV + echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV + echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV + echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV + echo "TIPTAP_URL=${{ secrets.TIPTAP_URL }}" >> $GITHUB_ENV + echo "TIPTAP_AUTH_KEY=${{ secrets.TIPTAP_AUTH_KEY }}" >> $GITHUB_ENV + echo "TIPTAP_JWT_SIGNING_KEY=${{ secrets.TIPTAP_JWT_SIGNING_KEY }}" >> $GITHUB_ENV + + # Log in to GitHub Container Registry + - name: Log in to the Container registry +>>>>>>> ca9ea8f (merges in changes from test branch.) uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} @@ -84,6 +216,7 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} # Set up Docker Buildx for multi-platform builds +<<<<<<< HEAD - uses: docker/setup-buildx-action@v3 with: install: true @@ -139,4 +272,77 @@ jobs: echo " docker pull ${{ steps.tags.outputs.backend_image_name }}:latest" echo "" echo -e "\033[1;36m▶️ Run Backend:\033[0m" - echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" \ No newline at end of file + echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" +======= + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + # Cache Docker layers to speed up subsequent builds + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache # Cache location + key: ${{ runner.os }}-buildx-${{ github.sha }} # Cache key based on OS and commit + restore-keys: | + ${{ runner.os }}-buildx- # Fallback cache key + + # Extract metadata for Docker images (tags, labels) + - name: Extract metadata (tags, labels) for Docker + id: meta # ID to reference outputs in later steps + uses: docker/metadata-action@v4 + with: + # Define the images to extract metadata for + images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }}, ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + + # Build and push the Rust backend image + - name: Build and Push Rust Backend Image + id: push_backend # ID to reference outputs in later steps + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 # Build for multiple architectures + context: . # Build context is root directory + push: true # Push to registry after building + tags: | # Image tags (latest and commit SHA) + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + labels: ${{ steps.meta.outputs.labels }} # Apply extracted labels + cache-from: type=local,src=/tmp/.buildx-cache # Use cached layers + cache-to: type=local,dest=/tmp/.buildx-cache-new # Cache new layers + file: Dockerfile # Use root Dockerfile + + # Build and push the Next.js frontend image + - name: Build and Push Next.js Frontend Image + id: push_frontend # ID to reference outputs in later steps + uses: docker/build-push-action@v6 + with: + platforms: linux/amd64,linux/arm64 # Build for multiple architectures + context: web # Build context is web directory + push: true # Push to registry after building + tags: | # Image tags (latest and commit SHA) + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest + ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + labels: ${{ steps.meta.outputs.labels }} # Apply extracted labels + cache-from: type=local,src=/tmp/.buildx-cache # Use cached layers + cache-to: type=local,dest=/tmp/.buildx-cache-new # Cache new layers + file: web/Dockerfile # Use web Dockerfile + + # Move new cache to the original location for future jobs + - name: Move new cache + run: mv /tmp/.buildx-cache-new /tmp/.buildx-cache # Update cache + + # Generate artifact attestation for security and supply chain integrity + - name: Generate artifact attestation for Rust Backend Image + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }} + subject-digest: ${{ steps.push_backend.outputs.digest }} # Use the digest output from build + push-to-registry: true # Push attestation to registry + + # Generate artifact attestation for security and supply chain integrity + - name: Generate artifact attestation for Next.js Frontend Image + uses: actions/attest-build-provenance@v2 + with: + subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }} + subject-digest: ${{ steps.push_frontend.outputs.digest }} # Use the digest output from build + push-to-registry: true # Push attestation to registry +>>>>>>> ca9ea8f (merges in changes from test branch.) diff --git a/Dockerfile b/Dockerfile index dff4197f..e109a8b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,24 +1,33 @@ # syntax=docker/dockerfile:1 +# Specify the Dockerfile syntax version # Stage 1: Build Stage +<<<<<<< HEAD FROM rust:1.70-slim AS builder +======= +FROM rust:latest AS builder +# AS builder names this stage for easy referencing later +>>>>>>> ca9ea8f (merges in changes from test branch.) # Set the working directory inside the container WORKDIR /usr/src/app +# All subsequent commands will be executed from this directory -# Install necessary packages -RUN apt-get update && apt-get install -y \ +# Install necessary packages for building Rust projects with PostgreSQL dependencies +RUN apt-get update && apt-get install -y --no-install-recommends \ bash \ build-essential \ libssl-dev \ pkg-config \ - && rm -rf /var/lib/apt/lists/* + libpq-dev # Include PostgreSQL development libraries && rm -rf /var/lib/apt/lists/* # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ +# Copy the workspace manifest and lock file. Docker caches layers, so copying these first +# allows Docker to cache dependencies if these files don't change. # Copy each module's Cargo.toml to maintain the workspace structure COPY ./entity/Cargo.toml ./entity/Cargo.toml @@ -30,31 +39,33 @@ COPY ./web/Cargo.toml ./web/Cargo.toml # Copy the complete source code into the container's working directory COPY . . -# Build workspace and dependencies to leverage Docker cache +# Remove the target directory to ensure a clean build. +RUN cargo clean + +# Build workspace and dependencies to leverage Docker cache in release mode for ARM64 RUN cargo build --release --workspace --target aarch64-unknown-linux-gnu # Stage 2: Runtime Stage -FROM debian:stable-slim AS runtime +FROM debian:stable-slim AS runtime -# Install necessary runtime dependencies -RUN apt-get update && apt-get install -y \ +# Install necessary runtime dependencies and clean up apt lists +RUN apt-get update && apt-get install -y --no-install-recommends \ libssl3 \ libpq5 \ - bash \ && rm -rf /var/lib/apt/lists/* # Set the working directory WORKDIR /usr/src/app -# Copy the compiled binaries from the builder stage -COPY --from=builder /usr/src/app/target/release/refactor_platform_rs /usr/local/bin/refactor_platform_rs -COPY --from=builder /usr/src/app/target/release/migration /usr/local/bin/migration -COPY --from=builder /usr/src/app/target/release/seed_db /usr/local/bin/seed_db - # Create a non-root user for running the application RUN useradd -m appuser && \ - chown -R appuser:appuser /usr/src/app /usr/local/bin && \ - chmod +x /usr/local/bin/* + chown -R appuser:appuser /usr/src/app && \ + chmod -R 755 /usr/src/app + +# Copy the compiled binaries from the builder stage +COPY --from=builder /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs /usr/local/bin/refactor_platform_rs +COPY --from=builder /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration /usr/local/bin/migration +COPY --from=builder /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db /usr/local/bin/seed_db # Switch to the non-root user USER appuser @@ -62,8 +73,8 @@ USER appuser # Expose the necessary ports EXPOSE ${BACKEND_PORT} -# Set ENTRYPOINT to default to run the Rust binary with arguments -ENTRYPOINT ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs -l \"$BACKEND_LOG_FILTER_LEVEL\" -i \"$BACKEND_INTERFACE\" -p \"$BACKEND_PORT\" -d \"$DATABASE_URL\" --allowed-origins=$BACKEND_ALLOWED_ORIGINS"] +# Set the entrypoint to run the application +ENTRYPOINT ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs"] -# Default CMD allows overriding with custom commands -CMD ["bash"] +# Set the default args to run when the container starts +CMD ["-l", "$BACKEND_LOG_FILTER_LEVEL", "-i", "$BACKEND_INTERFACE", "-p", "$BACKEND_PORT", "-d", "$DATABASE_URL", "--allowed-origins=$BACKEND_ALLOWED_ORIGINS"] \ No newline at end of file diff --git a/README.md b/README.md index ab8790ef..3dab3f47 100644 --- a/README.md +++ b/README.md @@ -6,45 +6,46 @@ ## Intro -A Rust-based backend that provides a web API for various client applications (e.g., a web frontend) that facilitate the coaching and mentoring of software engineers. +A Rust-based backend that provides a web API for various client applications (e.g. a web frontend) that facilitate the coaching and mentoring of software engineers. -The platform itself is useful for professional independent coaches, informal mentors, and engineering leaders who work with individual software engineers and/or teams by providing a single application that facilitates and enhances your coaching practice. +The platform itself is useful for professional independent coaches, informal mentors and engineering leaders who work with individual software engineers and/or teams by providing a single application that facilitates and enhances your coaching practice. ## Basic Local DB Setup and Management -### Running the Database Setup Script +## Running the Database Setup Script -1. Ensure you have PostgreSQL installed and running on your machine. If you're using macOS, you can use [Postgres.app](https://postgresapp.com/) or install it with Homebrew: +1. Ensure you have PostgreSQL installed and running on your machine. If you're using macOS, you can use +[Postgres.app](https://postgresapp.com/) or install it with Homebrew: - ```shell - brew install postgresql - ``` + ```shell + brew install postgresql + ``` 2. Make sure you have the `dbml2sql` and SeaORM CLI tools installed. You can install them with: - ```shell - npm install -g @dbml/cli - ``` + ```shell + npm install -g @dbml/cli + ``` - ```shell - cargo install sea-orm-cli - ``` + ```shell + cargo install sea-orm-cli + ``` 3. Run the script with default settings: - ```shell - ./scripts/rebuild_db.sh - ``` + ```shell + ./scripts/rebuild_db.sh + ``` - This will create a database named `refactor_platform`, a user named `refactor`, and a schema named `refactor_platform`. + This will create a database named `refactor_platform`, a user named `refactor`, and a schema named `refactor_platform`. 4. If you want to use different settings, you can provide them as arguments to the script: - ```shell - ./scripts/rebuild_db.sh my_database my_user my_schema - ``` + ```shell + ./scripts/rebuild_db.sh my_database my_user my_schema + ``` - This will create a database named `my_database`, a user named `my_user`, and a schema named `my_schema`. + This will create a database named `my_database`, a user named `my_user`, and a schema named `my_schema`. 5. If you want seeded test data in your database, run: @@ -52,7 +53,7 @@ The platform itself is useful for professional independent coaches, informal men cargo run --bin seed_db ``` - Please note that the script assumes that the password for the new PostgreSQL user is `password`. If you want to use a different password, you'll need to modify the script accordingly. +Please note that the script assumes that the password for the new PostgreSQL user is `password`. If you want to use a different password, you'll need to modify the script accordingly. <<<<<<< HEAD ### Set Up Database Manually @@ -157,15 +158,15 @@ _This Rust-based backend/web API connects to a PostgreSQL database. It uses Dock 4. **Build and Start the Platform**: - Local PostgreSQL: - ```bash - docker-compose --env-file .env.local up --build - ``` + ```bash + docker-compose --env-file .env.local up --build + ``` - Remote PostgreSQL: - ```bash - docker-compose --env-file .env.remote-db up --build - ``` + ```bash + docker-compose --env-file .env.remote-db up --build + ``` 5. **Access the API**: - Visit `http://localhost:` in your browser or API client. @@ -174,143 +175,25 @@ _This Rust-based backend/web API connects to a PostgreSQL database. It uses Dock - **Stop all containers**: - ```bash - docker-compose down - ``` - + ```bash + docker-compose down + ``` + **Note**: This will stop all containers, including the database. - + - **Rebuild and restart**: - ```bash - docker-compose up --build - ``` + ```bash + docker-compose up --build + ``` - **View logs**: - ```bash - docker-compose logs - ``` - -_For additional information, commands, database utilities, GitHub Actions workflow description, and debugging tips, check the [Container README](docs/runbooks/Container-README.md)._ - ---- - -## Running with Pre-built Images from GHCR - -To quickly run the application using pre-built images from GitHub Container Registry (ghcr.io), follow these steps: - -1. **Install Prerequisites**: - - [Docker](https://www.docker.com/products/docker-desktop) (20+) - - [Docker Compose](https://docs.docker.com/compose/install/) (1.29+) - -2. **Create or Update `.env.local`**: - - Create a `.env.local` file (if it doesn't exist) in the project root. - - Ensure the following variables are set correctly: - - ```env - POSTGRES_USER=refactor - POSTGRES_PASSWORD=somepassword - POSTGRES_DB=refactor - POSTGRES_HOST=postgres - POSTGRES_PORT=5432 - BACKEND_PORT=8000 - FRONTEND_PORT=3000 - ``` - -3. **Update `docker-compose.yaml`**: - - Modify the `docker-compose.yaml` to pull images from GHCR instead of building them. Replace the `build:` sections in `backend` and `frontend` services with `image:` directives pointing to the appropriate GHCR image. Example: - - ```yaml - version: '3.8' - services: - db: - image: postgres:latest - # ... other db config ... - - backend: - image: ghcr.io//refactor-platform-rs/rust-backend:latest # Replace with actual image URL - # ... other backend config ... - - frontend: - image: ghcr.io//refactor-platform-rs/nextjs-frontend:latest # Replace with actual image URL - # ... other frontend config ... - ``` - - - Adjust the image tags (e.g., `:latest`, `:`) as needed. - -4. **Run Docker Compose**: - - ```bash - docker-compose up -d - ``` - - This command pulls the specified images from GHCR and starts the application. - -5. **Access the Application**: - - Visit `http://localhost:` (e.g., `http://localhost:3000`) in your browser to access the frontend. - - Access the backend API at `http://localhost:` (e.g., `http://localhost:8000`). - -## Building and Running Locally with Source Code - -If you have the source code and want to build and run the containers locally, follow these steps: - -1. **Install Prerequisites**: - - [Docker](https://www.docker.com/products/docker-desktop) (20+) - - [Docker Compose](https://docs.docker.com/compose/install/) (1.29+) - - [Docker Buildx](https://docs.docker.com/buildx/working-with-buildx/) - -2. **Clone the Repository**: - - ```bash - git clone - cd - ``` - -3. **Set Environment Variables**: - - Create a `.env.local` file in the project root and set the necessary environment variables (e.g., database credentials, ports). Example: - - ```env - POSTGRES_USER=refactor - POSTGRES_PASSWORD=somepassword - POSTGRES_DB=refactor - POSTGRES_HOST=postgres - POSTGRES_PORT=5432 - BACKEND_PORT=8000 - FRONTEND_PORT=3000 - ``` + ```bash + docker-compose logs + ``` -4. **Build and Run with Docker Compose**: - - ```bash - docker-compose up --build -d - ``` - - This command builds the images locally using the `Dockerfile` in the project root and the `web` directory, and then starts the containers. - -5. **Access the Application**: - - Visit `http://localhost:` (e.g., `http://localhost:3000`) in your browser to access the frontend. - - Access the backend API at `http://localhost:` (e.g., `http://localhost:8000`). - -### Image Naming Conventions - -When building locally, the images are tagged according to the following conventions: - -- **Backend Image**: `ghcr.io//refactor-platform-rs/rust-backend:` -- **Frontend Image**: `ghcr.io//refactor-platform-rs/nextjs-frontend:` - -Where `` is typically `latest` or a commit SHA. - -### Building with Docker Buildx - -To build for multiple architectures (e.g., `linux/amd64`, `linux/arm64`), use Docker Buildx: - -```bash -docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io//refactor-platform-rs/rust-backend:latest --push . -docker buildx build --platform linux/amd64,linux/arm64 -t ghcr.io//refactor-platform-rs/nextjs-frontend:latest --push web -``` - -Remember to replace `` with your actual GitHub username. +_For additional commands, database utilities, and debugging tips, check the [Container README](docs/runbooks/Container-README.md)._ --- @@ -390,5 +273,9 @@ Note that to generate a new Entity using the CLI you must ignore all other table ```bash DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} +<<<<<<< HEAD ``` >>>>>>> f61c08b (merges remaining changes from main.) +======= +``` +>>>>>>> ca9ea8f (merges in changes from test branch.) diff --git a/docker-compose.yaml b/docker-compose.yaml index 8be59fc3..92e23a86 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,22 +1,31 @@ -version: '3.8' services: # Local PostgreSQL container (used for local development when needed) - db: - image: postgres:latest # Use latest PostgreSQL version - env_file: - - ${ENV_FILE:-.env.local} # Override by setting ENV_FILE; defaults to .env.local + postgres: + image: postgres:17 # Use PostgreSQL version 17 + container_name: postgres # Name the container "postgres" + environment: + POSTGRES_USER: ${POSTGRES_USER} # Set PostgreSQL user from environment variable + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Set PostgreSQL password from environment variable + POSTGRES_DB: ${POSTGRES_DB} # Set PostgreSQL database name from environment variable ports: - - "${DB_PORT:-5432}:5432" # Map host port from .env variable to container's PostgreSQL port + - "${POSTGRES_PORT}:5432" # Map host port to container's PostgreSQL port volumes: +<<<<<<< HEAD - db_data:/var/lib/postgresql/data # Persist PostgreSQL data - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql # Initialize database with setup.sql - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_platform_rs.sql # Initialize with refactor_platform_rs.sql +======= + - postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data + - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql # Initialize database with setup.sql + - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_plaform_rs.sql # Initialize with refactor_platform_rs.sql +>>>>>>> ca9ea8f (merges in changes from test branch.) - ./migration/src/setup_default_user.sql:/docker-entrypoint-initdb.d/2-setup_default_user.sql # Initialize with setup_default_user.sql networks: - backend_network # Connect to backend_network # Rust application that connects to either local or remote PostgreSQL - backend: + rust-app: + image: rust-backend # Use the built image build: context: . # Build context is current directory dockerfile: Dockerfile # Use specified Dockerfile @@ -38,32 +47,51 @@ services: TIPTAP_URL: ${TIPTAP_URL} TIPTAP_AUTH_KEY: ${TIPTAP_AUTH_KEY} TIPTAP_JWT_SIGNING_KEY: ${TIPTAP_JWT_SIGNING_KEY} +<<<<<<< HEAD env_file: - ${ENV_FILE:-.env.local} # Same override capability +======= +>>>>>>> ca9ea8f (merges in changes from test branch.) ports: - "${BACKEND_PORT}:${BACKEND_PORT}" # Map host port to container's service port depends_on: - - db # Ensure db service starts before backend + - postgres # Ensure postgres service starts before rust-app networks: - backend_network # Connect to backend_network - command: ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs -l \\\"$BACKEND_LOG_FILTER_LEVEL\\\" -i \\\"$BACKEND_INTERFACE\\\" -p \\\"$BACKEND_PORT\\\" -d \\\"$DATABASE_URL\\\" --allowed-origins=\\\"$BACKEND_ALLOWED_ORIGINS\\\""] # Wait for Postgres and run the app + command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] # Wait for Postgres and run the app - frontend: + nextjs-app: build: +<<<<<<< HEAD context: . dockerfile: Dockerfile env_file: - ${ENV_FILE:-.env.local} +======= + context: https://github.com/refactor-group/refactor-platform-fe.git#main # change to fs directory to run locally + dockerfile: Dockerfile + target: runner # Use runner target + args: + NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} + NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} + NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} + NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} + FRONTEND_SERVICE_PORT: ${FRONTEND_SERVICE_PORT} + FRONTEND_SERVICE_INTERFACE: ${FRONTEND_SERVICE_INTERFACE} + environment: + NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} + NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} + NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} + NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} +>>>>>>> ca9ea8f (merges in changes from test branch.) ports: - - "${FRONTEND_PORT}:${FRONTEND_PORT}" # Map a different host port to distinguish frontend + - "${FRONTEND_SERVICE_PORT}:${FRONTEND_SERVICE_PORT}" # Map host port to frontend container's service port depends_on: - - backend - # Override command to run the frontend binary instead of the backend binary - command: ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs -l \\\"$BACKEND_LOG_FILTER_LEVEL\\\" -i \\\"$BACKEND_INTERFACE\\\" -p \\\"$BACKEND_PORT\\\" -d \\\"$DATABASE_URL\\\" --allowed-origins=\\\"$BACKEND_ALLOWED_ORIGINS\\\""] + - rust-app # Ensure postgres service starts before rust-app networks: backend_network: driver: bridge # Use bridge network driver volumes: - db_data: # Define db_data volume + postgres_data: # Define postgres_data volume diff --git a/docs/runbooks/Container-README.md b/docs/runbooks/Container-README.md index 7b9eb112..950d1bde 100644 --- a/docs/runbooks/Container-README.md +++ b/docs/runbooks/Container-README.md @@ -95,7 +95,7 @@ BACKEND_API_VERSION="0.0.1" FRONTEND_SERVICE_INTERFACE=0.0.0.0 FRONTEND_SERVICE_PORT=3000 -PLATFORM=linux/arm64 # For Raspberry Pi 5 or Apple Silicon +PLATFORM=linux/arm64 # For Raspberry Pi 5 or Apple Silicon CONTAINER_NAME="refactor-platform" # App user configuration @@ -110,7 +110,8 @@ TIPTAP_JWT_SIGNING_KEY=tiptap-jwt-signing-key ### 3. **Review `docker-compose.yaml`** -The `docker-compose.yaml` file uses environment variables defined in your `.env` file setting important configuration variables for both the Rust backend and the Next.js frontend applications. +The `docker-compose.yaml` file uses environment variables defined in your `.env` file setting important +configuration variables for both the Rust backend and the Next.js frontend applications. ```yaml services: @@ -161,7 +162,7 @@ services: networks: - backend_network command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] - + nextjs-app: build: context: https://github.com/refactor-group/refactor-platform-fe.git#main @@ -189,7 +190,7 @@ networks: driver: bridge volumes: - postgres_data: + postgres_data ``` --- @@ -218,7 +219,7 @@ docker-compose --env-file .env.local up --build docker-compose --env-file .env.remote-db up --build ``` -The web API will be accessible at `http://localhost:`. +The web API will be accessible at `http://localhost:` --- @@ -244,6 +245,10 @@ If you have a DBML file (`schema.dbml`), convert it to SQL: docker-compose run -v $(pwd)/sql:/app/sql -v $(pwd)/schema.dbml:/app/schema.dbml rust-app dbml2sql ``` +```bash +docker-compose run -v $(pwd)/sql:/app/sql -v $(pwd)/schema.dbml:/app/schema.dbml rust-app dbml2sql +``` + --- ## Managing Containers @@ -340,13 +345,13 @@ volumes: ``` - Access a running container: - + ```bash docker exec -it bash ``` - Restart a single service: - + ```bash docker-compose restart rust-app ``` @@ -356,93 +361,13 @@ volumes: ## Interactive Testing - Test interactively: - + ```bash docker run -it rust-backend:latest ``` - Debug inside the container: - + ```bash docker run -it --entrypoint /bin/bash rust-backend:latest ``` - ---- - -## GitHub Actions Workflow for Container Deployment - -### 🚀 Workflow Overview: Build, Test, and Deploy with Containers - -This workflow automates the process of building, testing, and deploying the Refactor Coaching & Mentoring Platform using Docker containers. It's triggered on pushes to branches other than `main`, pull requests to `main`, and can also be manually triggered. - -### ⚙️ Key Components - -1. **Environment Setup**: - - Defines environment variables like `REGISTRY` (ghcr.io), `IMAGE_NAME`, `BACKEND_IMAGE_NAME`, and `FRONTEND_IMAGE_NAME`. - - Sets up secrets for PostgreSQL credentials, ports, and other configurations. These secrets are stored securely in GitHub. - -2. **Build and Test Job (`build_test_run`)**: - - Runs on Ubuntu. - - Checks out the code using `actions/checkout@v4`. - - Sets environment variables from GitHub secrets. - - Installs the Rust toolchain using `dtolnay/rust-toolchain@stable`. - - Caches dependencies using `Swatinem/rust-cache@v2` to speed up subsequent builds. - - Installs `sea-orm-cli`. - - Builds the Rust project using `cargo build --all-targets`. - - Runs tests using `cargo test`. - -3. **Build and Push Docker Images Job (`build_and_push_docker`)**: - - Depends on the `build_test_run` job to ensure tests pass before building images. - - Logs into the GitHub Container Registry (ghcr.io) using `docker/login-action@v2`. - - Sets up Docker Buildx using `docker/setup-buildx-action@v3` for multi-platform builds (amd64 and arm64). - - Caches Docker layers using `actions/cache@v3` to speed up image builds. - - Extracts metadata for Docker images using `docker/metadata-action@v4`. - - Builds and pushes the Rust backend image using `docker/build-push-action@v6`. - - Context: The root directory (`.`). - - Dockerfile: Uses the Dockerfile in the root. - - Tags: Creates tags for the image, including `latest` and a tag based on the Git SHA. - - Builds and pushes the Next.js frontend image using `docker/build-push-action@v6`. - - Context: The web directory. - - Dockerfile: Uses the Dockerfile. - - Tags: Creates tags for the image, similar to the backend. - - Generates artifact attestation for both images using `actions/attest-build-provenance@v2`. - -### 🛠️ Rust Workspace and Build Process - -- **Rust Workspace**: The project is structured as a Rust workspace, defined by the main Cargo.toml file. This allows managing multiple related crates (e.g., entity, entity_api, migration, service, web) in a single repository. -- **Build Targets**: The `cargo build --all-targets` command builds all binaries, examples, and tests defined in the workspace. -- **Release Build**: The Dockerfile uses `cargo build --release` to create optimized release builds. - -### 🐳 Docker and Docker Compose - -- **Docker**: Docker is used to containerize the Rust backend and Next.js frontend applications. Each application has its own Dockerfile that specifies the build environment, dependencies, and entry point. -- **Docker Compose**: While the workflow doesn't directly use `docker-compose`, the `docker-compose.yaml` file defines how the different services (e.g., backend, frontend, database) are orchestrated and linked together for local development. - -### 📦 GitHub Container Registry (GHCR) - -- The workflow pushes the built Docker images to the GitHub Container Registry (GHCR). GHCR is a container registry provided by GitHub that allows storing and managing Docker images alongside the code. -- Images are tagged with `latest` and the Git SHA for versioning. - -### ✅ Improvements and Optimizations - -1. **Multi-Arch Builds**: The workflow already supports multi-architecture builds (amd64 and arm64), which is great for deploying to different platforms. -2. **Cache**: Docker layer caching is implemented to speed up builds. -3. **Secrets**: Secrets are used to securely manage sensitive information. - -### 📝 Summary for Newcomers - -This GitHub Actions workflow automates building, testing, and deploying our Rust-based platform using Docker containers. Here's the gist: - -1. **Code Changes**: When code is pushed (excluding `main` branch) or a pull request is made to `main`, the workflow kicks off. -2. **Build & Test**: It builds the Rust code and runs tests to ensure everything works. -3. **Containerize**: It creates Docker images for the backend and frontend. -4. **Push to GHCR**: It pushes these images to GitHub's container registry (GHCR). - -This setup ensures that our application is automatically built, tested, and containerized whenever we make changes, making deployment a breeze! 🌬️ - -### ⚠️ Potential Corrections - -1. **Workflow Triggers**: Consider adding a trigger for the `main` branch to rebuild and deploy on merges to main. -2. **Image Tagging**: Implement a more robust tagging strategy (e.g., semantic versioning) for production releases. -3. **Deployment**: The workflow currently builds and pushes images but doesn't deploy them. Add a deployment step to deploy the images to a staging or production environment. -4. **Error Handling**: Implement error handling and logging to provide better insights into workflow failures. diff --git a/entity/Cargo.toml b/entity/Cargo.toml index 9d00b6f2..35498cae 100644 --- a/entity/Cargo.toml +++ b/entity/Cargo.toml @@ -11,12 +11,12 @@ path = "src/lib.rs" axum-login = "0.16.0" chrono = { version = "0.4.38", features = ["serde"] } serde = { version = "1.0.210", features = ["derive"] } -sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -# sqlx-sqlite = { version = "0.8.3" } # Updated version -utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } -# libsqlite3-sys = "0.31.0" +sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.2" } +utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } + uuid = { version = "1.11.0", features = ["v4", "serde"] } [dependencies.sea-orm] version = "1.1.0" -features = ["with-uuid"] +features = [ "with-uuid" ] diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index ba5388e7..187b1470 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -11,7 +11,7 @@ serde_json = "1.0.128" serde = { version = "1.0.210", features = ["derive"] } log = "0.4.22" -axum-login = "0.17.0" +axum-login = "0.16.0" async-trait = "0.1.83" password-auth = "1.0.0" <<<<<<< HEAD @@ -20,6 +20,7 @@ utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } ======= slugify = "0.1.0" sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.2" } utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } >>>>>>> f61c08b (merges remaining changes from main.) diff --git a/migration/Cargo.toml b/migration/Cargo.toml index a51b5c8d..44cce23a 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -10,9 +10,12 @@ path = "src/lib.rs" [dependencies] async-std = { version = "1.13", features = ["attributes", "tokio1"] } -sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -# sqlx-sqlite = { version = "0.8.3" } # Updated version +sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.2" } [dependencies.sea-orm-migration] version = "1.1.0" -features = ["runtime-tokio-rustls", "sqlx-postgres"] +features = [ + "runtime-tokio-rustls", + "sqlx-postgres", +] diff --git a/service/Cargo.toml b/service/Cargo.toml index 648a0bd0..76bafa92 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -11,7 +11,7 @@ features = [ "debug-print", "runtime-tokio-native-tls", "sqlx-postgres", - "with-uuid", + "with-uuid" ] [dependencies] @@ -21,8 +21,9 @@ log = "0.4.22" simplelog = { version = "0.12.2", features = ["paris"] } serde = { version = "1.0.210", features = ["derive"] } serde_json = "1.0.128" -sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } +sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.2" } tokio = { version = "1.40", features = ["full"] } -tower = { version = "0.5.1", features = ["util", "http"] } # or similar -utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } +tower = "0.5.1" +utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } semver = { version = "1.0.23", features = ["serde"] } diff --git a/web/Cargo.toml b/web/Cargo.toml index c1042209..5763f46d 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -22,16 +22,15 @@ log = "0.4.22" tower-http = { version = "0.6.1", features = ["fs", "cors"] } serde_json = "1.0.128" serde = { version = "1.0.210", features = ["derive"] } -sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -tokio = { version = "1.40", features = [ - "full", -] } # Remove the ".0" for consistency -tower = { version = "0.5.1", features = ["util", "http"] } # or similar -tower-sessions = { version = "0.14.0" } -tower-sessions-sqlx-store = { version = "0.15.0", features = ["postgres"] } +sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } +sqlx-sqlite = { version = "0.8.2" } +tokio = { version = "1.40.0", features = ["full"] } +tower = "0.5.1" +tower-sessions = { version = "0.13.0" } +tower-sessions-sqlx-store = { version = "0.14.1", features = ["postgres"] } time = "0.3.36" -utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } -utoipa-rapidoc = { version = "6.0.0", features = ["axum"] } +utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } +utoipa-rapidoc = { version = "3.0.0", features = ["axum"] } [dependencies.sea-orm] version = "1.1.0" # sea-orm version From 6cf3575e5821dd8ff71eec2eccdd1c13956297f3 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 13 Mar 2025 22:27:35 -0400 Subject: [PATCH 21/74] removes sqlite dependency from Cargo.toml files. --- entity/Cargo.toml | 3 +-- entity_api/Cargo.toml | 1 - migration/Cargo.toml | 6 +----- service/Cargo.toml | 3 +-- web/Cargo.toml | 1 - 5 files changed, 3 insertions(+), 11 deletions(-) diff --git a/entity/Cargo.toml b/entity/Cargo.toml index 35498cae..78816f0f 100644 --- a/entity/Cargo.toml +++ b/entity/Cargo.toml @@ -12,11 +12,10 @@ axum-login = "0.16.0" chrono = { version = "0.4.38", features = ["serde"] } serde = { version = "1.0.210", features = ["derive"] } sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } uuid = { version = "1.11.0", features = ["v4", "serde"] } [dependencies.sea-orm] version = "1.1.0" -features = [ "with-uuid" ] +features = ["with-uuid"] diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index 187b1470..28efecb1 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -20,7 +20,6 @@ utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } ======= slugify = "0.1.0" sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } >>>>>>> f61c08b (merges remaining changes from main.) diff --git a/migration/Cargo.toml b/migration/Cargo.toml index 44cce23a..9f29c0b0 100644 --- a/migration/Cargo.toml +++ b/migration/Cargo.toml @@ -11,11 +11,7 @@ path = "src/lib.rs" [dependencies] async-std = { version = "1.13", features = ["attributes", "tokio1"] } sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } [dependencies.sea-orm-migration] version = "1.1.0" -features = [ - "runtime-tokio-rustls", - "sqlx-postgres", -] +features = ["runtime-tokio-rustls", "sqlx-postgres"] diff --git a/service/Cargo.toml b/service/Cargo.toml index 76bafa92..d9b5ea54 100644 --- a/service/Cargo.toml +++ b/service/Cargo.toml @@ -11,7 +11,7 @@ features = [ "debug-print", "runtime-tokio-native-tls", "sqlx-postgres", - "with-uuid" + "with-uuid", ] [dependencies] @@ -22,7 +22,6 @@ simplelog = { version = "0.12.2", features = ["paris"] } serde = { version = "1.0.210", features = ["derive"] } serde_json = "1.0.128" sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } tokio = { version = "1.40", features = ["full"] } tower = "0.5.1" utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } diff --git a/web/Cargo.toml b/web/Cargo.toml index 5763f46d..37a961bf 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -23,7 +23,6 @@ tower-http = { version = "0.6.1", features = ["fs", "cors"] } serde_json = "1.0.128" serde = { version = "1.0.210", features = ["derive"] } sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } -sqlx-sqlite = { version = "0.8.2" } tokio = { version = "1.40.0", features = ["full"] } tower = "0.5.1" tower-sessions = { version = "0.13.0" } From 757a2c9425bf0da625a2d9fc122b2bd9179abef4 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 13 Mar 2025 22:28:39 -0400 Subject: [PATCH 22/74] adds correspondong lock file. --- Cargo.lock | 1759 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 1041 insertions(+), 718 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d5868f4f..3c7a6e68 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,47 +4,35 @@ version = 4 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] [[package]] -name = "adler" -version = "1.0.2" +name = "adler2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" [[package]] name = "ahash" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c3a9648d43b9cd48db467b3f87fdd6e146bcc88ab0180006cef2179fe11d01" +checksum = "891477e0c6a8957309ee5c45a6368af3ae14bb510732d2684ffa19af310920f9" dependencies = [ - "cfg-if", + "getrandom 0.2.15", "once_cell", "version_check", - "zerocopy", ] [[package]] name = "aho-corasick" -version = "1.1.2" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" dependencies = [ "memchr", ] @@ -57,9 +45,9 @@ checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" [[package]] name = "allocator-api2" -version = "0.2.16" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" [[package]] name = "android-tzdata" @@ -78,57 +66,59 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "8acc5369981196006228e28809f761875c0327210a891e941f4c683b3a99529b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.8" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" +checksum = "55cc3b69f167a1ef2e161439aa98aed94e6028e5f9a59be9a6ffb47aef1651f9" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "3b2d16507662817a6a20a9ea92df6652ee4f94f914589377d69f3b21bc5798a9" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "79947af37f4177cfead1110013d678905c37501914fba0efea834c3fe9a8d60c" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "ca3534e77181a9cc07539ad51f2141fe32f6c3ffd4df76db8ad92346b003ae4e" dependencies = [ "anstyle", - "windows-sys 0.52.0", + "once_cell", + "windows-sys 0.59.0", ] [[package]] name = "anyhow" -version = "1.0.89" +version = "1.0.97" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86fdf8605db99b54d3cd748a44c6d04df638eb5dafb219b135d0149bd0db01f6" +checksum = "dcfed56ad506cb2c684a14971b8861fdc3baaaae314b9e5f9bb532cbe3ba7a4f" [[package]] name = "argon2" @@ -144,9 +134,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-attributes" @@ -171,12 +161,11 @@ dependencies = [ [[package]] name = "async-channel" -version = "2.1.1" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" +checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" dependencies = [ "concurrent-queue", - "event-listener 4.0.3", "event-listener-strategy", "futures-core", "pin-project-lite", @@ -184,11 +173,10 @@ dependencies = [ [[package]] name = "async-executor" -version = "1.8.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" +checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" dependencies = [ - "async-lock", "async-task", "concurrent-queue", "fastrand", @@ -202,7 +190,7 @@ version = "2.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" dependencies = [ - "async-channel 2.1.1", + "async-channel 2.3.1", "async-executor", "async-io", "async-lock", @@ -214,9 +202,9 @@ dependencies = [ [[package]] name = "async-io" -version = "2.3.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb41eb19024a91746eba0773aa5e16036045bbf45733766661099e182ea6a744" +checksum = "43a2b323ccce0a1d90b449fd71f2a06ca7faa7c54c2751f06c9bd851fc061059" dependencies = [ "async-lock", "cfg-if", @@ -225,19 +213,19 @@ dependencies = [ "futures-lite", "parking", "polling", - "rustix", + "rustix 0.38.44", "slab", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "async-lock" -version = "3.3.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" +checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" dependencies = [ - "event-listener 4.0.3", + "event-listener 5.4.0", "event-listener-strategy", "pin-project-lite", ] @@ -271,9 +259,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -282,30 +270,30 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "async-task" -version = "4.7.0" +version = "4.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.83" +version = "0.1.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -325,15 +313,15 @@ checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" [[package]] name = "autocfg" -version = "1.1.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "axum" -version = "0.7.7" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" dependencies = [ "async-trait", "axum-core", @@ -395,7 +383,7 @@ dependencies = [ "form_urlencoded", "serde", "subtle", - "thiserror 1.0.56", + "thiserror 1.0.69", "tower-cookies", "tower-layer", "tower-service", @@ -406,17 +394,17 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.69" +version = "0.3.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" dependencies = [ "addr2line", - "cc", "cfg-if", "libc", "miniz_oxide", "object", "rustc-demangle", + "windows-targets 0.52.6", ] [[package]] @@ -427,15 +415,15 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" -version = "1.6.0" +version = "1.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "89e25b6adfb930f02d1981565a6e5d9c547ac15a96606256d3b59040e5cd4ca3" [[package]] name = "bigdecimal" -version = "0.4.5" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51d712318a27c7150326677b321a5fa91b55f6d9034ffd67f20319e147d40cee" +checksum = "7f31f3af01c5c65a07985c804d3366560e6fa7883d640a122819b14ec327482c" dependencies = [ "autocfg", "libm", @@ -447,15 +435,9 @@ dependencies = [ [[package]] name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.2" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" dependencies = [ "serde", ] @@ -492,55 +474,51 @@ dependencies = [ [[package]] name = "blocking" -version = "1.5.1" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" +checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" dependencies = [ - "async-channel 2.1.1", - "async-lock", + "async-channel 2.3.1", "async-task", - "fastrand", "futures-io", "futures-lite", "piper", - "tracing", ] [[package]] name = "borsh" -version = "1.3.1" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f58b559fd6448c6e2fd0adb5720cd98a2506594cafa4737ff98c396f3e82f667" +checksum = "5430e3be710b68d984d1391c854eb431a9d548640711faa54eecb1df93db91cc" dependencies = [ "borsh-derive", - "cfg_aliases 0.1.1", + "cfg_aliases", ] [[package]] name = "borsh-derive" -version = "1.3.1" +version = "1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7aadb5b6ccbd078890f6d7003694e33816e6b784358f18e15e7e6d9f065a57cd" +checksum = "f8b668d39970baad5356d7c83a86fee3a539e6f93bf6764c97368243e17a0487" dependencies = [ "once_cell", "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.98", - "syn_derive", + "syn 2.0.100", ] [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "1628fb46dfa0b37568d12e5edd512553eccf6a22a78e8bde00bb4aed84d5bdbf" [[package]] name = "bytecheck" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6372023ac861f6e6dc89c8344a8f398fb42aaba2b5dbc649ca0c0e9dbcb627" +checksum = "23cdc57ce23ac53c931e88a43d06d070a6fd142f2617be5855eb75efc9beb1c2" dependencies = [ "bytecheck_derive", "ptr_meta", @@ -549,9 +527,9 @@ dependencies = [ [[package]] name = "bytecheck_derive" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7ec4c6f261935ad534c0c22dbef2201b45918860eb1c574b972bd213a76af61" +checksum = "3db406d29fbcd95542e92559bed4d8ad92636d1ca8b3b72ede10b4bcc010e659" dependencies = [ "proc-macro2", "quote", @@ -566,15 +544,15 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.9.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "325918d6fe32f23b19878fe4b34794ae41fc19ddbe53b10571a4874d44ffd39b" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.1.30" +version = "1.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" +checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" dependencies = [ "shlex", ] @@ -585,12 +563,6 @@ version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - [[package]] name = "cfg_aliases" version = "0.2.1" @@ -599,9 +571,9 @@ checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" [[package]] name = "chrono" -version = "0.4.38" +version = "0.4.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" +checksum = "1a7964611d71df112cb1730f2ee67324fcf4d0fc6606acbbe9bfe06df124637c" dependencies = [ "android-tzdata", "iana-time-zone", @@ -609,14 +581,14 @@ dependencies = [ "num-traits", "serde", "wasm-bindgen", - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "clap" -version = "4.5.20" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" +checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" dependencies = [ "clap_builder", "clap_derive", @@ -624,9 +596,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.20" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" +checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" dependencies = [ "anstream", "anstyle", @@ -636,33 +608,33 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.18" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "5b63caa9aa9397e2d9480a9b13673856c78d8ac123288526c37d7839f2a86990" [[package]] name = "concurrent-queue" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d16048cd947b08fa32c24458a22f5dc5e835264f689f4f5653210c69fd107363" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" dependencies = [ "crossbeam-utils", ] @@ -675,9 +647,9 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "cookie" -version = "0.18.0" +version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd91cf61412820176e137621345ee43b3f4423e589e7ae4e50d601d93e35ef8" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" dependencies = [ "percent-encoding", "time", @@ -686,12 +658,13 @@ dependencies = [ [[package]] name = "cookie_store" -version = "0.21.0" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4934e6b7e8419148b6ef56950d277af8561060b56afd59e2aadf98b59fce6baa" +checksum = "2eac901828f88a5241ee0600950ab981148a18f2f756900ffba1b125ca6a3ef9" dependencies = [ "cookie", - "idna 0.5.0", + "document-features", + "idna", "log", "publicsuffix", "serde", @@ -713,24 +686,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" dependencies = [ "libc", ] [[package]] name = "crc" -version = "3.0.1" +version = "3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86ec7a15cbe22e59248fc7eadb1907dab5ba09372595da4d73dd805ed4417dfe" +checksum = "69e6e4d7b33a94f0991c26729976b10ebde1d34c3ee82408fb536164fa10d636" dependencies = [ "crc-catalog", ] @@ -743,18 +716,18 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crossbeam-queue" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df0346b5d5e76ac2fe4e327c5fd1118d6be7c51dfb18f9b7922923f287471e35" +checksum = "0f58bbc28f91df819d0aa2a2c00cd19754769c2fad90579b3592b1c9ba7a3115" dependencies = [ "crossbeam-utils", ] [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" @@ -786,7 +759,7 @@ dependencies = [ "ident_case", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -797,14 +770,14 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "der" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" dependencies = [ "const-oid", "pem-rfc7468", @@ -833,6 +806,26 @@ dependencies = [ "subtle", ] +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "document-features" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95249b50c6c185bee49034bcb378a49dc2b5dff0be90ff6616d31d64febab05d" +dependencies = [ + "litrs", +] + [[package]] name = "domain" version = "1.0.0-beta1" @@ -856,18 +849,18 @@ checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" [[package]] name = "either" -version = "1.9.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" dependencies = [ "serde", ] [[package]] name = "encoding_rs" -version = "0.8.33" +version = "0.8.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7268b386296a025e474d5140678f75d6de9493ae55a5d709eeb9dd08149945e1" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" dependencies = [ "cfg-if", ] @@ -882,7 +875,6 @@ dependencies = [ "sea-orm", "serde", "sqlx", - "sqlx-sqlite", "utoipa", "uuid", ] @@ -903,25 +895,24 @@ dependencies = [ "service", "slugify", "sqlx", - "sqlx-sqlite", "tokio", "utoipa", ] [[package]] name = "equivalent" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "33d852cb9b869c2a9b3df2f71a3074817f01e1844f839a144f5fcef059a4eb5d" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -943,20 +934,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" [[package]] name = "event-listener" -version = "4.0.3" +version = "5.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite", -] - -[[package]] -name = "event-listener" -version = "5.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" +checksum = "3492acde4c3fc54c845eaab3eed8bd00c7a7d881f78bfc801e43a93dec1331ae" dependencies = [ "concurrent-queue", "parking", @@ -965,35 +945,29 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.4.0" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" +checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" dependencies = [ - "event-listener 4.0.3", + "event-listener 5.4.0", "pin-project-lite", ] [[package]] name = "fastrand" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" - -[[package]] -name = "finl_unicode" -version = "1.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fcfdc7a0362c9f4444381a9e697c79d435fe65b52a37466fc2c1184cee9edc6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "flume" -version = "0.11.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ac459de2512911e4b674ce33cf20befaba382d05b62b008afc1c8b57cbf181" +checksum = "da0e4dd2a88388a1f4ccc7c9ce104604dab68d9f408dc34cd45823d5a9069095" dependencies = [ "futures-core", "futures-sink", - "spin 0.9.8", + "spin", ] [[package]] @@ -1002,6 +976,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" + [[package]] name = "foreign-types" version = "0.3.2" @@ -1034,9 +1014,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1048,9 +1028,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1058,15 +1038,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1086,15 +1066,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" -version = "2.2.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" +checksum = "f5edaec856126859abb19ed65f39e90fea3a9574b9707f13539acf4abf7eb532" dependencies = [ "fastrand", "futures-core", @@ -1105,34 +1085,33 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ - "futures-channel", "futures-core", "futures-io", "futures-macro", @@ -1156,28 +1135,40 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.12" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "wasm-bindgen", ] +[[package]] +name = "getrandom" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.13.3+wasi-0.2.2", + "windows-targets 0.52.6", +] + [[package]] name = "gimli" -version = "0.28.1" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "gloo-timers" @@ -1193,9 +1184,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.6" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +checksum = "5017294ff4bb30944501348f6f8e42e6ad28f42c8bbef7a74029aff064a4e3c2" dependencies = [ "atomic-waker", "bytes", @@ -1216,26 +1207,27 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash 0.7.7", + "ahash", ] [[package]] name = "hashbrown" -version = "0.14.5" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" +checksum = "bf151400ff0baff5465007dd2f3e717f3fe502074ca563069ce3a6629d07b289" dependencies = [ - "ahash 0.8.7", "allocator-api2", + "equivalent", + "foldhash", ] [[package]] name = "hashlink" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba4ff7128dee98c7dc9794b6a411377e1404dba1c97deb8d1a55297bd25d8af" +checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1" dependencies = [ - "hashbrown 0.14.5", + "hashbrown 0.15.2", ] [[package]] @@ -1252,9 +1244,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.3.9" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "hex" @@ -1282,18 +1274,18 @@ dependencies = [ [[package]] name = "home" -version = "0.5.9" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "http" -version = "1.0.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b32afd38673a8016f7c9ae69e5af41a58f81b1d31689040f2f1959594ce194ea" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" dependencies = [ "bytes", "fnv", @@ -1302,9 +1294,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", @@ -1312,12 +1304,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.0" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cb79eb393015dadd30fc252023adb0b2400a0caee0fa2a077e6e21a551e840" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" dependencies = [ "bytes", - "futures-util", + "futures-core", "http", "http-body", "pin-project-lite", @@ -1325,15 +1317,15 @@ dependencies = [ [[package]] name = "http-range-header" -version = "0.4.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ce4ef31cda248bbdb6e6820603b82dfcd9e833db65a43e997a0ccec777d11fe" +checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" [[package]] name = "httparse" -version = "1.8.0" +version = "1.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" [[package]] name = "httpdate" @@ -1343,9 +1335,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "1.5.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "256fb8d4bd6413123cc9d91832d78325c48ff41677595be797d90f42969beae0" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", @@ -1364,9 +1356,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.27.3" +version = "0.27.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +checksum = "2d191583f3da1305256f22463b9bb0471acad48a4e534a5218b9963e9c1f59b2" dependencies = [ "futures-util", "http", @@ -1417,9 +1409,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.59" +version = "0.1.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" +checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1438,6 +1430,124 @@ dependencies = [ "cc", ] +[[package]] +name = "icu_collections" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "ident_case" version = "1.0.1" @@ -1446,73 +1556,72 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idna" -version = "0.3.0" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "idna_adapter", + "smallvec", + "utf8_iter", ] [[package]] -name = "idna" -version = "0.5.0" +name = "idna_adapter" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "icu_normalizer", + "icu_properties", ] [[package]] name = "indexmap" -version = "2.1.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" +checksum = "3954d50fe15b02142bf25d3b8bdadb634ec3948f103d04ffe3031bc8fe9d7058" dependencies = [ "equivalent", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "serde", ] [[package]] name = "inherent" -version = "1.0.11" +version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0122b7114117e64a63ac49f752a5ca4624d534c7b1c7de796ac196381cd2d947" +checksum = "6c38228f24186d9cc68c729accb4d413be9eaed6ad07ff79e0270d9e56f3de13" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "ipnet" -version = "2.9.0" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" [[package]] -name = "itertools" -version = "0.12.0" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25db6b064527c5d482d0423354fcd07a89a2dfe07b67892e62411946db7f07b0" -dependencies = [ - "either", -] +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" -version = "1.0.10" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "js-sys" -version = "0.3.67" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1d36f1235bc969acba30b7f5990b864423a6068a10f7c90ae8f0112e3a59d1" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -1542,24 +1651,24 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin", ] [[package]] name = "libc" -version = "0.2.159" +version = "0.2.171" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "561d97a539a36e26a9a5fad1ea11a3039a67714694aaa379433e580854bc3dc5" +checksum = "c19937216e9d3aa9956d9bb8dfc0b0c8beb6058fc4f7a4dc4d850edf86a237d6" [[package]] name = "libm" -version = "0.2.8" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" +checksum = "8355be11b20d696c8f18f6cc018c4e372165b1fa8126cef092399c9951984ffa" [[package]] name = "libsqlite3-sys" @@ -1567,22 +1676,39 @@ version = "0.30.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e99fb7a497b1e3339bc746195567ed8d3e24945ecd636e3619d20b9de9e9149" dependencies = [ - "cc", "pkg-config", "vcpkg", ] [[package]] name = "linux-raw-sys" -version = "0.4.14" +version = "0.4.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" + +[[package]] +name = "linux-raw-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9" + +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + +[[package]] +name = "litrs" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4ce301924b7887e9d637144fdade93f9dfff9b60981d4ac161db09720d39aa5" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -1591,9 +1717,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.22" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" +checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" dependencies = [ "value-bag", ] @@ -1625,9 +1751,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.1" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "migration" @@ -1636,7 +1762,6 @@ dependencies = [ "async-std", "sea-orm-migration", "sqlx", - "sqlx-sqlite", ] [[package]] @@ -1647,48 +1772,40 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", ] -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "8e3e04debbb59698c15bacbb6d93584a8c0ca9cc3213cb423d31f760d8843ce5" dependencies = [ - "adler", + "adler2", ] [[package]] name = "mio" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd" dependencies = [ - "hermit-abi", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -1700,23 +1817,12 @@ dependencies = [ "tempfile", ] -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -1746,19 +1852,18 @@ checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" [[package]] name = "num-integer" -version = "0.1.45" +version = "0.1.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" dependencies = [ - "autocfg", "num-traits", ] [[package]] name = "num-iter" -version = "0.1.43" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d03e6c028c5dc5cac6e2dec0efda81fc887605bb3d884578bb6d6bf7514e252" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -1767,9 +1872,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -1777,35 +1882,35 @@ dependencies = [ [[package]] name = "num_threads" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9" dependencies = [ "libc", ] [[package]] name = "object" -version = "0.32.2" +version = "0.36.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.19.0" +version = "1.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" [[package]] name = "openssl" -version = "0.10.63" +version = "0.10.71" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15c9d69dd87a29568d4d017cfe8ec518706046a05184e5aea92d0af890b803c8" +checksum = "5e14130c6a98cd258fdcb0fb6d744152343ff729cbfcb28c656a9d12b999fbcd" dependencies = [ - "bitflags 2.4.2", + "bitflags", "cfg-if", "foreign-types", "libc", @@ -1822,20 +1927,20 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "openssl-probe" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" [[package]] name = "openssl-sys" -version = "0.9.99" +version = "0.9.106" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22e1bf214306098e4832460f797824c05d25aacdf896f64a985fb0fd992454ae" +checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" dependencies = [ "cc", "libc", @@ -1854,9 +1959,9 @@ dependencies = [ [[package]] name = "ouroboros" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "944fa20996a25aded6b4795c6d63f10014a7a83f8be9828a11860b08c5fc4a67" +checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59" dependencies = [ "aliasable", "ouroboros_macro", @@ -1865,16 +1970,15 @@ dependencies = [ [[package]] name = "ouroboros_macro" -version = "0.18.4" +version = "0.18.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39b0deead1528fd0e5947a8546a9642a9777c25f6e1e26f34c97b204bbb465bd" +checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0" dependencies = [ "heck 0.4.1", - "itertools", "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -1885,15 +1989,15 @@ checksum = "8fecab3723493c7851f292cb060f3ee1c42f19b8d749345d0d7eaf3fd19aa62d" [[package]] name = "parking" -version = "2.2.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -1901,15 +2005,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -1919,7 +2023,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1a2a4764cc1f8d961d802af27193c6f4f0124bd0e76e8393cf818e18880f0524" dependencies = [ "argon2", - "getrandom", + "getrandom 0.2.15", "password-hash", "rand_core", ] @@ -1937,15 +2041,15 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "pem" -version = "3.0.4" +version = "3.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +checksum = "38af38e8470ac9dee3ce1bae1af9c1671fffc44ddfd8bd1d0a3445bf349a8ef3" dependencies = [ "base64", "serde", @@ -1966,11 +2070,20 @@ version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" +[[package]] +name = "pgvector" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0e8871b6d7ca78348c6cd29b911b94851f3429f0cd403130ca17f26c1fb91a6" +dependencies = [ + "serde", +] + [[package]] name = "pin-project-lite" -version = "0.2.13" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" @@ -1980,9 +2093,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "piper" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" +checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" dependencies = [ "atomic-waker", "fastrand", @@ -2012,22 +2125,23 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.29" +version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "polling" -version = "3.3.2" +version = "3.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "545c980a3880efd47b2e262f6a4bb6daad6555cf3367aa9c4e52895f69537a41" +checksum = "a604568c3202727d1507653cb121dbd627a58684eb09a820fd746bee38b4442f" dependencies = [ "cfg-if", "concurrent-queue", + "hermit-abi", "pin-project-lite", - "rustix", + "rustix 0.38.44", "tracing", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2038,15 +2152,18 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" dependencies = [ "toml_edit", ] @@ -2075,11 +2192,33 @@ dependencies = [ "version_check", ] +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "proc-macro2" -version = "1.0.93" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60946a68e5f9d28b0dc1c21bb8a97ee7d018a8b322fa57838ba31cc878e22d99" +checksum = "a31971752e70b8b2686d7e46ec17fb38dad4051d94024c88df49b667caea9c84" dependencies = [ "unicode-ident", ] @@ -2092,7 +2231,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", "version_check", "yansi", ] @@ -2125,19 +2264,19 @@ dependencies = [ [[package]] name = "publicsuffix" -version = "2.2.3" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96a8c1bda5ae1af7f99a2962e49df150414a43d62404644d98dd5c3a93d07457" +checksum = "6f42ea446cab60335f76979ec15e12619a2165b5ae2c12166bef27d283a9fadf" dependencies = [ - "idna 0.3.0", + "idna", "psl-types", ] [[package]] name = "quinn" -version = "0.11.5" +version = "0.11.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" dependencies = [ "bytes", "pin-project-lite", @@ -2146,35 +2285,38 @@ dependencies = [ "rustc-hash", "rustls", "socket2", - "thiserror 1.0.56", + "thiserror 2.0.12", "tokio", "tracing", ] [[package]] name = "quinn-proto" -version = "0.11.8" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" dependencies = [ "bytes", + "getrandom 0.2.15", "rand", "ring", "rustc-hash", "rustls", + "rustls-pki-types", "slab", - "thiserror 1.0.56", + "thiserror 2.0.12", "tinyvec", "tracing", + "web-time", ] [[package]] name = "quinn-udp" -version = "0.5.8" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52cd4b1eff68bf27940dd39811292c49e007f4d0b4c357358dc9b0197be6b527" +checksum = "e46f3055866785f6b92bc6164b76be02ca8f2eb4b002c0354b28cf4c119e5944" dependencies = [ - "cfg_aliases 0.2.1", + "cfg_aliases", "libc", "once_cell", "socket2", @@ -2184,9 +2326,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.35" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -2224,16 +2366,16 @@ version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom", + "getrandom 0.2.15", ] [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "0b8c0c260b63a8219631167be35e6a988e9554dbd323f8bd08439c8ed1302bd1" dependencies = [ - "bitflags 1.3.2", + "bitflags", ] [[package]] @@ -2251,14 +2393,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.3" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.4", - "regex-syntax 0.8.2", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -2272,13 +2414,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.4" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b7fa1134405e2ec9353fd416b17f8dacd46c473d7d3fd1cf202706a14eb792a" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.2", + "regex-syntax 0.8.5", ] [[package]] @@ -2289,24 +2431,24 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "rend" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2571463863a6bd50c32f94402933f03457a3fbaf697a707c5be741e459f08fd" +checksum = "71fe3824f5629716b1589be05dacd749f6aa084c87e00e016714a8cdfccc997c" dependencies = [ "bytecheck", ] [[package]] name = "reqwest" -version = "0.12.12" +version = "0.12.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43e734407157c3c2034e0258f5e4473ddb361b1e85f95a66690d67264d7cd1da" +checksum = "989e327e510263980e231de548a33e63d34962d29ae61b467389a1a09627a254" dependencies = [ "base64", "bytes", @@ -2355,23 +2497,23 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" dependencies = [ "cc", - "getrandom", + "cfg-if", + "getrandom 0.2.15", "libc", - "spin 0.9.8", "untrusted", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "rkyv" -version = "0.7.43" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "527a97cdfef66f65998b5f3b637c26f5a5ec09cc52a3f9932313ac645f4190f5" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -2387,9 +2529,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.43" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c462a1328c8e67e4d6dbad1eb0355dd43e8ab432c6e227a43657f16ade5033" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", @@ -2420,9 +2562,9 @@ dependencies = [ [[package]] name = "rsa" -version = "0.9.6" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d0e5124fcb30e76a7e79bfee683a2746db83784b86289f6251b54b7950a0dfc" +checksum = "78928ac1ed176a5ca1d17e578a1825f3d81ca54cf41053a592584b020cfd691b" dependencies = [ "const-oid", "digest", @@ -2440,9 +2582,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.33.1" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06676aec5ccb8fc1da723cc8c0f9a46549f21ebb8753d3915c6c41db1e7f1dc4" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" dependencies = [ "arrayvec", "borsh", @@ -2456,34 +2598,47 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustix" -version = "0.38.37" +version = "0.38.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +checksum = "fdb5bc1ae2baa591800df16c9ca78619bf65c0488b41b96ccec5d11220d8c154" dependencies = [ - "bitflags 2.4.2", + "bitflags", "errno", "libc", - "linux-raw-sys", - "windows-sys 0.52.0", + "linux-raw-sys 0.4.15", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustix" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys 0.9.2", + "windows-sys 0.59.0", ] [[package]] name = "rustls" -version = "0.23.14" +version = "0.23.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "415d9944693cb90382053259f89fbb077ea730ad7273047ec63b19bc9b160ba8" +checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" dependencies = [ "once_cell", "ring", @@ -2504,9 +2659,12 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" +checksum = "917ce264624a4b4db1c364dcc35bfca9ded014d0a958cd47ad3e960e988ea51c" +dependencies = [ + "web-time", +] [[package]] name = "rustls-webpki" @@ -2521,23 +2679,23 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.14" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" [[package]] name = "schannel" -version = "0.1.23" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2548,30 +2706,31 @@ checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" [[package]] name = "sea-bae" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bd3534a9978d0aa7edd2808dc1f8f31c4d0ecd31ddf71d997b3c98e9f3c9114" +checksum = "f694a6ab48f14bc063cfadff30ab551d3c7e46d8f81836c51989d548f44a2a25" dependencies = [ "heck 0.4.1", - "proc-macro-error", + "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "sea-orm" -version = "1.1.0" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c4872675cc5d5d399a2a202c60f3a393ec8d3f3307c36adb166517f348e4db5" +checksum = "3417812d38049e8ec3d588c03570f8c60de811d2453fb48e424045a1600ffd86" dependencies = [ "async-stream", "async-trait", "bigdecimal", "chrono", - "futures", + "futures-util", "log", "ouroboros", + "pgvector", "rust_decimal", "sea-orm-macros", "sea-query", @@ -2580,7 +2739,7 @@ dependencies = [ "serde_json", "sqlx", "strum", - "thiserror 1.0.56", + "thiserror 1.0.69", "time", "tracing", "url", @@ -2589,9 +2748,9 @@ dependencies = [ [[package]] name = "sea-orm-cli" -version = "1.1.0" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aefbd960c9ed7b2dfbab97b11890f5d8c314ad6e2f68c7b36c73ea0967fcc25" +checksum = "bf2a390d6528f8e5c9ecd327bbb1a4c6cd7ab8333ef0da97010d5dc8f83f01c4" dependencies = [ "chrono", "clap", @@ -2606,28 +2765,27 @@ dependencies = [ [[package]] name = "sea-orm-macros" -version = "1.1.0" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85f714906b72e7265c0b2077d0ad8f235dabebda513c92f1326d5d40cef0dd01" +checksum = "d705ba84e1c74c8ac27784e4ac6f21584058c1dc0cadb9d39b43e109fcf8139c" dependencies = [ "heck 0.4.1", "proc-macro2", "quote", "sea-bae", - "syn 2.0.98", + "syn 2.0.100", "unicode-ident", ] [[package]] name = "sea-orm-migration" -version = "1.1.0" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa7bbfbe3bec60b5925193acc9c98b9f8ae9853f52c8004df0c1ea5193c01ea0" +checksum = "2c38451d5112e3a518a02251b5e6d3bc72e626957a44a79264716808a4c28ee0" dependencies = [ "async-trait", "clap", "dotenvy", - "futures", "sea-orm", "sea-orm-cli", "sea-schema", @@ -2637,9 +2795,9 @@ dependencies = [ [[package]] name = "sea-query" -version = "0.32.0-rc.2" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ae69162bc417008f7ba60abd5c2688529cd83e99a9ab680d922b41fd9bf3d8d" +checksum = "b731192738ebf56d20580fc8ba2d23940333befe900b04dd08a26a77cd056f02" dependencies = [ "bigdecimal", "chrono", @@ -2654,9 +2812,9 @@ dependencies = [ [[package]] name = "sea-query-binder" -version = "0.7.0-rc.2" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "643c2e6fbba4440ff0075c405d37079a7da1a46892623b1cc8f06e05233eee1b" +checksum = "b0019f47430f7995af63deda77e238c17323359af241233ec768aba1faea7608" dependencies = [ "bigdecimal", "chrono", @@ -2678,15 +2836,15 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.98", - "thiserror 1.0.56", + "syn 2.0.100", + "thiserror 1.0.69", ] [[package]] name = "sea-schema" -version = "0.16.0-rc.1" +version = "0.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2a4ff9e87c4340affbec4f7790d724dcd87e71fcd0ffe2247481843380485aa" +checksum = "0ef5dd7848c993f3789d09a2616484c72c9330cae2b048df59d8c9b8c0343e95" dependencies = [ "futures", "sea-query", @@ -2702,7 +2860,7 @@ dependencies = [ "heck 0.4.1", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -2713,11 +2871,11 @@ checksum = "1c107b6f4780854c8b126e228ea8869f4d7b71260f962fefb57b996b8959ba6b" [[package]] name = "security-framework" -version = "2.9.2" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b64fb303737d99b81884b2c63433e9ae28abebe5eb5045dcdd175dc2ecf4de" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags", "core-foundation", "core-foundation-sys", "libc", @@ -2726,9 +2884,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.9.1" +version = "2.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e932934257d3b408ed8f30db49d85ea163bfe74961f017f405b025af298f0c7a" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" dependencies = [ "core-foundation-sys", "libc", @@ -2736,38 +2894,38 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.210" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", @@ -2777,9 +2935,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" +checksum = "59fab13f937fa393d08645bf3a84bdfe86e296747b506ada67bb15f10f218b2a" dependencies = [ "itoa", "serde", @@ -2810,7 +2968,6 @@ dependencies = [ "serde_json", "simplelog", "sqlx", - "sqlx-sqlite", "tokio", "tower", "utoipa", @@ -2855,9 +3012,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" [[package]] name = "signal-hook-registry" -version = "1.4.1" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" dependencies = [ "libc", ] @@ -2874,9 +3031,9 @@ dependencies = [ [[package]] name = "simdutf8" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f27f6278552951f1f2b8cf9da965d10969b2efdea95a6ec47987ab46edfe263a" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" [[package]] name = "simple_asn1" @@ -2886,7 +3043,7 @@ checksum = "297f631f50729c8c99b84667867963997ec0b50f32b2a7dbcab828ef0541e8bb" dependencies = [ "num-bigint", "num-traits", - "thiserror 2.0.11", + "thiserror 2.0.12", "time", ] @@ -2922,29 +3079,23 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.13.1" +version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" +checksum = "7fcf8323ef1faaee30a44a340193b1ac6814fd9b7b4e88e9d4519a3e4abe1cfd" dependencies = [ "serde", ] [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "c970269d99b64e60ec3bd6ad27270092a5394c4e309314b18ae3fe575695fbe8" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -2964,22 +3115,11 @@ dependencies = [ "der", ] -[[package]] -name = "sqlformat" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce81b7bd7c4493975347ef60d8c7e8b742d4694f4c49f93e0a12ea263938176c" -dependencies = [ - "itertools", - "nom", - "unicode_categories", -] - [[package]] name = "sqlx" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93334716a037193fac19df402f8571269c84a00852f6a7066b5d2616dcd64d3e" +checksum = "4410e73b3c0d8442c5f99b425d7a435b5ee0ae4167b3196771dd3f7a01be745f" dependencies = [ "sqlx-core", "sqlx-macros", @@ -2990,33 +3130,28 @@ dependencies = [ [[package]] name = "sqlx-core" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d8060b456358185f7d50c55d9b5066ad956956fddec42ee2e8567134a8936e" +checksum = "6a007b6936676aa9ab40207cde35daab0a04b823be8ae004368c0793b96a61e0" dependencies = [ - "atoi", "bigdecimal", - "byteorder", "bytes", "chrono", "crc", "crossbeam-queue", "either", - "event-listener 5.3.1", - "futures-channel", + "event-listener 5.4.0", "futures-core", "futures-intrusive", "futures-io", "futures-util", - "hashbrown 0.14.5", + "hashbrown 0.15.2", "hashlink", - "hex", "indexmap", "log", "memchr", "native-tls", "once_cell", - "paste", "percent-encoding", "rust_decimal", "rustls", @@ -3025,8 +3160,7 @@ dependencies = [ "serde_json", "sha2", "smallvec", - "sqlformat", - "thiserror 1.0.56", + "thiserror 2.0.12", "time", "tokio", "tokio-stream", @@ -3038,22 +3172,22 @@ dependencies = [ [[package]] name = "sqlx-macros" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cac0692bcc9de3b073e8d747391827297e075c7710ff6276d9f7a1f3d58c6657" +checksum = "3112e2ad78643fef903618d78cf0aec1cb3134b019730edb039b69eaf531f310" dependencies = [ "proc-macro2", "quote", "sqlx-core", "sqlx-macros-core", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "sqlx-macros-core" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1804e8a7c7865599c9c79be146dc8a9fd8cc86935fa641d3ea58e5f0688abaa5" +checksum = "4e9f90acc5ab146a99bf5061a7eb4976b573f560bc898ef3bf8435448dd5e7ad" dependencies = [ "dotenvy", "either", @@ -3069,7 +3203,7 @@ dependencies = [ "sqlx-mysql", "sqlx-postgres", "sqlx-sqlite", - "syn 2.0.98", + "syn 2.0.100", "tempfile", "tokio", "url", @@ -3077,14 +3211,14 @@ dependencies = [ [[package]] name = "sqlx-mysql" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64bb4714269afa44aef2755150a0fc19d756fb580a67db8885608cf02f47d06a" +checksum = "4560278f0e00ce64938540546f59f590d60beee33fffbd3b9cd47851e5fff233" dependencies = [ "atoi", "base64", "bigdecimal", - "bitflags 2.4.2", + "bitflags", "byteorder", "bytes", "chrono", @@ -3115,7 +3249,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 1.0.56", + "thiserror 2.0.12", "time", "tracing", "uuid", @@ -3124,14 +3258,14 @@ dependencies = [ [[package]] name = "sqlx-postgres" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fa91a732d854c5d7726349bb4bb879bb9478993ceb764247660aee25f67c2f8" +checksum = "c5b98a57f363ed6764d5b3a12bfedf62f07aa16e1856a7ddc2a0bb190a959613" dependencies = [ "atoi", "base64", "bigdecimal", - "bitflags 2.4.2", + "bitflags", "byteorder", "chrono", "crc", @@ -3139,7 +3273,6 @@ dependencies = [ "etcetera", "futures-channel", "futures-core", - "futures-io", "futures-util", "hex", "hkdf", @@ -3159,7 +3292,7 @@ dependencies = [ "smallvec", "sqlx-core", "stringprep", - "thiserror 1.0.56", + "thiserror 2.0.12", "time", "tracing", "uuid", @@ -3168,9 +3301,9 @@ dependencies = [ [[package]] name = "sqlx-sqlite" -version = "0.8.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5b2cf34a45953bfd3daaf3db0f7a7878ab9b7a6b91b422d24a7a9e4c857b680" +checksum = "f85ca71d3a5b24e64e1d08dd8fe36c6c95c339a896cc33068148906784620540" dependencies = [ "atoi", "chrono", @@ -3192,6 +3325,12 @@ dependencies = [ "uuid", ] +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + [[package]] name = "static_assertions" version = "1.1.0" @@ -3200,13 +3339,13 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "stringprep" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb41d74e231a107a1b4ee36bd1214b11285b77768d2e3824aedafa988fd36ee6" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" dependencies = [ - "finl_unicode", "unicode-bidi", "unicode-normalization", + "unicode-properties", ] [[package]] @@ -3223,9 +3362,9 @@ checksum = "8fec0f0aef304996cf250b31b5a10dee7980c85da9d759361292b8bca5a18f06" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -3240,9 +3379,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.98" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36147f1a48ae0ec2b5b3bc5b537d267457555a10dc06f3dbc8cb11ba3006d3b1" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -3250,24 +3389,23 @@ dependencies = [ ] [[package]] -name = "syn_derive" -version = "0.1.8" +name = "sync_wrapper" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn 2.0.98", + "futures-core", ] [[package]] -name = "sync_wrapper" -version = "1.0.1" +name = "synstructure" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ - "futures-core", + "proc-macro2", + "quote", + "syn 2.0.100", ] [[package]] @@ -3276,7 +3414,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ - "bitflags 2.4.2", + "bitflags", "core-foundation", "system-configuration-sys", ] @@ -3299,71 +3437,71 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.13.0" +version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +checksum = "488960f40a3fd53d72c2a29a58722561dee8afdd175bd88e3db4677d7b2ba600" dependencies = [ - "cfg-if", "fastrand", + "getrandom 0.3.1", "once_cell", - "rustix", + "rustix 1.0.2", "windows-sys 0.59.0", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" dependencies = [ - "thiserror-impl 1.0.56", + "thiserror-impl 1.0.69", ] [[package]] name = "thiserror" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d452f284b73e6d76dd36758a0c8684b1d5be31f92b89d07fd5822175732206fc" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.11", + "thiserror-impl 2.0.12", ] [[package]] name = "thiserror-impl" -version = "1.0.56" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "thiserror-impl" -version = "2.0.11" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26afc1baea8a989337eeb52b6e72a039780ce45c3edfcc9c5b9d112feeb173c2" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -3371,9 +3509,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8" dependencies = [ "deranged", "itoa", @@ -3388,25 +3526,35 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c" dependencies = [ "num-conv", "time-core", ] +[[package]] +name = "tinystr" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" +dependencies = [ + "displaydoc", + "zerovec", +] + [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "09b3661f17e86524eccd4371ab0429194e0d7c008abb45f7a7495b1719463c71" dependencies = [ "tinyvec_macros", ] @@ -3419,9 +3567,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.41.0" +version = "1.44.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +checksum = "f382da615b842244d4b8738c82ed1275e6c5dd90c459a30941cd07080b06c91a" dependencies = [ "backtrace", "bytes", @@ -3437,13 +3585,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] @@ -3458,20 +3606,19 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.26.0" +version = "0.26.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +checksum = "8e727b36a1a0e8b74c376ac2211e40c2c8af09fb4013c60d910495810f008e9b" dependencies = [ "rustls", - "rustls-pki-types", "tokio", ] [[package]] name = "tokio-stream" -version = "0.1.14" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "397c988d37662c7dda6d2208364a706264bf3d6138b11d436cbac0ad38832842" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", @@ -3480,29 +3627,28 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "6b9590b93e6fcc1739458317cccd391ad3955e2bde8913edf6f95f9e65a8f034" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.21.0" +version = "0.22.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d34d383cd00a163b4a5b85053df514d45bc330f6de7737edfe0a93311d1eaa03" +checksum = "17b4795ff5edd201c7cd6dca065ae59972ce77d1b80fa0a84d94950ece7d1474" dependencies = [ "indexmap", "toml_datetime", @@ -3544,11 +3690,11 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8437150ab6bbc8c5f0f519e3d5ed4aa883a83dd4cdd3d1b21f9482936046cb97" +checksum = "403fa3b783d4b626a8ad51d766ab03cb6d2dbfc46b1c5d4448395e6628dc9697" dependencies = [ - "bitflags 2.4.2", + "bitflags", "bytes", "futures-util", "http", @@ -3612,7 +3758,7 @@ dependencies = [ "rand", "serde", "serde_json", - "thiserror 1.0.56", + "thiserror 1.0.69", "time", "tokio", "tracing", @@ -3632,23 +3778,23 @@ dependencies = [ [[package]] name = "tower-sessions-sqlx-store" -version = "0.14.1" +version = "0.14.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f81096d43c87c3bfa559116ac2b02d4a8398f0718be33e63685c467890ff4194" +checksum = "cdd38eba51214e99accab78f6b7c8e273e90a9cb57575e86b592c60074e182d7" dependencies = [ "async-trait", "rmp-serde", "sqlx", - "thiserror 1.0.56", + "thiserror 1.0.69", "time", "tower-sessions-core", ] [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "log", "pin-project-lite", @@ -3658,29 +3804,29 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", ] [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", ] [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "once_cell", @@ -3699,45 +3845,42 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" -version = "1.17.0" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" [[package]] name = "unicase" -version = "2.7.0" +version = "2.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d2d4dafb69621809a81864c9c1b864479e1235c0dd4e199924b9742439ed89" -dependencies = [ - "version_check", -] +checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] [[package]] -name = "unicode_categories" -version = "0.1.1" +name = "unicode-properties" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39ec24b3121d976906ece63c9daad25b85969647682eee313cb5779fdd69e14e" +checksum = "e70f2a8b45122e719eb623c01822704c4e0907e7e426a05927e1a1cfff5b75d0" [[package]] name = "unidecode" @@ -3753,12 +3896,12 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", - "idna 0.5.0", + "idna", "percent-encoding", ] @@ -3768,17 +3911,29 @@ version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "utoipa" -version = "4.2.0" +version = "4.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "272ebdfbc99111033031d2f10e018836056e4d2c8e2acda76450ec7974269fa7" +checksum = "c5afb1a60e207dca502682537fefcfd9921e71d0b83e9576060f09abc6efab23" dependencies = [ "indexmap", "serde", @@ -3788,15 +3943,15 @@ dependencies = [ [[package]] name = "utoipa-gen" -version = "4.2.0" +version = "4.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3c9f4d08338c1bfa70dde39412a040a884c6f318b3d09aaaf3437a1e52027fc" +checksum = "20c24e8ab68ff9ee746aad22d39b5535601e6416d1b0feeabf78be986a5c4392" dependencies = [ "proc-macro-error", "proc-macro2", "quote", "regex", - "syn 2.0.98", + "syn 2.0.100", "uuid", ] @@ -3814,19 +3969,19 @@ dependencies = [ [[package]] name = "uuid" -version = "1.11.0" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c5f0a0af699448548ad1a2fbf920fb4bee257eae39953ba95cb84891a0446a" +checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587" dependencies = [ - "getrandom", + "getrandom 0.3.1", "serde", ] [[package]] name = "value-bag" -version = "1.9.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" +checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" [[package]] name = "vcpkg" @@ -3836,9 +3991,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "want" @@ -3855,48 +4010,65 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.13.3+wasi-0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasite" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8dad83b4f25e74f184f64c43b150b91efe7647395b42289f38e50566d82855b" + [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", + "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.40" +version = "0.4.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bde2032aeb86bdfaecc8b261eef3cba735cc426c1f3a3416d1e0791be95fc461" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" dependencies = [ "cfg-if", "js-sys", + "once_cell", "wasm-bindgen", "web-sys", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3904,22 +4076,25 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "web" @@ -3939,7 +4114,6 @@ dependencies = [ "serde_json", "service", "sqlx", - "sqlx-sqlite", "time", "tokio", "tower", @@ -3952,60 +4126,52 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.67" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58cd2333b6e0be7a39605f0e255892fd7418a682d8da8fe042fe25128794d2ed" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" dependencies = [ "js-sys", "wasm-bindgen", ] [[package]] -name = "webpki-roots" -version = "0.26.6" +name = "web-time" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" dependencies = [ - "rustls-pki-types", + "js-sys", + "wasm-bindgen", ] [[package]] -name = "whoami" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22fc3756b8a9133049b26c7f61ab35416c130e8c09b660f5b3958b446f52cc50" - -[[package]] -name = "winapi" -version = "0.3.9" +name = "webpki-roots" +version = "0.26.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +checksum = "2210b291f7ea53617fbafcc4939f10914214ec15aace5ba62293a668f322c5c9" dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", + "rustls-pki-types", ] [[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" +name = "whoami" +version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" +checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +dependencies = [ + "redox_syscall", + "wasite", +] [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "winapi", + "windows-sys 0.59.0", ] -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-core" version = "0.52.0" @@ -4015,34 +4181,39 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "windows-link" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3" + [[package]] name = "windows-registry" -version = "0.2.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ "windows-result", "windows-strings", - "windows-targets 0.52.6", + "windows-targets 0.53.0", ] [[package]] name = "windows-result" -version = "0.2.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +checksum = "06374efe858fab7e4f881500e6e86ec8bc28f9462c47e5a9941a0142ad86b189" dependencies = [ - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" dependencies = [ - "windows-result", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -4096,13 +4267,29 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -4115,6 +4302,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -4127,6 +4320,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -4139,12 +4338,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -4157,6 +4368,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -4169,6 +4386,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -4181,6 +4404,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -4193,15 +4422,42 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "winnow" -version = "0.5.34" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" +checksum = "0e97b544156e9bebe1a0ffbc03484fc1ffe3100cbce3ffb17eac35f7cdd7ab36" dependencies = [ "memchr", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +dependencies = [ + "bitflags", +] + +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "wyz" version = "0.5.1" @@ -4217,28 +4473,95 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", + "synstructure", +] + [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.8.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.98", + "syn 2.0.100", + "synstructure", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] From 592568819ce74033ebd010e73547ba8f956b4024 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 13 Mar 2025 22:48:34 -0400 Subject: [PATCH 23/74] updates build and deploy container gh actions workflow --- .../workflows/build_and_deploy_containers.yml | 190 +++++++++++------- 1 file changed, 112 insertions(+), 78 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 5082d7d6..0f512273 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -1,6 +1,6 @@ -name: Build and Deploy Containers # Workflow name +name: Build and Deploy Containers -# When workflows are triggered +# Trigger on push events to branches with open PRs on: push: <<<<<<< HEAD @@ -13,8 +13,9 @@ on: workflow_dispatch: ======= branches: - - main # When changes are pushed to main (including merged PRs) + - main pull_request: +<<<<<<< HEAD types: [opened, synchronize, reopened] # Run when PRs are opened, updated, or reopened workflow_dispatch: # Allow manual triggering from any branch >>>>>>> ca9ea8f (merges in changes from test branch.) @@ -31,9 +32,20 @@ env: BACKEND_IMAGE_NAME: rust-backend # Backend Image name FRONTEND_IMAGE_NAME: nextjs-frontend # Frontend Image name >>>>>>> ca9ea8f (merges in changes from test branch.) +======= + types: [opened, synchronize, reopened] + workflow_dispatch: + +# Global env vars available to all jobs +env: + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BACKEND_IMAGE_NAME: rust-backend + FRONTEND_IMAGE_NAME: nextjs-frontend +>>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) jobs: - # Build and test the Rust project build_test_run: <<<<<<< HEAD runs-on: ubuntu-22.04 @@ -87,21 +99,27 @@ jobs: needs: build_test_run ======= name: Build and Test - runs-on: ubuntu-22.04 # Use Ubuntu 22.04 runner + runs-on: ubuntu-22.04 permissions: - contents: read # Permission to read repository contents - packages: write # Permission to write/publish packages - attestations: write # Permission to write security attestations - id-token: write # Permission for OIDC token (needed for security) + contents: read + packages: write + attestations: write + id-token: write steps: - # Checkout the code - - name: Checkout - uses: actions/checkout@v4 + # Checkout code and print current branch/PR info for transparency + - name: Checkout and Print Context + uses: actions/checkout@v4 + - run: | + echo "📋 Workflow Context:" + echo " Branch: $GITHUB_REF" + echo " Event: $GITHUB_EVENT_NAME" + echo " PR Number: $GITHUB_PULL_REQUEST" # Set env vars from GitHub Secrets - name: Set environment variables run: | + echo "🔑 Setting environment variables..." # Database connection parameters echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV @@ -109,26 +127,7 @@ jobs: echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV - # Construct database URL from individual parameters echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV - # Backend configuration - echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV - echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV - echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV - echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV - # Container configuration - echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV - echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV - # DNS aliases for services in the compose network - echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV - echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV - echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV - # Tiptap integration parameters - echo "TIPTAP_URL=${{ secrets.TIPTAP_URL }}" >> $GITHUB_ENV - echo "TIPTAP_AUTH_KEY=${{ secrets.TIPTAP_AUTH_KEY }}" >> $GITHUB_ENV - echo "TIPTAP_JWT_SIGNING_KEY=${{ secrets.TIPTAP_JWT_SIGNING_KEY }}" >> $GITHUB_ENV # Fixed typo # Install Rust toolchain - name: Install Rust toolchain @@ -136,13 +135,13 @@ jobs: with: targets: x86_64-unknown-linux-gnu - # Use cached dependencies to speed up builds + # Cache Rust dependencies for faster builds - name: Use cached dependencies uses: Swatinem/rust-cache@v2 with: - key: "ubuntu-22.04-x86_64-unknown-linux-gnu" # Cache key based on OS and architecture + key: "ubuntu-22.04-x86_64-unknown-linux-gnu" - # Install seaORM CLI for database migrations/management + # Install seaORM CLI for database migrations - name: Install seaORM CLI run: cargo install sea-orm-cli @@ -153,15 +152,20 @@ jobs: # Run all tests to ensure code quality - name: Test run: cargo test - + build_and_push_docker: name: Build and Push Docker Images +<<<<<<< HEAD runs-on: ubuntu-22.04 needs: build_test_run # Only run this job if the first job succeeds # Adds permissions for the job # This is needed for the attestations to work >>>>>>> ca9ea8f (merges in changes from test branch.) +======= + runs-on: ubuntu-22.04 + needs: build_test_run +>>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) permissions: contents: read packages: write @@ -169,6 +173,7 @@ jobs: id-token: write steps: +<<<<<<< HEAD <<<<<<< HEAD # Checkout source code - uses: actions/checkout@v4 @@ -177,29 +182,25 @@ jobs: - name: Docker login ======= # Checkout the code +======= + # Checkout code and print current branch/PR info +>>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) - name: Checkout uses: actions/checkout@v4 + - run: | + echo "📋 Workflow Context:" + echo " Branch: $GITHUB_REF" + echo " Event: $GITHUB_EVENT_NAME" + echo " PR Number: $GITHUB_PULL_REQUEST" # Set env vars for this job - name: Set environment variables run: | - # Copy the same environment variables from the first job - echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV - echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV - echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV - echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV - echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV - echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV - echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV + echo "🔑 Setting environment variables..." + # Only set variables not inherited from previous job + echo "DATABASE_URL=postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV - echo "PLATFORM=${{ secrets.PLATFORM }}" >> $GITHUB_ENV - echo "CONTAINER_NAME=${{ secrets.CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_CONTAINER_NAME=${{ secrets.FRONTEND_CONTAINER_NAME }}" >> $GITHUB_ENV - echo "FRONTEND_PORT=${{ secrets.FRONTEND_PORT }}" >> $GITHUB_ENV - echo "DB_DNS_ALIAS=${{ secrets.DB_DNS_ALIAS }}" >> $GITHUB_ENV - echo "BACKEND_DNS_ALIAS=${{ secrets.BACKEND_DNS_ALIAS }}" >> $GITHUB_ENV - echo "FRONTEND_DNS_ALIAS=${{ secrets.FRONTEND_DNS_ALIAS }}" >> $GITHUB_ENV echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV echo "TIPTAP_URL=${{ secrets.TIPTAP_URL }}" >> $GITHUB_ENV @@ -281,68 +282,101 @@ jobs: - name: Cache Docker layers uses: actions/cache@v4 with: - path: /tmp/.buildx-cache # Cache location - key: ${{ runner.os }}-buildx-${{ github.sha }} # Cache key based on OS and commit + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | - ${{ runner.os }}-buildx- # Fallback cache key + ${{ runner.os }}-buildx- + enableCrossOsArchive: true # Extract metadata for Docker images (tags, labels) - name: Extract metadata (tags, labels) for Docker - id: meta # ID to reference outputs in later steps + id: meta uses: docker/metadata-action@v4 with: - # Define the images to extract metadata for - images: ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }}, ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + images: | + ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} + ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} # Build and push the Rust backend image - name: Build and Push Rust Backend Image - id: push_backend # ID to reference outputs in later steps + id: push_backend uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 # Build for multiple architectures - context: . # Build context is root directory - push: true # Push to registry after building - tags: | # Image tags (latest and commit SHA) + # Explicitly specify the Dockerfile path + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + context: . + push: true + tags: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} # Apply extracted labels - cache-from: type=local,src=/tmp/.buildx-cache # Use cached layers - cache-to: type=local,dest=/tmp/.buildx-cache-new # Cache new layers - file: Dockerfile # Use root Dockerfile + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new # Build and push the Next.js frontend image - name: Build and Push Next.js Frontend Image - id: push_frontend # ID to reference outputs in later steps + id: push_frontend uses: docker/build-push-action@v6 with: - platforms: linux/amd64,linux/arm64 # Build for multiple architectures - context: web # Build context is web directory - push: true # Push to registry after building - tags: | # Image tags (latest and commit SHA) + build-args: | + BACKEND_URL=${{ secrets.BACKEND_URL }} + BACKEND_PORT=${{ secrets.BACKEND_PORT }} + platforms: linux/amd64,linux/arm64 + context: web + push: true + tags: | ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} # Apply extracted labels - cache-from: type=local,src=/tmp/.buildx-cache # Use cached layers - cache-to: type=local,dest=/tmp/.buildx-cache-new # Cache new layers - file: web/Dockerfile # Use web Dockerfile + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new # Move new cache to the original location for future jobs - name: Move new cache - run: mv /tmp/.buildx-cache-new /tmp/.buildx-cache # Update cache + run: | + echo "🔄 Moving new cache..." + rm -rf /tmp/.buildx-cache + mv /tmp/.buildx-cache-new /tmp/.buildx-cache # Generate artifact attestation for security and supply chain integrity - name: Generate artifact attestation for Rust Backend Image uses: actions/attest-build-provenance@v2 with: subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }} - subject-digest: ${{ steps.push_backend.outputs.digest }} # Use the digest output from build - push-to-registry: true # Push attestation to registry + subject-digest: ${{ steps.push_backend.outputs.digest }} + push-to-registry: true - # Generate artifact attestation for security and supply chain integrity + # Generate artifact attestation for Next.js Frontend Image - name: Generate artifact attestation for Next.js Frontend Image uses: actions/attest-build-provenance@v2 with: subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }} +<<<<<<< HEAD subject-digest: ${{ steps.push_frontend.outputs.digest }} # Use the digest output from build push-to-registry: true # Push attestation to registry >>>>>>> ca9ea8f (merges in changes from test branch.) +======= + subject-digest: ${{ steps.push_frontend.outputs.digest }} + push-to-registry: true + + # Print artifacts and usage commands + - name: Print artifacts and usage commands + run: | + echo "📦 Built and pushed images:" + echo " Backend: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" + echo " Frontend: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" + echo "" + echo "🔑 Login command:" + echo " echo $GITHUB_TOKEN | docker login ${{ env.REGISTRY }} -u $GITHUB_ACTOR --password-stdin" + echo "" + echo "📥 Pull commands:" + echo " docker pull ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" + echo " docker pull ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" + echo "" + echo "📤 Push commands:" + echo " docker tag ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" + echo " docker tag ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" + echo " docker push ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" + echo " docker push ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" +>>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) From 6d772b11b8a7e9c3847aeea609bf851300e25cc2 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Thu, 13 Mar 2025 22:52:38 -0400 Subject: [PATCH 24/74] noop: addresses README linting warning. --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3dab3f47..1a1b8b9f 100644 --- a/README.md +++ b/README.md @@ -274,8 +274,12 @@ Note that to generate a new Entity using the CLI you must ignore all other table ```bash DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} <<<<<<< HEAD +<<<<<<< HEAD ``` >>>>>>> f61c08b (merges remaining changes from main.) ======= ``` >>>>>>> ca9ea8f (merges in changes from test branch.) +======= +``` +>>>>>>> 527edcb (noop: addresses README linting warning.) From 31554ae63be2e9b83f2a951b93eb39c58b74ea45 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 12:56:53 -0400 Subject: [PATCH 25/74] adds ARM64 cross-compilation tools to Docker builder image --- Cargo.lock | 10 +++++----- Dockerfile | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3c7a6e68..724a39bd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1688,9 +1688,9 @@ checksum = "d26c52dbd32dccf2d10cac7725f8eae5296885fb5703b261f7d0a0739ec807ab" [[package]] name = "linux-raw-sys" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db9c683daf087dc577b7506e9695b3d556a9f3849903fa28186283afd6809e9" +checksum = "fe7db12097d22ec582439daf8618b8fdd1a7bef6270e9af3b1ebcd30893cf413" [[package]] name = "litemap" @@ -2630,7 +2630,7 @@ dependencies = [ "bitflags", "errno", "libc", - "linux-raw-sys 0.9.2", + "linux-raw-sys 0.9.3", "windows-sys 0.59.0", ] @@ -3969,9 +3969,9 @@ dependencies = [ [[package]] name = "uuid" -version = "1.15.1" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0f540e3240398cce6128b64ba83fdbdd86129c16a3aa1a3a252efd66eb3d587" +checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" dependencies = [ "getrandom 0.3.1", "serde", diff --git a/Dockerfile b/Dockerfile index e109a8b0..46c218c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,11 @@ WORKDIR /usr/src/app RUN apt-get update && apt-get install -y --no-install-recommends \ bash \ build-essential \ + gcc-aarch64-linux-gnu \ + libc6-dev:arm64 \ libssl-dev \ pkg-config \ - libpq-dev # Include PostgreSQL development libraries && rm -rf /var/lib/apt/lists/* + libpq-dev && rm -rf /var/lib/apt/lists/* # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu From 785143abee57061af4b95dcd9b2a33ada43cce20 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 13:14:31 -0400 Subject: [PATCH 26/74] adds the ARM64 architecture support before installing ARM64-specific packages in Dockerfile --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 46c218c8..ea2888d4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,12 +17,19 @@ WORKDIR /usr/src/app RUN apt-get update && apt-get install -y --no-install-recommends \ bash \ build-essential \ - gcc-aarch64-linux-gnu \ - libc6-dev:arm64 \ + gcc-aarch64-linux-gnu \ libssl-dev \ pkg-config \ libpq-dev && rm -rf /var/lib/apt/lists/* +# Add ARM64 architecture +RUN dpkg --add-architecture arm64 + +# Install ARM64 packages +RUN apt-get update && apt-get install -y --no-install-recommends \ + libc6-dev:arm64 \ + && rm -rf /var/lib/apt/lists/* + # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu From 28908769b092011e754f588650ac252ecd34b635 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 13:44:34 -0400 Subject: [PATCH 27/74] adds openssl dependencies for cross compilation to Dockerfile and gh actions workflow. --- .github/workflows/build_and_deploy_containers.yml | 7 +++++++ Dockerfile | 11 +++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 0f512273..8c647734 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -43,7 +43,11 @@ env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} BACKEND_IMAGE_NAME: rust-backend FRONTEND_IMAGE_NAME: nextjs-frontend +<<<<<<< HEAD >>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) +======= + OPENSSL_DIR: /usr/local/ssl +>>>>>>> b96710a (adds openssl dependencies for cross compilation to Dockerfile and gh actions workflow.) jobs: build_test_run: @@ -128,6 +132,9 @@ jobs: echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV + echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV + echo "OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV + echo "OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu" >> $GITHUB_ENV # Install Rust toolchain - name: Install Rust toolchain diff --git a/Dockerfile b/Dockerfile index ea2888d4..4d6c4a62 100644 --- a/Dockerfile +++ b/Dockerfile @@ -27,8 +27,15 @@ RUN dpkg --add-architecture arm64 # Install ARM64 packages RUN apt-get update && apt-get install -y --no-install-recommends \ - libc6-dev:arm64 \ - && rm -rf /var/lib/apt/lists/* + libssl-dev:arm64 \ + libpq-dev:arm64 \ + pkg-config && \ + rm -rf /var/lib/apt/lists/* + +# Set up environment for OpenSSL cross-compilation +ENV PKG_CONFIG_ALLOW_CROSS=1 +ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu +ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu From ed43e171fdeb14f97c053698a1949816498d829f Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 14:07:08 -0400 Subject: [PATCH 28/74] adds openssl and pkg config env vars to ci gh actions workflow --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01a8e8eb..d44d8910 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,6 +6,9 @@ on: env: CARGO_TERM_COLOR: always + OPENSSL_LIB_DIR: /usr/lib/aarch64-linux-gnu + OPENSSL_INCLUDE_DIR: /usr/include/aarch64-linux-gnu + PKG_CONFIG_ALLOW_CROSS: 1 jobs: build_test_run: @@ -20,6 +23,9 @@ jobs: uses: dtolnay/rust-toolchain@stable with: targets: x86_64-unknown-linux-gnu + + - name: Install dependencies + run: sudo apt-get install -y pkg-config libssl-dev - name: Use cached dependencies uses: Swatinem/rust-cache@v2 From 81b5e68172f9ede02fe29eb62bfc2f61aaa0b3e7 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 14:08:09 -0400 Subject: [PATCH 29/74] adds openssl env vars and aarch linux build deps in Dockerfile --- Dockerfile | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 4d6c4a62..f94aca86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,10 @@ WORKDIR /usr/src/app RUN apt-get update && apt-get install -y --no-install-recommends \ bash \ build-essential \ - gcc-aarch64-linux-gnu \ - libssl-dev \ pkg-config \ + gcc-aarch64-linux-gnu \ + g++-aarch64-linux-gnu \ + libssl-dev \ libpq-dev && rm -rf /var/lib/apt/lists/* # Add ARM64 architecture @@ -29,7 +30,9 @@ RUN dpkg --add-architecture arm64 RUN apt-get update && apt-get install -y --no-install-recommends \ libssl-dev:arm64 \ libpq-dev:arm64 \ - pkg-config && \ + pkg-config \ + gcc-aarch64-linux-gnu \ + g++-aarch64-linux-gnu && \ rm -rf /var/lib/apt/lists/* # Set up environment for OpenSSL cross-compilation From e5956bb27e9044e782faaa427800bbbdc81099c8 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 14:31:37 -0400 Subject: [PATCH 30/74] adds cross additional build platform target to ci gh actions file and adds deps to the workfow aswell. --- .github/workflows/ci.yml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d44d8910..fd0b590f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,8 +6,6 @@ on: env: CARGO_TERM_COLOR: always - OPENSSL_LIB_DIR: /usr/lib/aarch64-linux-gnu - OPENSSL_INCLUDE_DIR: /usr/include/aarch64-linux-gnu PKG_CONFIG_ALLOW_CROSS: 1 jobs: @@ -22,10 +20,17 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu - name: Install dependencies - run: sudo apt-get install -y pkg-config libssl-dev + run: | + sudo apt-get update && \ + sudo apt-get install -y --no-install-recommends \ + gcc-aarch64-linux-gnu \ + libssl-dev \ + libssl-dev:arm64 \ + pkg-config \ + && sudo ldconfig - name: Use cached dependencies uses: Swatinem/rust-cache@v2 From 1858f8520ed0277b8435d11fc7477f005474aa13 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 14:33:13 -0400 Subject: [PATCH 31/74] adds support for aarch64 architecture in CI workflow by updating Rust toolchain targets and cache key --- .github/workflows/build_and_deploy_containers.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index 8c647734..a0b974cd 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -44,10 +44,13 @@ env: BACKEND_IMAGE_NAME: rust-backend FRONTEND_IMAGE_NAME: nextjs-frontend <<<<<<< HEAD +<<<<<<< HEAD >>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) ======= OPENSSL_DIR: /usr/local/ssl >>>>>>> b96710a (adds openssl dependencies for cross compilation to Dockerfile and gh actions workflow.) +======= +>>>>>>> baa751f (adds support for aarch64 architecture in CI workflow by updating Rust toolchain targets and cache key) jobs: build_test_run: @@ -140,13 +143,13 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu # Cache Rust dependencies for faster builds - name: Use cached dependencies uses: Swatinem/rust-cache@v2 with: - key: "ubuntu-22.04-x86_64-unknown-linux-gnu" + key: "ubuntu-22.04-x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu" # Install seaORM CLI for database migrations - name: Install seaORM CLI From 80bbd28fa21b9d3854c069bfb9089b61c8f01f6f Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 14:36:13 -0400 Subject: [PATCH 32/74] brings ci.yml gh actions workflow to parity with main. --- .github/workflows/ci.yml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd0b590f..01a8e8eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,6 @@ on: env: CARGO_TERM_COLOR: always - PKG_CONFIG_ALLOW_CROSS: 1 jobs: build_test_run: @@ -20,17 +19,7 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu - - - name: Install dependencies - run: | - sudo apt-get update && \ - sudo apt-get install -y --no-install-recommends \ - gcc-aarch64-linux-gnu \ - libssl-dev \ - libssl-dev:arm64 \ - pkg-config \ - && sudo ldconfig + targets: x86_64-unknown-linux-gnu - name: Use cached dependencies uses: Swatinem/rust-cache@v2 From 69358dfc05cfab3af567bba6cd819359dd39e95a Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 14:43:42 -0400 Subject: [PATCH 33/74] adds binutils for aarch64 to Dockerfile. --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index f94aca86..71bbe3ef 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,7 +32,8 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libpq-dev:arm64 \ pkg-config \ gcc-aarch64-linux-gnu \ - g++-aarch64-linux-gnu && \ + g++-aarch64-linux-gnu \ + binutils-aarch64-linux-gnu && \ rm -rf /var/lib/apt/lists/* # Set up environment for OpenSSL cross-compilation @@ -73,6 +74,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ libpq5 \ && rm -rf /var/lib/apt/lists/* + # Set the working directory WORKDIR /usr/src/app From 711f23a70943ece98d7a94aeddb793ed64390076 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 16:16:00 -0400 Subject: [PATCH 34/74] adds ARM64 cross-compilation support in Dockerfile by installing necessary packages and configuring Cargo linker --- Dockerfile | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 71bbe3ef..bc1dd375 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,20 +14,22 @@ WORKDIR /usr/src/app # All subsequent commands will be executed from this directory # Install necessary packages for building Rust projects with PostgreSQL dependencies -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y \ bash \ build-essential \ pkg-config \ - gcc-aarch64-linux-gnu \ - g++-aarch64-linux-gnu \ libssl-dev \ - libpq-dev && rm -rf /var/lib/apt/lists/* + libpq-dev \ + gcc-aarch64-linux-gnu \ + binutils-aarch64-linux-gnu # Add ARM64 architecture RUN dpkg --add-architecture arm64 # Install ARM64 packages -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y \ + build-essential \ + libc6-dev-arm64-cross \ libssl-dev:arm64 \ libpq-dev:arm64 \ pkg-config \ @@ -44,6 +46,13 @@ ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu +# Configure Cargo to use the ARM64 linker +# Create a .cargo directory and set the linker for the ARM64 target +# This ensures that the correct linker is used for cross-compilation +RUN mkdir -p /root/.cargo && \ + echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ + echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config + # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ # Copy the workspace manifest and lock file. Docker caches layers, so copying these first @@ -69,12 +78,14 @@ RUN cargo build --release --workspace --target aarch64-unknown-linux-gnu FROM debian:stable-slim AS runtime # Install necessary runtime dependencies and clean up apt lists -RUN apt-get update && apt-get install -y --no-install-recommends \ +RUN apt-get update && apt-get install -y \ libssl3 \ libpq5 \ + libssl-dev \ + libpq-dev \ + ca-certificates \ && rm -rf /var/lib/apt/lists/* - # Set the working directory WORKDIR /usr/src/app From a316cfd2a5da80a703acb3de47ba5dd1b998fb1b Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 14 Mar 2025 16:26:00 -0400 Subject: [PATCH 35/74] adds libssl-dev instalation to ci.yml gh actions workflow. --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01a8e8eb..02290ee0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,9 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Install OpenSSL + run: sudo apt-get install -y libssl-dev + - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: From 42d95b9ba67d13472817186b4dcab3efda45b227 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 16:03:46 -0400 Subject: [PATCH 36/74] removes dpkg arm installs, moves symlink setup, ensures .cargo.confing is correctly setup. --- Dockerfile | 29 ++++++++--------------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index bc1dd375..32f351f4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,36 +23,23 @@ RUN apt-get update && apt-get install -y \ gcc-aarch64-linux-gnu \ binutils-aarch64-linux-gnu -# Add ARM64 architecture -RUN dpkg --add-architecture arm64 -# Install ARM64 packages -RUN apt-get update && apt-get install -y \ - build-essential \ - libc6-dev-arm64-cross \ - libssl-dev:arm64 \ - libpq-dev:arm64 \ - pkg-config \ - gcc-aarch64-linux-gnu \ - g++-aarch64-linux-gnu \ - binutils-aarch64-linux-gnu && \ - rm -rf /var/lib/apt/lists/* +# Add missing symlink for OpenSSL (to prevent linking errors) +RUN ln -s /usr/lib/aarch64-linux-gnu /usr/lib + +# Set up Cargo for cross-compilation +RUN mkdir -p /root/.cargo && \ + echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ + echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config # Set up environment for OpenSSL cross-compilation ENV PKG_CONFIG_ALLOW_CROSS=1 -ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu +ENV OPENSSL_LIB_DIR=/usr/aarch64-linux-gnu/lib ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu -# Configure Cargo to use the ARM64 linker -# Create a .cargo directory and set the linker for the ARM64 target -# This ensures that the correct linker is used for cross-compilation -RUN mkdir -p /root/.cargo && \ - echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ - echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config - # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ # Copy the workspace manifest and lock file. Docker caches layers, so copying these first From f72262b9619922b6676db8f0d49a2dda0625cd4d Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 16:16:33 -0400 Subject: [PATCH 37/74] adds QEMU setup, forces cargo to rebuild correct linker in gh actions container workflow. --- .../workflows/build_and_deploy_containers.yml | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index a0b974cd..ecbb811a 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -136,9 +136,14 @@ jobs: echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV - echo "OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu" >> $GITHUB_ENV + echo "OPENSSL_LIB_DIR=/usr/aarch64-linux-gnu/lib" >> $GITHUB_ENV echo "OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu" >> $GITHUB_ENV + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + with: + platforms: linux/amd64,linux/arm64 + # Install Rust toolchain - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable @@ -151,17 +156,28 @@ jobs: with: key: "ubuntu-22.04-x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu" + # Cache Rust dependencies for faster builds + - name: Use cached dependencies + uses: Swatinem/rust-cache@v2 + with: + key: "aarch64-unknown-linux-gnu" + # Install seaORM CLI for database migrations - name: Install seaORM CLI run: cargo install sea-orm-cli # Build all project targets - name: Build - run: cargo build --all-targets + run: cargo build --all-targets --release --workspace --target aarch64-unknown-linux-gnu # Run all tests to ensure code quality - name: Test - run: cargo test + run: cargo test --release # Ensure tests are run in release mode + + - name: Clean and Rebuild + run: | + cargo clean + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="aarch64-linux-gnu-gcc" cargo build --release --workspace --target aarch64-unknown-linux-gnu build_and_push_docker: name: Build and Push Docker Images From c1a90b5ed88dfbefe2758383fdfeb96757badbbb Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 16:32:42 -0400 Subject: [PATCH 38/74] adds support for aarch64 target in CI workflow and sets OpenSSL paths --- .github/workflows/ci.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 02290ee0..b173bf2f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,13 +16,20 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - name: Install OpenSSL - run: sudo apt-get install -y libssl-dev - - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu + + - name: Use cached dependencies + uses: Swatinem/rust-cache@v2 + with: + key: "ubuntu-22.04-x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu" + + - name: Set OpenSSL Paths + run: | + echo "OPENSSL_LIB_DIR=/usr/lib/x86_64-linux-gnu" >> $GITHUB_ENV + echo "OPENSSL_INCLUDE_DIR=/usr/include/x86_64-linux-gnu" >> $GITHUB_ENV - name: Use cached dependencies uses: Swatinem/rust-cache@v2 From d1fc07edc5243549f066b368b398c46b153282a6 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 17:14:33 -0400 Subject: [PATCH 39/74] adds matching cargo lock file --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 724a39bd..aa55d8a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -287,9 +287,9 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.87" +version = "0.1.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d556ec1359574147ec0c4fc5eb525f3f23263a592b1a9c07e0a75b427de55c97" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", @@ -978,9 +978,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "foldhash" -version = "0.1.4" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d2fde1f7b3d48b8395d5f2de76c18a528bd6a9cdde438df747bfcba3e05d6f" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" [[package]] name = "foreign-types" From 6c1be506b4529eff35adbd82c7e5588993b7a35a Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 17:14:49 -0400 Subject: [PATCH 40/74] adds support for ARM64 cross-compilation in Dockerfile --- Dockerfile | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32f351f4..59060b06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,22 +20,26 @@ RUN apt-get update && apt-get install -y \ pkg-config \ libssl-dev \ libpq-dev \ + libssl-dev:arm64 \ + libpq-dev:arm64 \ + g++-aarch64-linux-gnu \ gcc-aarch64-linux-gnu \ - binutils-aarch64-linux-gnu - - -# Add missing symlink for OpenSSL (to prevent linking errors) -RUN ln -s /usr/lib/aarch64-linux-gnu /usr/lib + binutils-aarch64-linux-gnu \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* -# Set up Cargo for cross-compilation +ENV PKG_CONFIG_ALLOW_CROSS=1 +ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu +ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu RUN mkdir -p /root/.cargo && \ echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config + # Set up environment for OpenSSL cross-compilation -ENV PKG_CONFIG_ALLOW_CROSS=1 -ENV OPENSSL_LIB_DIR=/usr/aarch64-linux-gnu/lib -ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu +RUN mkdir -p /root/.cargo && \ + echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ + echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu From bac3b47cb976208343adc57ebbbce4647e2cc86c Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 17:24:45 -0400 Subject: [PATCH 41/74] adds support for ARM64 architecture in Dockerfile and conditionally installs architecture-specific packages --- Dockerfile | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 59060b06..f96f9785 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,6 +13,9 @@ FROM rust:latest AS builder WORKDIR /usr/src/app # All subsequent commands will be executed from this directory +# Adds architecture to the container to support ARM64 (Raspberry Pi 5) +RUN dpkg --add-architecture arm64 + # Install necessary packages for building Rust projects with PostgreSQL dependencies RUN apt-get update && apt-get install -y \ bash \ @@ -20,14 +23,17 @@ RUN apt-get update && apt-get install -y \ pkg-config \ libssl-dev \ libpq-dev \ - libssl-dev:arm64 \ - libpq-dev:arm64 \ g++-aarch64-linux-gnu \ gcc-aarch64-linux-gnu \ binutils-aarch64-linux-gnu \ --no-install-recommends \ && rm -rf /var/lib/apt/lists/* +# Install architecture-specific packages conditionally +RUN if [ "$(dpkg --print-architecture)" = "arm64" ]; then \ + apt-get update && apt-get install -y --no-install-recommends libssl-dev:arm64 libpq-dev:arm64 && rm -rf /var/lib/apt/lists/*; \ + fi + ENV PKG_CONFIG_ALLOW_CROSS=1 ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu @@ -35,12 +41,6 @@ RUN mkdir -p /root/.cargo && \ echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config - -# Set up environment for OpenSSL cross-compilation -RUN mkdir -p /root/.cargo && \ - echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ - echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config - # Install the necessary Rust target for ARM64 (Raspberry Pi 5) RUN rustup target add aarch64-unknown-linux-gnu From cccc8e1b39a733cb75d1b91c7b5ffd1ae96195f5 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 17:38:31 -0400 Subject: [PATCH 42/74] adds ARM64-specific packages to Dockerfile for cross-compilation support --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index f96f9785..2f8c7078 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,6 +23,8 @@ RUN apt-get update && apt-get install -y \ pkg-config \ libssl-dev \ libpq-dev \ + libssl-dev:arm64 \ + libpq-dev:arm64 \ g++-aarch64-linux-gnu \ gcc-aarch64-linux-gnu \ binutils-aarch64-linux-gnu \ From 8614f740b21e01ed4c8a3b411f3477d6de798dd7 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 15 Mar 2025 17:42:44 -0400 Subject: [PATCH 43/74] removes ARM64-specific packages from Dockerfile to streamline installation to within if logic --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2f8c7078..f96f9785 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,8 +23,6 @@ RUN apt-get update && apt-get install -y \ pkg-config \ libssl-dev \ libpq-dev \ - libssl-dev:arm64 \ - libpq-dev:arm64 \ g++-aarch64-linux-gnu \ gcc-aarch64-linux-gnu \ binutils-aarch64-linux-gnu \ From ea6212d0d677cafb99beb059ae44b9525322a515 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Mon, 17 Mar 2025 21:00:22 -0400 Subject: [PATCH 44/74] refactors Dockerfile to create to builder images for compiling and adds entrypoint.sh as the entrypoint --- Dockerfile | 142 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 108 insertions(+), 34 deletions(-) diff --git a/Dockerfile b/Dockerfile index f96f9785..c8bb3f9a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,48 +1,97 @@ # syntax=docker/dockerfile:1 # Specify the Dockerfile syntax version +<<<<<<< HEAD # Stage 1: Build Stage <<<<<<< HEAD FROM rust:1.70-slim AS builder ======= FROM rust:latest AS builder +======= +# Stage 1: Builder for AMD64 +FROM rust:latest AS builder-amd64 +>>>>>>> 88c1ea1 (refactors Dockerfile to create to builder images for compiling and adds entrypoint.sh as the entrypoint) # AS builder names this stage for easy referencing later >>>>>>> ca9ea8f (merges in changes from test branch.) +# Declare an arg for the target platform, buildx will set this value +ARG TARGETPLATFORM + +# Declare an arg for the target architecture, buildx will set this value +ARG TARGETARCH + # Set the working directory inside the container WORKDIR /usr/src/app # All subsequent commands will be executed from this directory -# Adds architecture to the container to support ARM64 (Raspberry Pi 5) -RUN dpkg --add-architecture arm64 - # Install necessary packages for building Rust projects with PostgreSQL dependencies RUN apt-get update && apt-get install -y \ bash \ build-essential \ pkg-config \ libssl-dev \ - libpq-dev \ - g++-aarch64-linux-gnu \ - gcc-aarch64-linux-gnu \ - binutils-aarch64-linux-gnu \ + libpq-dev \ --no-install-recommends \ && rm -rf /var/lib/apt/lists/* -# Install architecture-specific packages conditionally -RUN if [ "$(dpkg --print-architecture)" = "arm64" ]; then \ - apt-get update && apt-get install -y --no-install-recommends libssl-dev:arm64 libpq-dev:arm64 && rm -rf /var/lib/apt/lists/*; \ +# Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure +COPY Cargo.toml Cargo.lock ./ +# Copy the workspace manifest and lock file. Docker caches layers, so copying these first +# allows Docker to cache dependencies if these files don't change. + +# Copy each module's Cargo.toml to maintain the workspace structure +COPY ./entity/Cargo.toml ./entity/Cargo.toml +COPY ./entity_api/Cargo.toml ./entity_api/Cargo.toml +COPY ./migration/Cargo.toml ./migration/Cargo.toml +COPY ./service/Cargo.toml ./service/Cargo.toml +COPY ./web/Cargo.toml ./web/Cargo.toml + +# Copy the complete source code into the container's working directory +COPY . . + +# Remove the target directory to ensure a clean build. +RUN cargo clean + +# Install cross-compliation target if needed +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + rustup target add x86_64-unknown-linux-gnu; \ fi +# Conditionally add the x86_64 target if the target platform is AMD64 -ENV PKG_CONFIG_ALLOW_CROSS=1 -ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu -ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu -RUN mkdir -p /root/.cargo && \ - echo '[target.aarch64-unknown-linux-gnu]' >> /root/.cargo/config && \ - echo 'linker = "aarch64-linux-gnu-gcc"' >> /root/.cargo/config +# Build the Rust application in release mode for the AMD64 target +RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ + cargo build --release --workspace --target x86_64-unknown-linux-gnu; \ + fi +# Conditionally build the release binary for the x86_64 target + +# Stage 2: Builder for ARM64 +FROM rust:latest AS builder-arm64 + +# Declare an arg for the target platform, buildx will set this value +ARG TARGETPLATFORM -# Install the necessary Rust target for ARM64 (Raspberry Pi 5) -RUN rustup target add aarch64-unknown-linux-gnu +# Declare an arg for the target architecture, buildx will set this value +ARG TARGETARCH + +# Set the working directory inside the container +WORKDIR /usr/src/app +# All subsequent commands will be executed from this directory + +# Install necessary packages for building Rust projects with PostgreSQL dependencies +RUN apt-get update && apt-get install -y \ + bash \ + build-essential \ + pkg-config \ + libssl-dev \ + libpq-dev \ + --no-install-recommends \ + && rm -rf /var/lib/apt/lists/* + +# Install cross-compliation target if needed +RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ + rustup target add aarch64-unknown-linux-gnu; \ + fi +# Conditionally add the ARM64 target if the target platform is ARM64 # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ @@ -62,14 +111,32 @@ COPY . . # Remove the target directory to ensure a clean build. RUN cargo clean -# Build workspace and dependencies to leverage Docker cache in release mode for ARM64 -RUN cargo build --release --workspace --target aarch64-unknown-linux-gnu +# Build the Rust application in release mode for the ARM64 target +RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ + cargo build --release --workspace --target aarch64-unknown-linux-gnu; \ + fi +# Conditionally build the release binary for the aarch64 target + + +# Stage 3: Merge the binaries +FROM debian:stable-slim AS merger + +# Declare an arg for the target platform, buildx will set this value +ARG TARGETPLATFORM -# Stage 2: Runtime Stage -FROM debian:stable-slim AS runtime +# Declare an arg for the target architecture, buildx will set this value +ARG TARGETARCH + +# Set environment variables for the build process +ENV PKG_CONFIG_ALLOW_CROSS=1 +ENV OPENSSL_DIR=/usr +ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu +ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu +ENV OPENSSL_STATIC=1 # Install necessary runtime dependencies and clean up apt lists -RUN apt-get update && apt-get install -y \ +RUN mkdir -p /usr/include/aarch64-linux-gnu && apt-get update && \ + apt-get install -y --no-install-recommends \ libssl3 \ libpq5 \ libssl-dev \ @@ -77,7 +144,18 @@ RUN apt-get update && apt-get install -y \ ca-certificates \ && rm -rf /var/lib/apt/lists/* -# Set the working directory + +# Copy the AMD64 binaries from the builder-amd64 stage +COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs +COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/migration /usr/src/app/target/x86_64-unknown-linux-gnu/release/migration +COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/seed_db /usr/src/app/target/x86_64-unknown-linux-gnu/release/seed_db + +# Copy the ARM64 binaries from the builder-arm64 stage +COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs +COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration +COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db + +# Set the working directory inside the container WORKDIR /usr/src/app # Create a non-root user for running the application @@ -85,19 +163,15 @@ RUN useradd -m appuser && \ chown -R appuser:appuser /usr/src/app && \ chmod -R 755 /usr/src/app -# Copy the compiled binaries from the builder stage -COPY --from=builder /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs /usr/local/bin/refactor_platform_rs -COPY --from=builder /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration /usr/local/bin/migration -COPY --from=builder /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db /usr/local/bin/seed_db - # Switch to the non-root user USER appuser -# Expose the necessary ports EXPOSE ${BACKEND_PORT} -# Set the entrypoint to run the application -ENTRYPOINT ["/bin/bash", "-c", "/usr/local/bin/refactor_platform_rs"] +# Create a simple script to run the correct binary based on the architecture +COPY --chmod=755 entrypoint.sh /usr/src/app/entrypoint.sh +# Copy an entrypoint script and make it executable + +ENTRYPOINT ["entrypoint.sh"] +# Set the entry point to the script that selects the correct binary -# Set the default args to run when the container starts -CMD ["-l", "$BACKEND_LOG_FILTER_LEVEL", "-i", "$BACKEND_INTERFACE", "-p", "$BACKEND_PORT", "-d", "$DATABASE_URL", "--allowed-origins=$BACKEND_ALLOWED_ORIGINS"] \ No newline at end of file From 64cf860838b09eee6f7dda1285bf0c96d3aed4de Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Mon, 17 Mar 2025 21:01:41 -0400 Subject: [PATCH 45/74] adds entrypoint.sh which dynamically determines the host architecture and runs the correct binary in the pulled image. --- entrypoint.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 entrypoint.sh diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 00000000..6a665032 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,29 @@ +#!/bin/sh +set -euo pipefail + +case "$(uname -m)" in + x86_64) + echo "Executing AMD64 binary" + exec /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs \ + -l "$BACKEND_LOG_FILTER_LEVEL" \ + -i "$BACKEND_INTERFACE" \ + -p "$BACKEND_PORT" \ + -d "$DATABASE_URL" \ + --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ + "$@" + ;; + aarch64) + echo "Executing ARM64 binary" + exec /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs \ + -l "$BACKEND_LOG_FILTER_LEVEL" \ + -i "$BACKEND_INTERFACE" \ + -p "$BACKEND_PORT" \ + -d "$DATABASE_URL" \ + --allowed-origins="$BACKEND_ALLOWED_ORIGINS"\ + "$@" + ;; + *) + echo "Unsupported architecture: $(uname -m)" >&2 + exit 1 + ;; +esac \ No newline at end of file From 2f71ff5a57e84ee849620b7fb5d2a3ec13011ee5 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Mon, 17 Mar 2025 21:25:33 -0400 Subject: [PATCH 46/74] reconciles Cargo.lock file --- Cargo.lock | 56 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 31 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index aa55d8a1..49a5e059 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -232,9 +232,9 @@ dependencies = [ [[package]] name = "async-std" -version = "1.13.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" +checksum = "730294c1c08c2e0f85759590518f6333f0d5a0a766a27d519c1b244c3dfd8a24" dependencies = [ "async-attributes", "async-channel 1.9.0", @@ -1148,14 +1148,14 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a49c392881ce6d5c3b8cb70f98717b7c07aabbdff06687b9030dbfbe2725f8" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ "cfg-if", "libc", - "wasi 0.13.3+wasi-0.2.2", - "windows-targets 0.52.6", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", ] [[package]] @@ -1950,9 +1950,9 @@ dependencies = [ [[package]] name = "ordered-float" -version = "3.9.2" +version = "4.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1e1c390732d15f1d48471625cd92d154e66db2c56645e29a9cd26f4699f72dc" +checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951" dependencies = [ "num-traits", ] @@ -2333,6 +2333,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "radium" version = "0.7.0" @@ -2582,9 +2588,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.36.0" +version = "1.37.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" +checksum = "5c24af6e7ac43c88a8a458d1139d0246fdce2f6cd2f1ac6cb51eb88b29c978af" dependencies = [ "arrayvec", "borsh", @@ -2636,9 +2642,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.23" +version = "0.23.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47796c98c480fce5406ef69d1c76378375492c3b0a0de587be0c1d9feb12f395" +checksum = "822ee9188ac4ec04a2f0531e55d035fb2de73f18b41a63c70c2712503b6fb13c" dependencies = [ "once_cell", "ring", @@ -2668,9 +2674,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.8" +version = "0.103.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +checksum = "0aa4eeac2588ffff23e9d7a7e9b3f971c5fb5b7ebc9452745e0c232c64f83b2f" dependencies = [ "ring", "rustls-pki-types", @@ -2795,9 +2801,9 @@ dependencies = [ [[package]] name = "sea-query" -version = "0.32.2" +version = "0.32.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b731192738ebf56d20580fc8ba2d23940333befe900b04dd08a26a77cd056f02" +checksum = "f5a24d8b9fcd2674a6c878a3d871f4f1380c6c43cc3718728ac96864d888458e" dependencies = [ "bigdecimal", "chrono", @@ -2828,16 +2834,16 @@ dependencies = [ [[package]] name = "sea-query-derive" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9834af2c4bd8c5162f00c89f1701fb6886119a88062cf76fe842ea9e232b9839" +checksum = "bae0cbad6ab996955664982739354128c58d16e126114fe88c2a493642502aab" dependencies = [ "darling", "heck 0.4.1", "proc-macro2", "quote", "syn 2.0.100", - "thiserror 1.0.69", + "thiserror 2.0.12", ] [[package]] @@ -3442,7 +3448,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "488960f40a3fd53d72c2a29a58722561dee8afdd175bd88e3db4677d7b2ba600" dependencies = [ "fastrand", - "getrandom 0.3.1", + "getrandom 0.3.2", "once_cell", "rustix 1.0.2", "windows-sys 0.59.0", @@ -3973,7 +3979,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "458f7a779bf54acc9f347480ac654f68407d3aab21269a6e3c9f922acd9e2da9" dependencies = [ - "getrandom 0.3.1", + "getrandom 0.3.2", "serde", ] @@ -4012,9 +4018,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasi" -version = "0.13.3+wasi-0.2.2" +version = "0.14.2+wasi-0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26816d2e1a4a36a2940b96c5296ce403917633dff8f3440e9b236ed6f6bacad2" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" dependencies = [ "wit-bindgen-rt", ] @@ -4439,9 +4445,9 @@ dependencies = [ [[package]] name = "wit-bindgen-rt" -version = "0.33.0" +version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3268f3d866458b787f390cf61f4bbb563b922d091359f9608842999eaee3943c" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ "bitflags", ] From 8f574c8a8deaf43a90c4156869dec573974029eb Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Mon, 17 Mar 2025 21:26:15 -0400 Subject: [PATCH 47/74] update conditional compilation and renames binary locationds from architecture --- Dockerfile | 117 ++++++++++++++--------------------------------------- 1 file changed, 31 insertions(+), 86 deletions(-) diff --git a/Dockerfile b/Dockerfile index c8bb3f9a..8149c38c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ # syntax=docker/dockerfile:1 # Specify the Dockerfile syntax version +<<<<<<< HEAD <<<<<<< HEAD # Stage 1: Build Stage <<<<<<< HEAD @@ -9,17 +10,14 @@ FROM rust:1.70-slim AS builder FROM rust:latest AS builder ======= # Stage 1: Builder for AMD64 +======= +# Stage 1: Builder Stage for AMD64 +>>>>>>> 8eaac98 (update conditional compilation and renames binary locationds from architecture) FROM rust:latest AS builder-amd64 >>>>>>> 88c1ea1 (refactors Dockerfile to create to builder images for compiling and adds entrypoint.sh as the entrypoint) # AS builder names this stage for easy referencing later >>>>>>> ca9ea8f (merges in changes from test branch.) -# Declare an arg for the target platform, buildx will set this value -ARG TARGETPLATFORM - -# Declare an arg for the target architecture, buildx will set this value -ARG TARGETARCH - # Set the working directory inside the container WORKDIR /usr/src/app # All subsequent commands will be executed from this directory @@ -30,9 +28,9 @@ RUN apt-get update && apt-get install -y \ build-essential \ pkg-config \ libssl-dev \ - libpq-dev \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* + libpq-dev \ + --no-install-recommends && \ + rm -rf /var/lib/apt/lists/* # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ @@ -52,26 +50,12 @@ COPY . . # Remove the target directory to ensure a clean build. RUN cargo clean -# Install cross-compliation target if needed -RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ - rustup target add x86_64-unknown-linux-gnu; \ - fi -# Conditionally add the x86_64 target if the target platform is AMD64 - # Build the Rust application in release mode for the AMD64 target -RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \ - cargo build --release --workspace --target x86_64-unknown-linux-gnu; \ - fi -# Conditionally build the release binary for the x86_64 target +RUN cargo build --release --workspace -# Stage 2: Builder for ARM64 +# Stage 2: Builder Stage for ARM64 FROM rust:latest AS builder-arm64 - -# Declare an arg for the target platform, buildx will set this value -ARG TARGETPLATFORM - -# Declare an arg for the target architecture, buildx will set this value -ARG TARGETARCH +# AS builder names this stage for easy referencing later # Set the working directory inside the container WORKDIR /usr/src/app @@ -82,16 +66,10 @@ RUN apt-get update && apt-get install -y \ bash \ build-essential \ pkg-config \ - libssl-dev \ - libpq-dev \ - --no-install-recommends \ - && rm -rf /var/lib/apt/lists/* - -# Install cross-compliation target if needed -RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ - rustup target add aarch64-unknown-linux-gnu; \ - fi -# Conditionally add the ARM64 target if the target platform is ARM64 + libssl-dev:arm64 \ + libpq-dev:arm64 \ + --no-install-recommends && \ + rm -rf /var/lib/apt/lists/* # Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ @@ -111,67 +89,34 @@ COPY . . # Remove the target directory to ensure a clean build. RUN cargo clean -# Build the Rust application in release mode for the ARM64 target -RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then \ - cargo build --release --workspace --target aarch64-unknown-linux-gnu; \ - fi -# Conditionally build the release binary for the aarch64 target +# Install cross-compliation target if needed +RUN rustup target add aarch64-unknown-linux-gnu +# Build the Rust application in release mode for the ARM64 target +RUN cargo build --release --workspace --target aarch64-unknown-linux-gnu # Stage 3: Merge the binaries FROM debian:stable-slim AS merger # Declare an arg for the target platform, buildx will set this value ARG TARGETPLATFORM - -# Declare an arg for the target architecture, buildx will set this value ARG TARGETARCH -# Set environment variables for the build process -ENV PKG_CONFIG_ALLOW_CROSS=1 -ENV OPENSSL_DIR=/usr -ENV OPENSSL_LIB_DIR=/usr/lib/aarch64-linux-gnu -ENV OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu -ENV OPENSSL_STATIC=1 - -# Install necessary runtime dependencies and clean up apt lists -RUN mkdir -p /usr/include/aarch64-linux-gnu && apt-get update && \ - apt-get install -y --no-install-recommends \ - libssl3 \ - libpq5 \ - libssl-dev \ - libpq-dev \ - ca-certificates \ - && rm -rf /var/lib/apt/lists/* - - -# Copy the AMD64 binaries from the builder-amd64 stage -COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs -COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/migration /usr/src/app/target/x86_64-unknown-linux-gnu/release/migration -COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/seed_db /usr/src/app/target/x86_64-unknown-linux-gnu/release/seed_db - -# Copy the ARM64 binaries from the builder-arm64 stage -COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs -COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration -COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db - -# Set the working directory inside the container -WORKDIR /usr/src/app - -# Create a non-root user for running the application -RUN useradd -m appuser && \ - chown -R appuser:appuser /usr/src/app && \ - chmod -R 755 /usr/src/app +WORKDIR /app -# Switch to the non-root user -USER appuser +# Copy binaries based on target architecture +COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs /app/refactor_platform_rs +COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/migration /app/migration +COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/seed_db /app/seed_db -EXPOSE ${BACKEND_PORT} +# Copy ARM64 binaries +COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs /app/refactor_platform_rs_arm64 +COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration /app/migration_arm64 +COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db /app/seed_db_arm64 -# Create a simple script to run the correct binary based on the architecture -COPY --chmod=755 entrypoint.sh /usr/src/app/entrypoint.sh -# Copy an entrypoint script and make it executable +# Add entrypoint script to select the correct binary based on architecture +COPY entrypoint.sh /entrypoint.sh +RUN chmod +x /entrypoint.sh -ENTRYPOINT ["entrypoint.sh"] -# Set the entry point to the script that selects the correct binary +ENTRYPOINT ["/entrypoint.sh"] From b90bb3bee85ae6130e5ce0796881850078b033f7 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Mon, 17 Mar 2025 21:26:50 -0400 Subject: [PATCH 48/74] updates entrypoint.sh to match new binary locations from docker image --- entrypoint.sh | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 6a665032..99493348 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,29 +1,29 @@ #!/bin/sh set -euo pipefail -case "$(uname -m)" in - x86_64) +# determine the architecture of the host machine +ARCH=$(uname -m) + +# select the binary based on the architecture +if [ "$ARCH" = "x86_64" ]; then echo "Executing AMD64 binary" - exec /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs \ + exec /app/refactor_platform_rs \ -l "$BACKEND_LOG_FILTER_LEVEL" \ -i "$BACKEND_INTERFACE" \ -p "$BACKEND_PORT" \ -d "$DATABASE_URL" \ --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ "$@" - ;; - aarch64) +elif [ "$ARCH" = "aarch64" ]; then echo "Executing ARM64 binary" - exec /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs \ + exec /app/refactor_platform_rs_arm64 \ -l "$BACKEND_LOG_FILTER_LEVEL" \ -i "$BACKEND_INTERFACE" \ -p "$BACKEND_PORT" \ -d "$DATABASE_URL" \ - --allowed-origins="$BACKEND_ALLOWED_ORIGINS"\ + --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ "$@" - ;; - *) +else echo "Unsupported architecture: $(uname -m)" >&2 exit 1 - ;; -esac \ No newline at end of file +fi From 10cc989fac55c12d0cd9d39b8a614e8350ed3554 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Mon, 17 Mar 2025 21:33:47 -0400 Subject: [PATCH 49/74] adds dpkg multi arch repo to dockerfile in second builder --- Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 8149c38c..2f9293ba 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,8 +61,14 @@ FROM rust:latest AS builder-arm64 WORKDIR /usr/src/app # All subsequent commands will be executed from this directory +# Enable multiarch support +RUN dpkg --add-architecture arm64 + +# Update apt repositories +RUN apt-get update + # Install necessary packages for building Rust projects with PostgreSQL dependencies -RUN apt-get update && apt-get install -y \ +RUN apt-get install -y \ bash \ build-essential \ pkg-config \ From 7637b80cebf2ec8d110674edb047c7e78eef6167 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Tue, 18 Mar 2025 13:58:22 -0400 Subject: [PATCH 50/74] removes dpkg installation and arm package specification from builder 2 in Dockerfile --- Dockerfile | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 2f9293ba..2734ce05 100644 --- a/Dockerfile +++ b/Dockerfile @@ -61,9 +61,6 @@ FROM rust:latest AS builder-arm64 WORKDIR /usr/src/app # All subsequent commands will be executed from this directory -# Enable multiarch support -RUN dpkg --add-architecture arm64 - # Update apt repositories RUN apt-get update @@ -72,8 +69,8 @@ RUN apt-get install -y \ bash \ build-essential \ pkg-config \ - libssl-dev:arm64 \ - libpq-dev:arm64 \ + libssl-dev \ + libpq-dev \ --no-install-recommends && \ rm -rf /var/lib/apt/lists/* From 08da19833c727841c6353b5ecaca394c48dc10ac Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Tue, 18 Mar 2025 14:06:05 -0400 Subject: [PATCH 51/74] adds modified Cargo.lock file --- Cargo.lock | 112 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 39 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 49a5e059..cb165659 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -487,9 +487,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5430e3be710b68d984d1391c854eb431a9d548640711faa54eecb1df93db91cc" +checksum = "b2b74d67a0fc0af8e9823b79fd1c43a0900e5a8f0e0f4cc9210796bf3a820126" dependencies = [ "borsh-derive", "cfg_aliases", @@ -497,9 +497,9 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.5" +version = "1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8b668d39970baad5356d7c83a86fee3a539e6f93bf6764c97368243e17a0487" +checksum = "2d37ed1b2c9b78421218a0b4f6d8349132d6ec2cfeba1cfb0118b0a8e268df9e" dependencies = [ "once_cell", "proc-macro-crate", @@ -786,9 +786,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.11" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", "serde", @@ -1153,9 +1153,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", ] [[package]] @@ -1839,7 +1841,7 @@ dependencies = [ "num-integer", "num-iter", "num-traits", - "rand", + "rand 0.8.5", "smallvec", "zeroize", ] @@ -2025,7 +2027,7 @@ dependencies = [ "argon2", "getrandom 0.2.15", "password-hash", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -2035,7 +2037,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "346f04948ba92c43e8469c1ee6736c7563d71012b17d40745260fe106aac2166" dependencies = [ "base64ct", - "rand_core", + "rand_core 0.6.4", "subtle", ] @@ -2274,11 +2276,12 @@ dependencies = [ [[package]] name = "quinn" -version = "0.11.6" +version = "0.11.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62e96808277ec6f97351a2380e6c25114bc9e67037775464979f3037c92d05ef" +checksum = "c3bd15a6f2967aef83887dcb9fec0014580467e33720d073560cf015a5683012" dependencies = [ "bytes", + "cfg_aliases", "pin-project-lite", "quinn-proto", "quinn-udp", @@ -2288,17 +2291,18 @@ dependencies = [ "thiserror 2.0.12", "tokio", "tracing", + "web-time", ] [[package]] name = "quinn-proto" -version = "0.11.9" +version = "0.11.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2fe5ef3495d7d2e377ff17b1a8ce2ee2ec2a18cde8b6ad6619d65d0701c135d" +checksum = "b820744eb4dc9b57a3398183639c511b5a26d2ed702cedd3febaa1393caa22cc" dependencies = [ "bytes", - "getrandom 0.2.15", - "rand", + "getrandom 0.3.2", + "rand 0.9.0", "ring", "rustc-hash", "rustls", @@ -2352,8 +2356,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ "libc", - "rand_chacha", - "rand_core", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3779b94aeb87e8bd4e834cee3650289ee9e0d5677f976ecdb6d219e5f4f6cd94" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", + "zerocopy", ] [[package]] @@ -2363,7 +2378,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", ] [[package]] @@ -2375,6 +2400,15 @@ dependencies = [ "getrandom 0.2.15", ] +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.2", +] + [[package]] name = "redox_syscall" version = "0.5.10" @@ -2452,9 +2486,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.14" +version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e327e510263980e231de548a33e63d34962d29ae61b467389a1a09627a254" +checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" dependencies = [ "base64", "bytes", @@ -2579,7 +2613,7 @@ dependencies = [ "num-traits", "pkcs1", "pkcs8", - "rand_core", + "rand_core 0.6.4", "signature", "spki", "subtle", @@ -2596,7 +2630,7 @@ dependencies = [ "borsh", "bytes", "num-traits", - "rand", + "rand 0.8.5", "rkyv", "serde", "serde_json", @@ -2629,9 +2663,9 @@ dependencies = [ [[package]] name = "rustix" -version = "1.0.2" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7178faa4b75a30e269c71e61c353ce2748cf3d76f0c44c393f4e60abf49b825" +checksum = "e56a18552996ac8d29ecc3b190b4fdbb2d91ca4ec396de7bbffaf43f3d637e96" dependencies = [ "bitflags", "errno", @@ -3032,7 +3066,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest", - "rand_core", + "rand_core 0.6.4", ] [[package]] @@ -3246,7 +3280,7 @@ dependencies = [ "memchr", "once_cell", "percent-encoding", - "rand", + "rand 0.8.5", "rsa", "rust_decimal", "serde", @@ -3290,7 +3324,7 @@ dependencies = [ "memchr", "num-bigint", "once_cell", - "rand", + "rand 0.8.5", "rust_decimal", "serde", "serde_json", @@ -3450,7 +3484,7 @@ dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", - "rustix 1.0.2", + "rustix 1.0.3", "windows-sys 0.59.0", ] @@ -3515,9 +3549,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.39" +version = "0.3.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dad298b01a40a23aac4580b67e3dbedb7cc8402f3592d7f49469de2ea4aecdd8" +checksum = "9d9c75b47bdff86fa3334a3db91356b8d7d86a9b839dab7d0bdc5c3d3a077618" dependencies = [ "deranged", "itoa", @@ -3532,15 +3566,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "765c97a5b985b7c11d7bc27fa927dc4fe6af3a6dfb021d28deb60d3bf51e76ef" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.20" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8093bc3e81c3bc5f7879de09619d06c9a5a5e45ca44dfeeb7225bae38005c5c" +checksum = "29aa485584182073ed57fd5004aa09c371f021325014694e432313345865fd04" dependencies = [ "num-conv", "time-core", @@ -3761,7 +3795,7 @@ dependencies = [ "futures", "http", "parking_lot", - "rand", + "rand 0.8.5", "serde", "serde_json", "thiserror 1.0.69", @@ -4189,9 +4223,9 @@ dependencies = [ [[package]] name = "windows-link" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6dccfd733ce2b1753b03b6d3c65edf020262ea35e20ccdf3e288043e6dd620e3" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" [[package]] name = "windows-registry" @@ -4206,9 +4240,9 @@ dependencies = [ [[package]] name = "windows-result" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06374efe858fab7e4f881500e6e86ec8bc28f9462c47e5a9941a0142ad86b189" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ "windows-link", ] From 85c245ab0e897e3001e19d3068582a661de32227 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Tue, 18 Mar 2025 15:01:06 -0400 Subject: [PATCH 52/74] adds ENV vars to dynamically locate the compiler dependent on architecture. --- entrypoint.sh | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 99493348..9af7e549 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,29 +1,35 @@ #!/bin/sh set -euo pipefail -# determine the architecture of the host machine +# Determine the architecture of the host machine ARCH=$(uname -m) -# select the binary based on the architecture +# Set Rust linker for ARM64 if needed +if [ "$ARCH" = "aarch64" ]; then + export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc + export RUSTFLAGS="-C link-arg=-L/usr/lib/aarch64-linux-gnu" +fi + +# Select the binary based on the architecture if [ "$ARCH" = "x86_64" ]; then - echo "Executing AMD64 binary" - exec /app/refactor_platform_rs \ - -l "$BACKEND_LOG_FILTER_LEVEL" \ - -i "$BACKEND_INTERFACE" \ - -p "$BACKEND_PORT" \ - -d "$DATABASE_URL" \ - --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ - "$@" + echo "Executing AMD64 binary" + exec /app/refactor_platform_rs \ + -l "$BACKEND_LOG_FILTER_LEVEL" \ + -i "$BACKEND_INTERFACE" \ + -p "$BACKEND_PORT" \ + -d "$DATABASE_URL" \ + --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ + "$@" elif [ "$ARCH" = "aarch64" ]; then - echo "Executing ARM64 binary" - exec /app/refactor_platform_rs_arm64 \ - -l "$BACKEND_LOG_FILTER_LEVEL" \ - -i "$BACKEND_INTERFACE" \ - -p "$BACKEND_PORT" \ - -d "$DATABASE_URL" \ - --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ - "$@" + echo "Executing ARM64 binary" + exec /app/refactor_platform_rs_arm64 \ + -l "$BACKEND_LOG_FILTER_LEVEL" \ + -i "$BACKEND_INTERFACE" \ + -p "$BACKEND_PORT" \ + -d "$DATABASE_URL" \ + --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ + "$@" else - echo "Unsupported architecture: $(uname -m)" >&2 - exit 1 + echo "Unsupported architecture: $(uname -m)" >&2 + exit 1 fi From cf21522bcb39ac12c4e8cdd85346bb91e3e8c856 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Tue, 18 Mar 2025 20:01:09 -0400 Subject: [PATCH 53/74] adds openssl-sys crate --- Cargo.lock | 1 + Cargo.toml | 1 + 2 files changed, 2 insertions(+) diff --git a/Cargo.lock b/Cargo.lock index cb165659..dd8ab71e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2425,6 +2425,7 @@ dependencies = [ "clap", "entity_api", "log", + "openssl-sys", "service", "simplelog", "tokio", diff --git a/Cargo.toml b/Cargo.toml index cc8af5c8..5a9c50c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ clap = { version = "4.5.20", features = ["cargo", "derive", "env"] } log = "0.4.22" simplelog = { version = "0.12.2", features = ["paris"] } tokio = "1.41.0" +openssl-sys = "0.9.106" [[bin]] name = "seed_db" From cbc8e1609f3cfba46525a150ee18496eac4aa437 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Tue, 18 Mar 2025 21:44:23 -0400 Subject: [PATCH 54/74] adds vendored feature for openssl-sys, adds cross. --- Cargo.lock | 10 ++++++++++ Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index dd8ab71e..49f4e2f2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1938,6 +1938,15 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" +[[package]] +name = "openssl-src" +version = "300.4.2+3.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "168ce4e058f975fe43e89d9ccf78ca668601887ae736090aacc23ae353c298e2" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.106" @@ -1946,6 +1955,7 @@ checksum = "8bb61ea9811cc39e3c2069f40b8b8e2e70d8569b361f879786cc7ed48b777cdd" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/Cargo.toml b/Cargo.toml index 5a9c50c9..1f5a0c5b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ clap = { version = "4.5.20", features = ["cargo", "derive", "env"] } log = "0.4.22" simplelog = { version = "0.12.2", features = ["paris"] } tokio = "1.41.0" -openssl-sys = "0.9.106" +openssl-sys = { version = "0.9.106", features = ["vendored"] } [[bin]] name = "seed_db" From 3e9c3cee4ec9768f20aca27e8d39078cd0fac019 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 21 Mar 2025 17:10:19 -0400 Subject: [PATCH 55/74] refactor GitHub Actions ci workflow to simplify cache key for dependencies --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b173bf2f..2c8ecc62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - name: Use cached dependencies uses: Swatinem/rust-cache@v2 with: - key: "ubuntu-22.04-x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu" + key: "ubuntu-22.04-x86_64-and-aarch64" - name: Set OpenSSL Paths run: | From b651c48dc65cac7d840c372f3c51a03736ea2373 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 21 Mar 2025 17:16:49 -0400 Subject: [PATCH 56/74] adds badge for image build and storage workflow in README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 1a1b8b9f..ee7d8327 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![Build & Tests (backend)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml) +[![Image Build & Stored](https://github.com/refactor-group/refactor-platform-rs/actions/workflows/build_and_deploy_containers.yml/badge.svg)](https://github.com/refactor-group/refactor-platform-rs/actions/workflows/build_and_deploy_containers.yml) # Refactor Coaching & Mentoring Platform From 5ef2ba6bdfb300e767c3f074207b352ceb195cc5 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 11:46:39 -0400 Subject: [PATCH 57/74] refactor Dockerfile and related configurations for improved multi-platform support and cleanup --- .../workflows/build_and_deploy_containers.yml | 268 +----------------- Cargo.lock | 95 +++---- Dockerfile | 120 ++------ build_and_run.sh | 2 +- docker-compose.yaml | 20 +- entity_api/Cargo.toml | 5 - web/Cargo.toml | 6 - 7 files changed, 67 insertions(+), 449 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index ecbb811a..b6848c11 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -1,9 +1,7 @@ name: Build and Deploy Containers -# Trigger on push events to branches with open PRs on: push: -<<<<<<< HEAD branches: - main pull_request: @@ -11,50 +9,13 @@ on: - main types: [opened, synchronize, reopened] workflow_dispatch: -======= - branches: - - main - pull_request: -<<<<<<< HEAD - types: [opened, synchronize, reopened] # Run when PRs are opened, updated, or reopened - workflow_dispatch: # Allow manual triggering from any branch ->>>>>>> ca9ea8f (merges in changes from test branch.) - -# Global env vars available to all jobs -env: -<<<<<<< HEAD - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} -======= - REGISTRY: ghcr.io # GitHub Container Registry URL - IMAGE_NAME: ${{ github.repository }} # Uses the format org/repo-name - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} # GH token for authentication - BACKEND_IMAGE_NAME: rust-backend # Backend Image name - FRONTEND_IMAGE_NAME: nextjs-frontend # Frontend Image name ->>>>>>> ca9ea8f (merges in changes from test branch.) -======= - types: [opened, synchronize, reopened] - workflow_dispatch: -# Global env vars available to all jobs env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BACKEND_IMAGE_NAME: rust-backend - FRONTEND_IMAGE_NAME: nextjs-frontend -<<<<<<< HEAD -<<<<<<< HEAD ->>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) -======= - OPENSSL_DIR: /usr/local/ssl ->>>>>>> b96710a (adds openssl dependencies for cross compilation to Dockerfile and gh actions workflow.) -======= ->>>>>>> baa751f (adds support for aarch64 architecture in CI workflow by updating Rust toolchain targets and cache key) jobs: build_test_run: -<<<<<<< HEAD runs-on: ubuntu-22.04 steps: @@ -104,9 +65,6 @@ jobs: build_and_push_docker: runs-on: ubuntu-22.04 needs: build_test_run -======= - name: Build and Test - runs-on: ubuntu-22.04 permissions: contents: read packages: write @@ -114,128 +72,11 @@ jobs: id-token: write steps: - # Checkout code and print current branch/PR info for transparency - - name: Checkout and Print Context - uses: actions/checkout@v4 - - run: | - echo "📋 Workflow Context:" - echo " Branch: $GITHUB_REF" - echo " Event: $GITHUB_EVENT_NAME" - echo " PR Number: $GITHUB_PULL_REQUEST" - - # Set env vars from GitHub Secrets - - name: Set environment variables - run: | - echo "🔑 Setting environment variables..." - # Database connection parameters - echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> $GITHUB_ENV - echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> $GITHUB_ENV - echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV - echo "POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" >> $GITHUB_ENV - echo "POSTGRES_SCHEMA=${{ secrets.POSTGRES_SCHEMA }}" >> $GITHUB_ENV - echo "POSTGRES_HOST=${{ secrets.POSTGRES_HOST }}" >> $GITHUB_ENV - echo "DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}" >> $GITHUB_ENV - echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV - echo "OPENSSL_LIB_DIR=/usr/aarch64-linux-gnu/lib" >> $GITHUB_ENV - echo "OPENSSL_INCLUDE_DIR=/usr/include/aarch64-linux-gnu" >> $GITHUB_ENV - - - name: Set up QEMU - uses: docker/setup-qemu-action@v2 - with: - platforms: linux/amd64,linux/arm64 - - # Install Rust toolchain - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@stable - with: - targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu - - # Cache Rust dependencies for faster builds - - name: Use cached dependencies - uses: Swatinem/rust-cache@v2 - with: - key: "ubuntu-22.04-x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu" - - # Cache Rust dependencies for faster builds - - name: Use cached dependencies - uses: Swatinem/rust-cache@v2 - with: - key: "aarch64-unknown-linux-gnu" - - # Install seaORM CLI for database migrations - - name: Install seaORM CLI - run: cargo install sea-orm-cli - - # Build all project targets - - name: Build - run: cargo build --all-targets --release --workspace --target aarch64-unknown-linux-gnu - - # Run all tests to ensure code quality - - name: Test - run: cargo test --release # Ensure tests are run in release mode - - - name: Clean and Rebuild - run: | - cargo clean - CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER="aarch64-linux-gnu-gcc" cargo build --release --workspace --target aarch64-unknown-linux-gnu - - build_and_push_docker: - name: Build and Push Docker Images -<<<<<<< HEAD - runs-on: ubuntu-22.04 - needs: build_test_run # Only run this job if the first job succeeds - - # Adds permissions for the job - # This is needed for the attestations to work ->>>>>>> ca9ea8f (merges in changes from test branch.) -======= - runs-on: ubuntu-22.04 - needs: build_test_run ->>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) - permissions: - contents: read - packages: write - attestations: write - id-token: write - - steps: -<<<<<<< HEAD -<<<<<<< HEAD # Checkout source code - uses: actions/checkout@v4 # Authenticate to GitHub Container Registry - name: Docker login -======= - # Checkout the code -======= - # Checkout code and print current branch/PR info ->>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) - - name: Checkout - uses: actions/checkout@v4 - - run: | - echo "📋 Workflow Context:" - echo " Branch: $GITHUB_REF" - echo " Event: $GITHUB_EVENT_NAME" - echo " PR Number: $GITHUB_PULL_REQUEST" - - # Set env vars for this job - - name: Set environment variables - run: | - echo "🔑 Setting environment variables..." - # Only set variables not inherited from previous job - echo "DATABASE_URL=postgres://${{ secrets.POSTGRES_USER }}:${{ secrets.POSTGRES_PASSWORD }}@${{ secrets.POSTGRES_HOST }}:${{ secrets.POSTGRES_PORT }}/${{ secrets.POSTGRES_DB }}" >> $GITHUB_ENV - echo "BACKEND_PORT=${{ secrets.BACKEND_PORT }}" >> $GITHUB_ENV - echo "BACKEND_INTERFACE=${{ secrets.BACKEND_INTERFACE }}" >> $GITHUB_ENV - echo "BACKEND_ALLOWED_ORIGINS=${{ secrets.BACKEND_ALLOWED_ORIGINS }}" >> $GITHUB_ENV - echo "BACKEND_LOG_FILTER_LEVEL=${{ secrets.BACKEND_LOG_FILTER_LEVEL }}" >> $GITHUB_ENV - echo "TIPTAP_URL=${{ secrets.TIPTAP_URL }}" >> $GITHUB_ENV - echo "TIPTAP_AUTH_KEY=${{ secrets.TIPTAP_AUTH_KEY }}" >> $GITHUB_ENV - echo "TIPTAP_JWT_SIGNING_KEY=${{ secrets.TIPTAP_JWT_SIGNING_KEY }}" >> $GITHUB_ENV - - # Log in to GitHub Container Registry - - name: Log in to the Container registry ->>>>>>> ca9ea8f (merges in changes from test branch.) uses: docker/login-action@v2 with: registry: ${{ env.REGISTRY }} @@ -243,7 +84,6 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} # Set up Docker Buildx for multi-platform builds -<<<<<<< HEAD - uses: docker/setup-buildx-action@v3 with: install: true @@ -299,110 +139,4 @@ jobs: echo " docker pull ${{ steps.tags.outputs.backend_image_name }}:latest" echo "" echo -e "\033[1;36m▶️ Run Backend:\033[0m" - echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" -======= - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - # Cache Docker layers to speed up subsequent builds - - name: Cache Docker layers - uses: actions/cache@v4 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- - enableCrossOsArchive: true - - # Extract metadata for Docker images (tags, labels) - - name: Extract metadata (tags, labels) for Docker - id: meta - uses: docker/metadata-action@v4 - with: - images: | - ${{ env.REGISTRY }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - ${{ env.REGISTRY }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - - # Build and push the Rust backend image - - name: Build and Push Rust Backend Image - id: push_backend - uses: docker/build-push-action@v6 - with: - # Explicitly specify the Dockerfile path - file: ./Dockerfile - platforms: linux/amd64,linux/arm64 - context: . - push: true - tags: | - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - - # Build and push the Next.js frontend image - - name: Build and Push Next.js Frontend Image - id: push_frontend - uses: docker/build-push-action@v6 - with: - build-args: | - BACKEND_URL=${{ secrets.BACKEND_URL }} - BACKEND_PORT=${{ secrets.BACKEND_PORT }} - platforms: linux/amd64,linux/arm64 - context: web - push: true - tags: | - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest - ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:${{ github.sha }} - labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache-new - - # Move new cache to the original location for future jobs - - name: Move new cache - run: | - echo "🔄 Moving new cache..." - rm -rf /tmp/.buildx-cache - mv /tmp/.buildx-cache-new /tmp/.buildx-cache - - # Generate artifact attestation for security and supply chain integrity - - name: Generate artifact attestation for Rust Backend Image - uses: actions/attest-build-provenance@v2 - with: - subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }} - subject-digest: ${{ steps.push_backend.outputs.digest }} - push-to-registry: true - - # Generate artifact attestation for Next.js Frontend Image - - name: Generate artifact attestation for Next.js Frontend Image - uses: actions/attest-build-provenance@v2 - with: - subject-name: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }} -<<<<<<< HEAD - subject-digest: ${{ steps.push_frontend.outputs.digest }} # Use the digest output from build - push-to-registry: true # Push attestation to registry ->>>>>>> ca9ea8f (merges in changes from test branch.) -======= - subject-digest: ${{ steps.push_frontend.outputs.digest }} - push-to-registry: true - - # Print artifacts and usage commands - - name: Print artifacts and usage commands - run: | - echo "📦 Built and pushed images:" - echo " Backend: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" - echo " Frontend: ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" - echo "" - echo "🔑 Login command:" - echo " echo $GITHUB_TOKEN | docker login ${{ env.REGISTRY }} -u $GITHUB_ACTOR --password-stdin" - echo "" - echo "📥 Pull commands:" - echo " docker pull ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" - echo " docker pull ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" - echo "" - echo "📤 Push commands:" - echo " docker tag ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" - echo " docker tag ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" - echo " docker push ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.BACKEND_IMAGE_NAME }}-${{ github.actor }}:latest" - echo " docker push ${{ env.REGISTRY }}/${{ github.repository }}/${{ env.FRONTEND_IMAGE_NAME }}-${{ github.actor }}:latest" ->>>>>>> 4c4ef94 (updates build and deploy container gh actions workflow) + echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 49f4e2f2..f50914a7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -487,9 +487,9 @@ dependencies = [ [[package]] name = "borsh" -version = "1.5.6" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b74d67a0fc0af8e9823b79fd1c43a0900e5a8f0e0f4cc9210796bf3a820126" +checksum = "ad8646f98db542e39fc66e68a20b2144f6a732636df7c2354e74645faaa433ce" dependencies = [ "borsh-derive", "cfg_aliases", @@ -497,9 +497,9 @@ dependencies = [ [[package]] name = "borsh-derive" -version = "1.5.6" +version = "1.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d37ed1b2c9b78421218a0b4f6d8349132d6ec2cfeba1cfb0118b0a8e268df9e" +checksum = "fdd1d3c0c2f5833f22386f252fe8ed005c7f59fdcddeef025c01b4c3b9fd9ac3" dependencies = [ "once_cell", "proc-macro-crate", @@ -550,9 +550,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.16" +version = "1.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be714c154be609ec7f5dad223a33bf1482fff90472de28f7362806e6d4832b8c" +checksum = "1fcb57c740ae1daf453ae85f16e37396f672b039e00d9d866e07ddb24e328e3a" dependencies = [ "shlex", ] @@ -586,9 +586,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.32" +version = "4.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6088f3ae8c3608d19260cd7445411865a485688711b78b5be70d78cd96136f83" +checksum = "e958897981290da2a852763fe9cdb89cd36977a5d729023127095fa94d95e2ff" dependencies = [ "clap_builder", "clap_derive", @@ -596,9 +596,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.32" +version = "4.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22a7ef7f676155edfb82daa97f99441f3ebf4a58d5e32f295a56259f1b6facc8" +checksum = "83b0f35019843db2160b5bb19ae09b4e6411ac33fc6a712003c33e03090e2489" dependencies = [ "anstream", "anstyle", @@ -786,9 +786,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +checksum = "28cfac68e08048ae1883171632c2aef3ebc555621ae56fbccce1cbf22dd7f058" dependencies = [ "powerfmt", "serde", @@ -871,7 +871,6 @@ version = "1.0.0-beta1" dependencies = [ "axum-login", "chrono", - "libsqlite3-sys", "sea-orm", "serde", "sqlx", @@ -945,9 +944,9 @@ dependencies = [ [[package]] name = "event-listener-strategy" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c3e4e0dd3673c1139bf041f3008816d9cf2946bbfac2945c09e523b8d7b05b2" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" dependencies = [ "event-listener 5.4.0", "pin-project-lite", @@ -1411,14 +1410,15 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.61" +version = "0.1.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "235e081f3925a06703c2d0117ea8b91f042756fd6e7a6e5d901e8ca1a996b220" +checksum = "b2fd658b06e56721792c5df4475705b6cda790e9298d19d2f8af083457bcd127" dependencies = [ "android_system_properties", "core-foundation-sys", "iana-time-zone-haiku", "js-sys", + "log", "wasm-bindgen", "windows-core", ] @@ -1473,9 +1473,9 @@ dependencies = [ [[package]] name = "icu_locid_transform_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdc8ff3388f852bede6b579ad4e978ab004f139284d7b28715f773507b946f6e" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" [[package]] name = "icu_normalizer" @@ -1497,9 +1497,9 @@ dependencies = [ [[package]] name = "icu_normalizer_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8cafbf7aa791e9b22bec55a167906f9e1215fd475cd22adfcf660e03e989516" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" [[package]] name = "icu_properties" @@ -1518,9 +1518,9 @@ dependencies = [ [[package]] name = "icu_properties_data" -version = "1.5.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67a8effbc3dd3e4ba1afa8ad918d5684b8868b3b26500753effea8d2eed19569" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" [[package]] name = "icu_provider" @@ -1719,9 +1719,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.26" +version = "0.4.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30bde2b3dc3671ae49d8e2e9f044c7c005836e7a023ee57cffa25ab82764bb9e" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" dependencies = [ "value-bag", ] @@ -1902,9 +1902,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.1" +version = "1.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d75b0bedcc4fe52caa0e03d9f1151a323e4aa5e2d78ba3580400cd3c9e2bc4bc" +checksum = "c2806eaa3524762875e21c3dcd057bc4b7bfa01ce4da8d46be1cd43649e1cc6b" [[package]] name = "openssl" @@ -2326,9 +2326,9 @@ dependencies = [ [[package]] name = "quinn-udp" -version = "0.5.10" +version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e46f3055866785f6b92bc6164b76be02ca8f2eb4b002c0354b28cf4c119e5944" +checksum = "541d0f57c6ec747a90738a52741d3221f7960e8ac2f0ff4b1a63680e033b4ab5" dependencies = [ "cfg_aliases", "libc", @@ -2633,9 +2633,9 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.37.0" +version = "1.37.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c24af6e7ac43c88a8a458d1139d0246fdce2f6cd2f1ac6cb51eb88b29c978af" +checksum = "faa7de2ba56ac291bd90c6b9bece784a52ae1411f9506544b3eae36dd2356d50" dependencies = [ "arrayvec", "borsh", @@ -2719,9 +2719,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.0" +version = "0.103.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa4eeac2588ffff23e9d7a7e9b3f971c5fb5b7ebc9452745e0c232c64f83b2f" +checksum = "fef8b8769aaccf73098557a87cd1816b4f9c7c16811c9c77142aa695c16f2c03" dependencies = [ "ring", "rustls-pki-types", @@ -3488,9 +3488,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.19.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "488960f40a3fd53d72c2a29a58722561dee8afdd175bd88e3db4677d7b2ba600" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ "fastrand", "getrandom 0.3.2", @@ -3560,9 +3560,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.40" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d9c75b47bdff86fa3334a3db91356b8d7d86a9b839dab7d0bdc5c3d3a077618" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", "itoa", @@ -3583,9 +3583,9 @@ checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.21" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29aa485584182073ed57fd5004aa09c371f021325014694e432313345865fd04" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", @@ -4030,9 +4030,9 @@ dependencies = [ [[package]] name = "value-bag" -version = "1.10.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ef4c4aa54d5d05a279399bfa921ec387b7aba77caf7a682ae8d86785b8fdad2" +checksum = "943ce29a8a743eb10d6082545d861b24f9d1b160b7d741e0f2cdf726bec909c5" [[package]] name = "vcpkg" @@ -4156,7 +4156,6 @@ dependencies = [ "axum-login", "chrono", "domain", - "entity_api", "log", "password-auth", "reqwest", @@ -4206,9 +4205,9 @@ dependencies = [ [[package]] name = "whoami" -version = "1.5.2" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "372d5b87f58ec45c384ba03563b03544dc5fadc3983e434b286913f5b4a9bb6d" +checksum = "6994d13118ab492c3c80c1f81928718159254c53c472bf9ce36f8dae4add02a7" dependencies = [ "redox_syscall", "wasite", @@ -4550,18 +4549,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd97444d05a4328b90e75e503a34bad781f14e28a823ad3557f0750df1ebcbc6" +checksum = "2586fea28e186957ef732a5f8b3be2da217d65c5969d4b1e17f973ebbe876879" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.23" +version = "0.8.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6352c01d0edd5db859a63e2605f4ea3183ddbd15e2c4a9e7d32184df75e4f154" +checksum = "a996a8f63c5c4448cd959ac1bab0aaa3306ccfd060472f85943ee0750f0169be" dependencies = [ "proc-macro2", "quote", diff --git a/Dockerfile b/Dockerfile index 2734ce05..47f256c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,125 +1,39 @@ -# syntax=docker/dockerfile:1 -# Specify the Dockerfile syntax version +# syntax=docker/dockerfile:1.4 -<<<<<<< HEAD -<<<<<<< HEAD -# Stage 1: Build Stage -<<<<<<< HEAD -FROM rust:1.70-slim AS builder -======= -FROM rust:latest AS builder -======= -# Stage 1: Builder for AMD64 -======= -# Stage 1: Builder Stage for AMD64 ->>>>>>> 8eaac98 (update conditional compilation and renames binary locationds from architecture) -FROM rust:latest AS builder-amd64 ->>>>>>> 88c1ea1 (refactors Dockerfile to create to builder images for compiling and adds entrypoint.sh as the entrypoint) -# AS builder names this stage for easy referencing later ->>>>>>> ca9ea8f (merges in changes from test branch.) +# Stage 1: Build Rust app on platform-specific image +FROM --platform=${BUILDPLATFORM} rust:bullseye AS builder -# Set the working directory inside the container -WORKDIR /usr/src/app -# All subsequent commands will be executed from this directory - -# Install necessary packages for building Rust projects with PostgreSQL dependencies RUN apt-get update && apt-get install -y \ - bash \ - build-essential \ - pkg-config \ - libssl-dev \ - libpq-dev \ - --no-install-recommends && \ - rm -rf /var/lib/apt/lists/* - -# Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure -COPY Cargo.toml Cargo.lock ./ -# Copy the workspace manifest and lock file. Docker caches layers, so copying these first -# allows Docker to cache dependencies if these files don't change. - -# Copy each module's Cargo.toml to maintain the workspace structure -COPY ./entity/Cargo.toml ./entity/Cargo.toml -COPY ./entity_api/Cargo.toml ./entity_api/Cargo.toml -COPY ./migration/Cargo.toml ./migration/Cargo.toml -COPY ./service/Cargo.toml ./service/Cargo.toml -COPY ./web/Cargo.toml ./web/Cargo.toml - -# Copy the complete source code into the container's working directory -COPY . . - -# Remove the target directory to ensure a clean build. -RUN cargo clean + build-essential pkg-config libssl-dev libpq-dev curl git \ + --no-install-recommends && rm -rf /var/lib/apt/lists/* -# Build the Rust application in release mode for the AMD64 target -RUN cargo build --release --workspace - -# Stage 2: Builder Stage for ARM64 -FROM rust:latest AS builder-arm64 -# AS builder names this stage for easy referencing later - -# Set the working directory inside the container WORKDIR /usr/src/app -# All subsequent commands will be executed from this directory - -# Update apt repositories -RUN apt-get update -# Install necessary packages for building Rust projects with PostgreSQL dependencies -RUN apt-get install -y \ - bash \ - build-essential \ - pkg-config \ - libssl-dev \ - libpq-dev \ - --no-install-recommends && \ - rm -rf /var/lib/apt/lists/* - -# Copy the main workspace Cargo.toml and Cargo.lock to define workspace structure COPY Cargo.toml Cargo.lock ./ -# Copy the workspace manifest and lock file. Docker caches layers, so copying these first -# allows Docker to cache dependencies if these files don't change. - -# Copy each module's Cargo.toml to maintain the workspace structure COPY ./entity/Cargo.toml ./entity/Cargo.toml COPY ./entity_api/Cargo.toml ./entity_api/Cargo.toml COPY ./migration/Cargo.toml ./migration/Cargo.toml COPY ./service/Cargo.toml ./service/Cargo.toml COPY ./web/Cargo.toml ./web/Cargo.toml - -# Copy the complete source code into the container's working directory COPY . . -# Remove the target directory to ensure a clean build. -RUN cargo clean - -# Install cross-compliation target if needed -RUN rustup target add aarch64-unknown-linux-gnu - -# Build the Rust application in release mode for the ARM64 target -RUN cargo build --release --workspace --target aarch64-unknown-linux-gnu - -# Stage 3: Merge the binaries -FROM debian:stable-slim AS merger +RUN cargo build --release --workspace -# Declare an arg for the target platform, buildx will set this value -ARG TARGETPLATFORM -ARG TARGETARCH +# Stage 2: Minimal runtime image using non-root user +FROM debian:bullseye-slim +RUN useradd -m -s /bin/bash appuser WORKDIR /app -# Copy binaries based on target architecture -COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/refactor_platform_rs /app/refactor_platform_rs -COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/migration /app/migration -COPY --from=builder-amd64 /usr/src/app/target/x86_64-unknown-linux-gnu/release/seed_db /app/seed_db - -# Copy ARM64 binaries -COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/refactor_platform_rs /app/refactor_platform_rs_arm64 -COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/migration /app/migration_arm64 -COPY --from=builder-arm64 /usr/src/app/target/aarch64-unknown-linux-gnu/release/seed_db /app/seed_db_arm64 +COPY --from=builder /usr/src/app/target/release/refactor_platform_rs . +COPY --from=builder /usr/src/app/target/release/migration . +COPY --from=builder /usr/src/app/target/release/seed_db . -# Add entrypoint script to select the correct binary based on architecture COPY entrypoint.sh /entrypoint.sh -RUN chmod +x /entrypoint.sh +RUN chmod +x /entrypoint.sh && chown -R appuser:appuser /app /entrypoint.sh + +USER appuser -ENTRYPOINT ["/entrypoint.sh"] +EXPOSE 8000 +ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file diff --git a/build_and_run.sh b/build_and_run.sh index 9e634966..7f377bf6 100755 --- a/build_and_run.sh +++ b/build_and_run.sh @@ -25,4 +25,4 @@ docker-compose --env-file="${ENV_FILE}" up --build -d echo "Docker containers are up and running on your localhost." echo "To view logs, run: docker-compose logs -f" -echo "To stop the containers, run: docker-compose down" +echo "To stop the containers, run: docker-compose down" \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index 92e23a86..8ff89b12 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -10,15 +10,9 @@ services: ports: - "${POSTGRES_PORT}:5432" # Map host port to container's PostgreSQL port volumes: -<<<<<<< HEAD - - db_data:/var/lib/postgresql/data # Persist PostgreSQL data - - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql # Initialize database with setup.sql - - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_platform_rs.sql # Initialize with refactor_platform_rs.sql -======= - postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql # Initialize database with setup.sql - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_plaform_rs.sql # Initialize with refactor_platform_rs.sql ->>>>>>> ca9ea8f (merges in changes from test branch.) - ./migration/src/setup_default_user.sql:/docker-entrypoint-initdb.d/2-setup_default_user.sql # Initialize with setup_default_user.sql networks: - backend_network # Connect to backend_network @@ -47,11 +41,6 @@ services: TIPTAP_URL: ${TIPTAP_URL} TIPTAP_AUTH_KEY: ${TIPTAP_AUTH_KEY} TIPTAP_JWT_SIGNING_KEY: ${TIPTAP_JWT_SIGNING_KEY} -<<<<<<< HEAD - env_file: - - ${ENV_FILE:-.env.local} # Same override capability -======= ->>>>>>> ca9ea8f (merges in changes from test branch.) ports: - "${BACKEND_PORT}:${BACKEND_PORT}" # Map host port to container's service port depends_on: @@ -62,12 +51,6 @@ services: nextjs-app: build: -<<<<<<< HEAD - context: . - dockerfile: Dockerfile - env_file: - - ${ENV_FILE:-.env.local} -======= context: https://github.com/refactor-group/refactor-platform-fe.git#main # change to fs directory to run locally dockerfile: Dockerfile target: runner # Use runner target @@ -83,7 +66,6 @@ services: NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} ->>>>>>> ca9ea8f (merges in changes from test branch.) ports: - "${FRONTEND_SERVICE_PORT}:${FRONTEND_SERVICE_PORT}" # Map host port to frontend container's service port depends_on: @@ -94,4 +76,4 @@ networks: driver: bridge # Use bridge network driver volumes: - postgres_data: # Define postgres_data volume + postgres_data: # Define postgres_data volume \ No newline at end of file diff --git a/entity_api/Cargo.toml b/entity_api/Cargo.toml index 28efecb1..86709d44 100644 --- a/entity_api/Cargo.toml +++ b/entity_api/Cargo.toml @@ -14,14 +14,9 @@ log = "0.4.22" axum-login = "0.16.0" async-trait = "0.1.83" password-auth = "1.0.0" -<<<<<<< HEAD -sqlx = { version = "0.8.3", features = ["time", "runtime-tokio"] } -utoipa = { version = "5.3.1", features = ["axum_extras", "uuid"] } -======= slugify = "0.1.0" sqlx = { version = "0.8.2", features = ["time", "runtime-tokio"] } utoipa = { version = "4.2.0", features = ["axum_extras", "uuid"] } ->>>>>>> f61c08b (merges remaining changes from main.) [dependencies.sea-orm] version = "1.1.0" # sea-orm version diff --git a/web/Cargo.toml b/web/Cargo.toml index 37a961bf..62f93299 100644 --- a/web/Cargo.toml +++ b/web/Cargo.toml @@ -8,16 +8,10 @@ edition = "2021" [dependencies] domain = { path = "../domain" } service = { path = "../service" } -entity_api = { path = "../entity_api" } -<<<<<<< HEAD -axum = "0.8.1" -axum-login = "0.17.0" -======= axum = "0.7.7" axum-login = "0.16.0" chrono = { version = "0.4.38", features = ["serde"] } ->>>>>>> f61c08b (merges remaining changes from main.) log = "0.4.22" tower-http = { version = "0.6.1", features = ["fs", "cors"] } serde_json = "1.0.128" From d8e281c3fa2e416a40f8c21ffc6b050b79484363 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 11:53:48 -0400 Subject: [PATCH 58/74] correcting README --- README.md | 76 +------------------------------------------------------ 1 file changed, 1 insertion(+), 75 deletions(-) diff --git a/README.md b/README.md index ee7d8327..7a99a039 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ [![Build & Tests (backend)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml) -[![Image Build & Stored](https://github.com/refactor-group/refactor-platform-rs/actions/workflows/build_and_deploy_containers.yml/badge.svg)](https://github.com/refactor-group/refactor-platform-rs/actions/workflows/build_and_deploy_containers.yml) # Refactor Coaching & Mentoring Platform @@ -56,51 +55,6 @@ The platform itself is useful for professional independent coaches, informal men Please note that the script assumes that the password for the new PostgreSQL user is `password`. If you want to use a different password, you'll need to modify the script accordingly. -<<<<<<< HEAD -### Set Up Database Manually - -Note: these are commands meant to run against a real PostgreSQL server with an admin-level user. - -```sql --- create new database `refactor_platform` -CREATE DATABASE refactor_platform; -``` - -Change to the `refactor_platform` DB visually if using an app like Postico, otherwise change using the PostgreSQL CLI: - -```sh -\c refactor_platform -``` - -```sql --- create new database user `refactor` -CREATE USER refactor WITH PASSWORD 'password'; --- create a new schema owned by user `refactor` -CREATE SCHEMA IF NOT EXISTS refactor_platform AUTHORIZATION refactor; --- check to see that the schema `refactor_platform` exists in the results -SELECT schema_name FROM information_schema.schemata; --- grant all privileges on schema `refactor_platform` to user `refactor` -GRANT ALL PRIVILEGES ON SCHEMA refactor_platform TO refactor; -``` - -### Run Migrations - -Note: this assumes a database name of `refactor_platform`. - -```bash -DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli migrate up -s refactor_platform -``` - -### Generate a New Entity from Database - -Note that to generate a new entity using the CLI you must ignore all other tables using the `--ignore-tables` option. You must add the option for _each_ table you are ignoring. - -```bash -DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} -``` - -======= ->>>>>>> f61c08b (merges remaining changes from main.) ## Starting the Backend To run the backend directly outside of a container: @@ -108,11 +62,7 @@ To run the backend directly outside of a container: The first example will start the backend with log level DEBUG and attempt to connect to a Postgres DB server on the same machine with user `refactor` and password `password` on port `5432` and selecting the database named `refactor_platform`. ```bash -<<<<<<< HEAD -cargo run -- -l DEBUG -d postgres://refactor:password@localhost:5432/refactor_platform -======= cargo run -- --tiptap-url https://.collab.tiptap.cloud --tiptap-auth-key= --tiptap-jwt-signing-key= --tiptap-app-id= ->>>>>>> f61c08b (merges remaining changes from main.) ``` To run with a custom Postgresql connection string: @@ -133,13 +83,9 @@ cargo run -- --allowed-origins="http://192.168.1.2:3000,https://192.168.1.2:3000 _This Rust-based backend/web API connects to a PostgreSQL database. It uses Docker and Docker Compose for local development and deployment, including utilities for database management and migrations. You can run PostgreSQL locally (via Docker) or remotely by configuring environment variables._ -<<<<<<< HEAD -### Quickstart -======= --- ### Building and Running Locally or Remotely in Containers ->>>>>>> f61c08b (merges remaining changes from main.) 1. **Install Prerequisites**: - [Docker](https://www.docker.com/products/docker-desktop) (20+) @@ -200,17 +146,6 @@ _For additional commands, database utilities, and debugging tips, check the [Con ## Project Directory Structure -<<<<<<< HEAD -- `docs` - project documentation including architectural records, DB schema, API docs, etc. -- `domain` - layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. -- `entity_api` - data operations on the various `Entity` models -- `entity` - shape of the data models and the relationships to each other -- `migration` - relational DB SQL migrations -- `scripts` - contains handy developer-related scripts that make working with this codebase more straightforward -- `service` - CLI flags, environment variables, config handling, and backend daemon setup -- `src` - contains a main function that initializes logging and calls all sub-services -- `web` - API endpoint definition, routing, handling of request/responses, controllers -======= `docs` - project documentation including architectural records, DB schema, API docs, etc `domain` - Layer of abstraction above `entity_api` and intended to encapsulate most business logic. Ex. interactions between `entity_api` and network calls to the outside world. @@ -274,13 +209,4 @@ Note that to generate a new Entity using the CLI you must ignore all other table ```bash DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} -<<<<<<< HEAD -<<<<<<< HEAD -``` ->>>>>>> f61c08b (merges remaining changes from main.) -======= -``` ->>>>>>> ca9ea8f (merges in changes from test branch.) -======= -``` ->>>>>>> 527edcb (noop: addresses README linting warning.) +``` \ No newline at end of file From 7ca63297b02a85e690bf43256eecdd371d74541e Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 13:30:34 -0400 Subject: [PATCH 59/74] addresses cache key conflict --- .github/workflows/build_and_deploy_containers.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index b6848c11..d8cf8344 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -26,7 +26,7 @@ jobs: - name: Set up Rust + QEMU uses: docker/setup-qemu-action@v2 with: - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64 # ✅ Only needed once per buildx host # Install ARM cross-compiler - name: Install cross-compilation toolchain @@ -38,10 +38,12 @@ jobs: - name: Set up Rust targets uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu + targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu # ✅ Targets declared here - # Cache Rust build artifacts to speed up builds + # Cache Rust build artifacts (unique key avoids 409 Conflict errors) - uses: Swatinem/rust-cache@v2 + with: + cache-key: ${{ runner.os }}-cargo-${{ github.sha }} # Install sea-orm-cli globally - name: Install sea-orm-cli @@ -110,7 +112,7 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/amd64,linux/arm64 # ✅ Declared again for buildx push: true provenance: true tags: ${{ steps.tags.outputs.backend_tags }} @@ -139,4 +141,4 @@ jobs: echo " docker pull ${{ steps.tags.outputs.backend_image_name }}:latest" echo "" echo -e "\033[1;36m▶️ Run Backend:\033[0m" - echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" \ No newline at end of file + echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" From f8cba7c371b4dbe7f0fab10bbe05d578483b4dc8 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 13:36:00 -0400 Subject: [PATCH 60/74] fixes cache key collision in container builds --- .github/workflows/build_and_deploy_containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index d8cf8344..e4ecd661 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -43,7 +43,7 @@ jobs: # Cache Rust build artifacts (unique key avoids 409 Conflict errors) - uses: Swatinem/rust-cache@v2 with: - cache-key: ${{ runner.os }}-cargo-${{ github.sha }} + shared-key: ${{ runner.os }}-cargo-${{ github.sha }} # Install sea-orm-cli globally - name: Install sea-orm-cli From f5ad045958a870083b78cad895ddac95b49fdd70 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 13:58:54 -0400 Subject: [PATCH 61/74] update rust-app image reference to use specific GitHub container --- docker-compose.yaml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 8ff89b12..13cc7570 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -19,11 +19,7 @@ services: # Rust application that connects to either local or remote PostgreSQL rust-app: - image: rust-backend # Use the built image - build: - context: . # Build context is current directory - dockerfile: Dockerfile # Use specified Dockerfile - target: runtime # Use runtime target + image: docker pull ghcr.io/refactor-group/refactor-platform-rs/82-feature-request-suggestion-create-github-actions-workflow-for-automating-the-build-and-deployments-for-feature-branches:latest # Use the built image platform: ${PLATFORM} # Specify the platform container_name: ${CONTAINER_NAME} # Name the container, default is "rust-app" environment: From f5e84805dac5a2522b979b877cfc3463d3f83346 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 14:20:38 -0400 Subject: [PATCH 62/74] add healthcheck for postgres service and ensure rust-app waits for service readiness --- docker-compose.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 13cc7570..79d9ca56 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -12,10 +12,15 @@ services: volumes: - postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql # Initialize database with setup.sql - - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_plaform_rs.sql # Initialize with refactor_platform_rs.sql + - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_platform_rs.sql # Initialize with refactor_platform_rs.sql - ./migration/src/setup_default_user.sql:/docker-entrypoint-initdb.d/2-setup_default_user.sql # Initialize with setup_default_user.sql networks: - backend_network # Connect to backend_network + healthcheck: + test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] + interval: 5s + timeout: 5s + retries: 5 # Rust application that connects to either local or remote PostgreSQL rust-app: @@ -40,7 +45,8 @@ services: ports: - "${BACKEND_PORT}:${BACKEND_PORT}" # Map host port to container's service port depends_on: - - postgres # Ensure postgres service starts before rust-app + postgres: + condition: service_healthy # Ensure postgres service is healthy before rust-app networks: - backend_network # Connect to backend_network command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] # Wait for Postgres and run the app @@ -72,4 +78,4 @@ networks: driver: bridge # Use bridge network driver volumes: - postgres_data: # Define postgres_data volume \ No newline at end of file + postgres_data: # Define postgres_data volume From 33106ab6f81c5e21242b263f4c3c6593233e5ac7 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 14:38:12 -0400 Subject: [PATCH 63/74] update Dockerfile to install bash and change entrypoint script to use bash --- Dockerfile | 2 +- entrypoint.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 47f256c4..86f76db8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,7 +4,7 @@ FROM --platform=${BUILDPLATFORM} rust:bullseye AS builder RUN apt-get update && apt-get install -y \ - build-essential pkg-config libssl-dev libpq-dev curl git \ + build-essential bash pkg-config libssl-dev libpq-dev curl git \ --no-install-recommends && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app diff --git a/entrypoint.sh b/entrypoint.sh index 9af7e549..d0d14ae4 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -euo pipefail # Determine the architecture of the host machine From bc77c698e1940a47c4f2e37445af082c8d62bef3 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 15:10:27 -0400 Subject: [PATCH 64/74] install bash in Dockerfile for improved script compatibility --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 86f76db8..be18afdb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -22,6 +22,8 @@ RUN cargo build --release --workspace # Stage 2: Minimal runtime image using non-root user FROM debian:bullseye-slim +RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* + RUN useradd -m -s /bin/bash appuser WORKDIR /app From 04ddd454e8bf67f0d8570522d428a37f6477ecd6 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 16:10:49 -0400 Subject: [PATCH 65/74] corrects dockerfile to always use buildx and corrects binary not found errror. --- Dockerfile | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index be18afdb..32879c53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,12 +3,14 @@ # Stage 1: Build Rust app on platform-specific image FROM --platform=${BUILDPLATFORM} rust:bullseye AS builder +# Install required build tools RUN apt-get update && apt-get install -y \ build-essential bash pkg-config libssl-dev libpq-dev curl git \ --no-install-recommends && rm -rf /var/lib/apt/lists/* WORKDIR /usr/src/app +# Copy workspace and packages COPY Cargo.toml Cargo.lock ./ COPY ./entity/Cargo.toml ./entity/Cargo.toml COPY ./entity_api/Cargo.toml ./entity_api/Cargo.toml @@ -17,20 +19,25 @@ COPY ./service/Cargo.toml ./service/Cargo.toml COPY ./web/Cargo.toml ./web/Cargo.toml COPY . . +# Build release binaries for the current platform only RUN cargo build --release --workspace -# Stage 2: Minimal runtime image using non-root user +# Stage 2: Minimal runtime image FROM debian:bullseye-slim +# Install Bash to support entrypoint.sh RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* +# Create non-root user RUN useradd -m -s /bin/bash appuser WORKDIR /app +# Copy only the necessary release binaries COPY --from=builder /usr/src/app/target/release/refactor_platform_rs . COPY --from=builder /usr/src/app/target/release/migration . COPY --from=builder /usr/src/app/target/release/seed_db . +# Copy entrypoint script and make it executable COPY entrypoint.sh /entrypoint.sh RUN chmod +x /entrypoint.sh && chown -R appuser:appuser /app /entrypoint.sh @@ -38,4 +45,4 @@ USER appuser EXPOSE 8000 -ENTRYPOINT ["/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/entrypoint.sh"] From 894272ec49216e13b4b8b415cdf438a4d83ae9b2 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 16:12:39 -0400 Subject: [PATCH 66/74] fixes container workflow to use buildx for multi-platform support --- .../workflows/build_and_deploy_containers.yml | 44 ++++++------------- 1 file changed, 13 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build_and_deploy_containers.yml b/.github/workflows/build_and_deploy_containers.yml index e4ecd661..fe9775c1 100644 --- a/.github/workflows/build_and_deploy_containers.yml +++ b/.github/workflows/build_and_deploy_containers.yml @@ -26,41 +26,23 @@ jobs: - name: Set up Rust + QEMU uses: docker/setup-qemu-action@v2 with: - platforms: linux/amd64,linux/arm64 # ✅ Only needed once per buildx host + platforms: linux/amd64,linux/arm64 - # Install ARM cross-compiler - - name: Install cross-compilation toolchain - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - - # Install Rust toolchain with both x86_64 and arm64 targets - - name: Set up Rust targets + # Install Rust and cache artifacts + - name: Set up Rust uses: dtolnay/rust-toolchain@stable with: - targets: x86_64-unknown-linux-gnu,aarch64-unknown-linux-gnu # ✅ Targets declared here + toolchain: stable - # Cache Rust build artifacts (unique key avoids 409 Conflict errors) - uses: Swatinem/rust-cache@v2 with: shared-key: ${{ runner.os }}-cargo-${{ github.sha }} - # Install sea-orm-cli globally + # Install sea-orm-cli globally (if needed for migration or seed) - name: Install sea-orm-cli run: cargo install sea-orm-cli - # Configure the Rust linker for arm64 builds - - name: Set linker for cross-compilation - run: | - mkdir -p ~/.cargo - echo '[target.aarch64-unknown-linux-gnu]' >> ~/.cargo/config.toml - echo 'linker = "aarch64-linux-gnu-gcc"' >> ~/.cargo/config.toml - - # Build release binaries for ARM64 - - name: Build release binaries - run: cargo build --release --workspace --target aarch64-unknown-linux-gnu - - # Run tests for x86_64 (native) + # Run tests for x86_64 only (CI feedback) - name: Run tests run: cargo test --release @@ -77,7 +59,7 @@ jobs: # Checkout source code - uses: actions/checkout@v4 - # Authenticate to GitHub Container Registry + # Docker login to GHCR - name: Docker login uses: docker/login-action@v2 with: @@ -96,7 +78,7 @@ jobs: echo -e "\033[1;34m🔍 Checking buildx cache BEFORE build...\033[0m" docker buildx du || echo -e "\033[1;33m⚠️ No cache found yet.\033[0m" - # Compute image name based on branch name and tag as `latest` + # Compute image tag - name: Determine Image Tags id: tags run: | @@ -105,27 +87,27 @@ jobs: echo "backend_tags=$IMAGE_NAME:latest" >> $GITHUB_OUTPUT echo "backend_image_name=$IMAGE_NAME" >> $GITHUB_OUTPUT - # Build and push multi-arch Docker image with GHA cache + # Build and push multi-arch Docker image with cache - name: Build + Push Backend id: push_backend uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm64 # ✅ Declared again for buildx + platforms: linux/amd64,linux/arm64 # ✅ Key multi-arch setting push: true provenance: true tags: ${{ steps.tags.outputs.backend_tags }} cache-from: type=gha cache-to: type=gha,mode=max - # Show updated Docker cache state + # Show updated cache usage - name: Show Docker Build Cache (After) run: | echo -e "\033[1;34m📦 Checking buildx cache AFTER build...\033[0m" docker buildx du || echo -e "\033[1;31m❌ Failed to get updated cache info\033[0m" - # Generate SBOM + attestation only on main branch + # Attest build provenance if on main branch - name: Attest Backend if: github.ref == 'refs/heads/main' && github.event_name == 'push' uses: actions/attest-build-provenance@v2 @@ -141,4 +123,4 @@ jobs: echo " docker pull ${{ steps.tags.outputs.backend_image_name }}:latest" echo "" echo -e "\033[1;36m▶️ Run Backend:\033[0m" - echo " docker run --rm -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" + echo " docker run --rm --env-file .env -p 8000:8000 ${{ steps.tags.outputs.backend_image_name }}:latest" From 503a4c6d98c930f04d376196f69b609a6ca77121 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 28 Mar 2025 16:14:34 -0400 Subject: [PATCH 67/74] corrects entrypoint.sh to correctly execute the correct binary and passes in env vars --- entrypoint.sh | 40 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index d0d14ae4..62b532b8 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,35 +1,11 @@ #!/bin/bash set -euo pipefail -# Determine the architecture of the host machine -ARCH=$(uname -m) - -# Set Rust linker for ARM64 if needed -if [ "$ARCH" = "aarch64" ]; then - export CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc - export RUSTFLAGS="-C link-arg=-L/usr/lib/aarch64-linux-gnu" -fi - -# Select the binary based on the architecture -if [ "$ARCH" = "x86_64" ]; then - echo "Executing AMD64 binary" - exec /app/refactor_platform_rs \ - -l "$BACKEND_LOG_FILTER_LEVEL" \ - -i "$BACKEND_INTERFACE" \ - -p "$BACKEND_PORT" \ - -d "$DATABASE_URL" \ - --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ - "$@" -elif [ "$ARCH" = "aarch64" ]; then - echo "Executing ARM64 binary" - exec /app/refactor_platform_rs_arm64 \ - -l "$BACKEND_LOG_FILTER_LEVEL" \ - -i "$BACKEND_INTERFACE" \ - -p "$BACKEND_PORT" \ - -d "$DATABASE_URL" \ - --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ - "$@" -else - echo "Unsupported architecture: $(uname -m)" >&2 - exit 1 -fi +# Start the main Rust binary with runtime args/envs +exec /app/refactor_platform_rs \ + -l "$BACKEND_LOG_FILTER_LEVEL" \ + -i "$BACKEND_INTERFACE" \ + -p "$BACKEND_PORT" \ + -d "$DATABASE_URL" \ + --allowed-origins="$BACKEND_ALLOWED_ORIGINS" \ + "$@" From 76a5f8e581914f9fd9c6a187524f5981eab27437 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 4 Apr 2025 13:34:59 -0400 Subject: [PATCH 68/74] corrects docker compose file to use correct entrypoint, and image locations --- docker-compose.yaml | 69 ++++++++++++++++++++++----------------------- 1 file changed, 33 insertions(+), 36 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 79d9ca56..98f028b1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,61 +1,58 @@ services: - # Local PostgreSQL container (used for local development when needed) postgres: - image: postgres:17 # Use PostgreSQL version 17 - container_name: postgres # Name the container "postgres" + image: postgres:17 + container_name: postgres environment: - POSTGRES_USER: ${POSTGRES_USER} # Set PostgreSQL user from environment variable - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Set PostgreSQL password from environment variable - POSTGRES_DB: ${POSTGRES_DB} # Set PostgreSQL database name from environment variable + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} ports: - - "${POSTGRES_PORT}:5432" # Map host port to container's PostgreSQL port + - "${POSTGRES_PORT}:5432" volumes: - - postgres_data:/var/lib/postgresql/data # Persist PostgreSQL data - - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql # Initialize database with setup.sql - - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_platform_rs.sql # Initialize with refactor_platform_rs.sql - - ./migration/src/setup_default_user.sql:/docker-entrypoint-initdb.d/2-setup_default_user.sql # Initialize with setup_default_user.sql + - postgres_data:/var/lib/postgresql/data + - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql + - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_platform_rs.sql + - ./migration/src/setup_default_user.sql:/docker-entrypoint-initdb.d/2-setup_default_user.sql networks: - - backend_network # Connect to backend_network + - backend_network healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 5s timeout: 5s retries: 5 - # Rust application that connects to either local or remote PostgreSQL rust-app: - image: docker pull ghcr.io/refactor-group/refactor-platform-rs/82-feature-request-suggestion-create-github-actions-workflow-for-automating-the-build-and-deployments-for-feature-branches:latest # Use the built image - platform: ${PLATFORM} # Specify the platform - container_name: ${CONTAINER_NAME} # Name the container, default is "rust-app" + image: ${IMAGE_NAME} + platform: ${PLATFORM} + container_name: ${CONTAINER_NAME} environment: - POSTGRES_USER: ${POSTGRES_USER} # Set PostgreSQL user from environment variable - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} # Set PostgreSQL password from environment variable - POSTGRES_DB: ${POSTGRES_DB} # Set PostgreSQL database name from environment variable - POSTGRES_SCHEMA: ${POSTGRES_SCHEMA} # Set PostgreSQL schema from environment variable - POSTGRES_HOST: postgres # Set PostgreSQL host to "postgres" service - POSTGRES_PORT: ${POSTGRES_PORT} # Set PostgreSQL port from environment variable - DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT}/${POSTGRES_DB} # Configure database URL - BACKEND_PORT: ${BACKEND_PORT} # Set service port from environment variable - BACKEND_INTERFACE: ${BACKEND_INTERFACE} # Set service interface from environment variable + POSTGRES_USER: ${POSTGRES_USER} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} + POSTGRES_DB: ${POSTGRES_DB} + POSTGRES_SCHEMA: ${POSTGRES_SCHEMA} + POSTGRES_HOST: postgres + POSTGRES_PORT: ${POSTGRES_PORT} + DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT}/${POSTGRES_DB} + BACKEND_PORT: ${BACKEND_PORT} + BACKEND_INTERFACE: ${BACKEND_INTERFACE} BACKEND_ALLOWED_ORIGINS: ${BACKEND_ALLOWED_ORIGINS} BACKEND_LOG_FILTER_LEVEL: ${BACKEND_LOG_FILTER_LEVEL} TIPTAP_URL: ${TIPTAP_URL} TIPTAP_AUTH_KEY: ${TIPTAP_AUTH_KEY} TIPTAP_JWT_SIGNING_KEY: ${TIPTAP_JWT_SIGNING_KEY} ports: - - "${BACKEND_PORT}:${BACKEND_PORT}" # Map host port to container's service port + - "${BACKEND_PORT}:${BACKEND_PORT}" depends_on: postgres: - condition: service_healthy # Ensure postgres service is healthy before rust-app + condition: service_healthy networks: - - backend_network # Connect to backend_network - command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] # Wait for Postgres and run the app - + - backend_network + nextjs-app: build: - context: https://github.com/refactor-group/refactor-platform-fe.git#main # change to fs directory to run locally + context: ${FRONTEND_CONTEXT} dockerfile: Dockerfile - target: runner # Use runner target + target: runner args: NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} @@ -69,13 +66,13 @@ services: NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} ports: - - "${FRONTEND_SERVICE_PORT}:${FRONTEND_SERVICE_PORT}" # Map host port to frontend container's service port + - "${FRONTEND_SERVICE_PORT}:${FRONTEND_SERVICE_PORT}" depends_on: - - rust-app # Ensure postgres service starts before rust-app + - rust-app networks: backend_network: - driver: bridge # Use bridge network driver + driver: bridge volumes: - postgres_data: # Define postgres_data volume + postgres_data: From 0d47844b58186a5ac936f5f86f11eb3f55abb083 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 4 Apr 2025 14:44:23 -0400 Subject: [PATCH 69/74] updates Dockerfile to support multi-platform builds and changes exposed port from 8000 to 4000 --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 32879c53..c4dabab8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -23,7 +23,7 @@ COPY . . RUN cargo build --release --workspace # Stage 2: Minimal runtime image -FROM debian:bullseye-slim +FROM --platform=${BUILDPLATFORM} debian:bullseye-slim # Install Bash to support entrypoint.sh RUN apt-get update && apt-get install -y bash && rm -rf /var/lib/apt/lists/* @@ -43,6 +43,6 @@ RUN chmod +x /entrypoint.sh && chown -R appuser:appuser /app /entrypoint.sh USER appuser -EXPOSE 8000 +EXPOSE 4000 ENTRYPOINT ["/entrypoint.sh"] From c5f98a7faf0cb504197c57c00268b029223a5dd5 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 11 Apr 2025 13:05:30 -0400 Subject: [PATCH 70/74] corrects rust-app image reference to ghcr and updates nextjs-app to use image from ghcr instead of build --- docker-compose.yaml | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 98f028b1..3fa5d4df 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -22,7 +22,7 @@ services: retries: 5 rust-app: - image: ${IMAGE_NAME} + image: ${BACKEND_IMAGE_NAME} platform: ${PLATFORM} container_name: ${CONTAINER_NAME} environment: @@ -49,17 +49,8 @@ services: - backend_network nextjs-app: - build: - context: ${FRONTEND_CONTEXT} - dockerfile: Dockerfile - target: runner - args: - NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} - NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} - NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} - NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} - FRONTEND_SERVICE_PORT: ${FRONTEND_SERVICE_PORT} - FRONTEND_SERVICE_INTERFACE: ${FRONTEND_SERVICE_INTERFACE} + image: ${FRONTEND_IMAGE_NAME} + container_name: ${FRONTEND_CONTAINER_NAME} environment: NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} From 91bc521345af932f2f2a8b50c5b10ce83d62c5a9 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Fri, 11 Apr 2025 13:31:28 -0400 Subject: [PATCH 71/74] updated container readme --- docs/runbooks/Container-README.md | 382 ++++-------------------------- 1 file changed, 40 insertions(+), 342 deletions(-) diff --git a/docs/runbooks/Container-README.md b/docs/runbooks/Container-README.md index 950d1bde..d1717fa5 100644 --- a/docs/runbooks/Container-README.md +++ b/docs/runbooks/Container-README.md @@ -1,373 +1,71 @@ -# Refactor Coaching & Mentoring Platform with Docker & Docker Compose +# Refactor Platform – Docker Quickstart -*This project is a Rust-based backend/web API that connects to a PostgreSQL database. It uses Docker and Docker Compose for easy local development and deployment, and includes utilities for database management, migrations, and more. You can choose to run PostgreSQL either locally (via Docker) or remotely by configuring the environment variables.* - ---- +This project uses Docker & Docker Compose for local development. It deploys a PostgreSQL database, a Rust back-end, and a Next.js front-end (all pre-built images from GitHub Container Registry). ## Prerequisites -Before you begin, ensure you have the following installed: - -- [Docker](https://www.docker.com/products/docker-desktop) (version 20+) -- [Docker Compose](https://docs.docker.com/compose/install/) (version 1.29+) +- Docker (v20+) +- Docker Compose (v1.29+) +- A configured .env file (see examples) ---- +## Steps & Commands -## Project Setup - -### 1. **Clone the Repository** +1. Clone the repository & set up the environment: ```bash -git clone -cd -``` - -### 2. **Environment Configuration** - -Decide whether you're connecting to a **local PostgreSQL container** (using Docker) or a **remote PostgreSQL instance**. Configure this using `.env` files. - -#### **For Local PostgreSQL (Docker-based)** - -- Create a `.env.local` file based on the template below and specify `POSTGRES_HOST=postgres`. - -**Example** `.env.local`: - -```env -POSTGRES_USER=refactor -POSTGRES_PASSWORD=password -POSTGRES_DB=refactor -POSTGRES_HOST=postgres -POSTGRES_PORT=5432 -POSTGRES_SCHEMA=refactor_platform -DATABASE_URL=postgres://$POSTGRES_USER:$POSTGRES_PASSWORD@$POSTGRES_HOST:$POSTGRES_PORT/$POSTGRES_DB - -BACKEND_LOG_FILTER_LEVEL="DEBUG" -BACKEND_PORT=4000 -BACKEND_INTERFACE=0.0.0.0 -BACKEND_ALLOWED_ORIGINS="http://localhost:3000,https://localhost:3000" - -BACKEND_SERVICE_PROTOCOL="http" -BACKEND_SERVICE_PORT=${BACKEND_PORT} -BACKEND_SERVICE_HOST="localhost" -BACKEND_API_VERSION="0.0.1" -FRONTEND_SERVICE_INTERFACE=0.0.0.0 -FRONTEND_SERVICE_PORT=3000 - -USERNAME=appuser -USER_UID=1000 -USER_GID=1000 -CONTAINER_NAME=refactor-platform -PLATFORM=linux/arm64 - -TIPTAP_URL=https://{Tiptap API Key}.collab.tiptap.cloud/ -TIPTAP_AUTH_KEY=tiptap-auth-key -TIPTAP_JWT_SIGNING_KEY=tiptap-jwt-signing-key -``` - -#### **For Remote PostgreSQL** - -- Create a `.env.remote-db` file and set `POSTGRES_HOST` to the external IP or hostname of the remote PostgreSQL instance. - -**Example** `.env.remote-db`: - -```env -# PostgreSQL environment variables for local development -POSTGRES_USER=refactor # Default PostgreSQL user for local development -POSTGRES_PASSWORD=password # Default PostgreSQL password for local development -POSTGRES_DB=refactor # Default PostgreSQL database for local development -POSTGRES_HOST=postgres # The local Docker Compose PostgreSQL container hostname -POSTGRES_PORT=5432 # PostgreSQL default port for local development -POSTGRES_SCHEMA=refactor_platform # PostgreSQL schema for the application -# Database connection URL for the Rust application -DATABASE_URL=postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB} - -# Rust application environment variables -BACKEND_LOG_FILTER_LEVEL="DEBUG" -BACKEND_ALLOWED_ORIGINS="http://localhost:3000,https://localhost:3000" -BACKEND_PORT=4000 -BACKEND_INTERFACE=0.0.0.0 - -# Next.js application build & environment variables -BACKEND_SERVICE_PROTOCOL="http" -BACKEND_SERVICE_PORT=${BACKEND_PORT} -BACKEND_SERVICE_HOST="localhost" -BACKEND_API_VERSION="0.0.1" -FRONTEND_SERVICE_INTERFACE=0.0.0.0 -FRONTEND_SERVICE_PORT=3000 - -PLATFORM=linux/arm64 # For Raspberry Pi 5 or Apple Silicon -CONTAINER_NAME="refactor-platform" - -# App user configuration -USERNAME=appuser # Username for the non-root user in the container -USER_UID=1000 # User ID for the appuser -USER_GID=1000 # Group ID for the appuser - -TIPTAP_URL=https://{Tiptap API Key}.collab.tiptap.cloud/ -TIPTAP_AUTH_KEY=tiptap-auth-key -TIPTAP_JWT_SIGNING_KEY=tiptap-jwt-signing-key -``` - -### 3. **Review `docker-compose.yaml`** - -The `docker-compose.yaml` file uses environment variables defined in your `.env` file setting important -configuration variables for both the Rust backend and the Next.js frontend applications. - -```yaml -services: - postgres: - image: postgres:17 - container_name: postgres - environment: - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_DB: ${POSTGRES_DB} - ports: - - "${POSTGRES_PORT}:5432" - volumes: - - postgres_data:/var/lib/postgresql/data - - ./migration/src/setup.sql:/docker-entrypoint-initdb.d/0-setup.sql - - ./migration/src/refactor_platform_rs.sql:/docker-entrypoint-initdb.d/1-refactor_plaform_rs.sql - - ./migration/src/setup_default_user.sql:/docker-entrypoint-initdb.d/2-setup_default_user.sql - networks: - - backend_network - - rust-app: - image: rust-backend - build: - context: . - dockerfile: Dockerfile - target: runtime - platform: ${PLATFORM} - container_name: ${CONTAINER_NAME} - environment: - POSTGRES_USER: ${POSTGRES_USER} - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} - POSTGRES_DB: ${POSTGRES_DB} - POSTGRES_SCHEMA: ${POSTGRES_SCHEMA} - POSTGRES_HOST: postgres - POSTGRES_PORT: ${POSTGRES_PORT} - DATABASE_URL: postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres:${POSTGRES_PORT}/${POSTGRES_DB} - BACKEND_PORT: ${BACKEND_PORT} - BACKEND_INTERFACE: ${BACKEND_INTERFACE} - BACKEND_ALLOWED_ORIGINS: ${BACKEND_ALLOWED_ORIGINS} - BACKEND_LOG_FILTER_LEVEL: ${BACKEND_LOG_FILTER_LEVEL} - TIPTAP_URL: ${TIPTAP_URL} - TIPTAP_AUTH_KEY: ${TIPTAP_AUTH_KEY} - TIPTAP_JWT_SIGNING_KEY: ${TIPTAP_JWT_SIGNING_KEY} - ports: - - "${BACKEND_PORT}:${BACKEND_PORT}" - depends_on: - - postgres - networks: - - backend_network - command: ["sh", "-c", "sleep 5 && /usr/local/bin/refactor_platform_rs"] + git clone && cd + ``` - nextjs-app: - build: - context: https://github.com/refactor-group/refactor-platform-fe.git#main - dockerfile: Dockerfile - target: runner - args: - NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} - NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} - NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} - NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} - FRONTEND_SERVICE_PORT: ${FRONTEND_SERVICE_PORT} - FRONTEND_SERVICE_INTERFACE: ${FRONTEND_SERVICE_INTERFACE} - environment: - NEXT_PUBLIC_BACKEND_SERVICE_PROTOCOL: ${BACKEND_SERVICE_PROTOCOL} - NEXT_PUBLIC_BACKEND_SERVICE_PORT: ${BACKEND_PORT} - NEXT_PUBLIC_BACKEND_SERVICE_HOST: ${BACKEND_SERVICE_HOST} - NEXT_PUBLIC_BACKEND_API_VERSION: ${BACKEND_API_VERSION} - ports: - - "${FRONTEND_SERVICE_PORT}:${FRONTEND_SERVICE_PORT}" - depends_on: - - rust-app - -networks: - backend_network: - driver: bridge - -volumes: - postgres_data -``` - ---- - -## Building and Running the Application - -### **1. Build the Rust Backend Image** - -```bash -docker buildx build --platform linux/amd64,linux/arm64 -t rust-backend . -``` - -This builds the image for both `amd64` and `arm64` architectures. Use the `--platform` flag to build for a specific architecture. - -### **2. Build and Run with Docker Compose** - -#### For Local PostgreSQL: - -```bash -docker-compose --env-file .env.local up --build -``` - -#### For Remote PostgreSQL: - -```bash -docker-compose --env-file .env.remote-db up --build -``` - -The web API will be accessible at `http://localhost:` - ---- - -## Database Utilities - -### **Rebuild the Database** - -```bash -docker-compose run rust-app rebuild-db -``` - -### **Seed the Database** - -```bash -docker-compose run rust-app seed-db -``` - -### **Convert DBML to SQL** +## Copy the example .env file and adjust values as needed -If you have a DBML file (`schema.dbml`), convert it to SQL: - -```bash -docker-compose run -v $(pwd)/sql:/app/sql -v $(pwd)/schema.dbml:/app/schema.dbml rust-app dbml2sql -``` - -```bash -docker-compose run -v $(pwd)/sql:/app/sql -v $(pwd)/schema.dbml:/app/schema.dbml rust-app dbml2sql -``` - ---- - -## Managing Containers + ```bash + cp .env.example .env + ``` -### **Stop Containers** +2. Use Docker Compose to build and start services: + docker-compose --env-file .env up --build -```bash -docker-compose down -``` + ## This starts PostgreSQL (local), the Rust back-end, and the Next.js front-end -### **Remove Containers, Networks, and Volumes** +3. Basic Management Commands: ```bash -docker-compose down -v -``` - ---- - -## Troubleshooting - -### **Cannot Connect to PostgreSQL** - -1. Verify PostgreSQL is running: - - ```bash - docker-compose ps + docker-compose ps # List running containers + docker-compose logs -f # Follow logs; press Ctrl+C to exit + docker-compose restart rust-app # Restart the Rust back-end service + docker-compose down # Stop and remove all containers and networks + docker-compose down -v # Also remove volumes for a fresh start + docker-compose exec rust-app cargo check # Run a command inside the Rust back-end container + docker-compose exec rust-app cargo run # Run the Rust back-end application ``` -2. Check logs for PostgreSQL: +4. Direct Docker Commands (Optional): + ```bash - docker-compose logs postgres + docker pull ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest # Replace 'your-tag' accordingly ``` -### **Web API Not Accessible** - -1. Verify the container is running: + ## Run the Rust back-end image directly ```bash - docker-compose ps + docker run -p 4000:4000 --env-file .env --name refactor-backend ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest ``` - -2. Check logs for the Rust app: + +4. **Debugging / Troubleshooting:** ```bash - docker-compose logs rust-app - ``` - -3. Confirm the correct port in `.env`: - ```bash - SERVICE_PORT=4000 + docker-compose exec rust-app bash # Access a shell in the Rust back-end container + docker-compose exec rust-app env # Check environment variables inside the rust-app container + docker-compose exec postgres bash # Access a shell in the PostgreSQL container for troubleshooting + docker-compose exec postgres pg_isready -U $POSTGRES_USER -d $POSTGRES_DB # Verify PostgreSQL is ready ``` -### **Port Conflicts** - -Change the ports in `.env` or `docker-compose.yaml`: - -```yaml -services: - postgres: - ports: - - "5433:5432" - - rust-app: - ports: - - "9090:8080" -``` - -### **Rebuild After Changes** - -```bash -docker-compose build -docker-compose up -``` +**Notes:** -### **Database Persistence** +- Ensure your `.env` file includes required variables such as `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`, `DATABASE_URL`, `BACKEND_PORT`, `BACKEND_INTERFACE`, `BACKEND_ALLOWED_ORIGINS`, `BACKEND_LOG_FILTER_LEVEL`, etc. +- The nextjs-app service uses the pre-built image from GHCR (update the image name if necessary). +- If using docker-compose, the `.env` file located in the project root is automatically loaded. -Ensure volumes are configured in `docker-compose.yaml`: - -```yaml -volumes: - postgres_data: -``` - ---- - -## Development Tips - -- Run containers in detached mode: - - ```bash - docker-compose up -d - ``` - -- Access a running container: - - ```bash - docker exec -it bash - ``` - -- Restart a single service: - - ```bash - docker-compose restart rust-app - ``` - ---- - -## Interactive Testing - -- Test interactively: - - ```bash - docker run -it rust-backend:latest - ``` - -- Debug inside the container: - - ```bash - docker run -it --entrypoint /bin/bash rust-backend:latest - ``` +*This guide provides all essential commands to safely work with the containers using Docker and Docker Compose.* From 6d3196d623401464ecf5cec78b2355515fc95362 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 12 Apr 2025 15:33:54 -0400 Subject: [PATCH 72/74] fix: update container name for rust-app in docker-compose --- docker-compose.yaml | 2 +- docs/runbooks/Container-README.md | 134 ++++++++++++++++++++++-------- 2 files changed, 99 insertions(+), 37 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 3fa5d4df..672fb7ac 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -24,7 +24,7 @@ services: rust-app: image: ${BACKEND_IMAGE_NAME} platform: ${PLATFORM} - container_name: ${CONTAINER_NAME} + container_name: ${BACKEND_CONTAINER_NAME} environment: POSTGRES_USER: ${POSTGRES_USER} POSTGRES_PASSWORD: ${POSTGRES_PASSWORD} diff --git a/docs/runbooks/Container-README.md b/docs/runbooks/Container-README.md index d1717fa5..46084965 100644 --- a/docs/runbooks/Container-README.md +++ b/docs/runbooks/Container-README.md @@ -1,71 +1,133 @@ -# Refactor Platform – Docker Quickstart +# Refactor Platform: Docker Quickstart -This project uses Docker & Docker Compose for local development. It deploys a PostgreSQL database, a Rust back-end, and a Next.js front-end (all pre-built images from GitHub Container Registry). +*This project uses Docker & Docker Compose for local development. It deploys a PostgreSQL database, a Rust back-end, and a Next.js front-end (all pre-built images from GitHub Container Registry).* ## Prerequisites - Docker (v20+) - Docker Compose (v1.29+) -- A configured .env file (see examples) +- A configured .env file (see below) -## Steps & Commands +## Example .env File -1. Clone the repository & set up the environment: +Below is an example of a complete and correct .env file. Copy this content (or adjust values as needed) and save it as .env in the project root. ```bash - git clone && cd - ``` - -## Copy the example .env file and adjust values as needed +# ============================== +# PostgreSQL Configuration +# ============================== +POSTGRES_USER=refactor # PostgreSQL username +POSTGRES_PASSWORD=password # PostgreSQL password +POSTGRES_DB=refactor # PostgreSQL database name +POSTGRES_HOST=postgres # Hostname for the PostgreSQL container (set in docker-compose) +POSTGRES_PORT=5432 # Internal PostgreSQL port +POSTGRES_SCHEMA=refactor_platform # Database schema +# DATABASE_URL used by the Rust back-end to connect to Postgres +DATABASE_URL=postgres://refactor:password@postgres:5432/refactor + +# ============================== +# Rust Back-end Configuration +# ============================== +BACKEND_CONTAINER_NAME=refactor-platform # Name for the Rust back-end container +BACKEND_IMAGE_NAME=ghcr.io/refactor-group/refactor-platform-rs/:latest + # Pre-built image for the Rust back-end from GHCR +BACKEND_ENV=development # Environment (development/production) +BACKEND_ALLOWED_ORIGINS=* # Allowed CORS origins +BACKEND_LOG_FILTER_LEVEL=DEBUG # Logging level for the back-end +BACKEND_PORT=4000 # Port on which the Rust back-end listens +BACKEND_INTERFACE=0.0.0.0 # Interface for the Rust back-end +BACKEND_SERVICE_PROTOCOL=http # Protocol (usually http) +BACKEND_SERVICE_PORT=4000 # Derived service port +BACKEND_SERVICE_HOST=localhost # Hostname used by the service +BACKEND_API_VERSION=0.0.1 # API version + +# ============================== +# Next.js Front-end Configuration +# ============================== +FRONTEND_IMAGE_NAME=ghcr.io/refactor-group/refactor-platform-fe/:latest + # Pre-built image for the Next.js front-end from GHCR +FRONTEND_CONTAINER_NAME=refactor-platform-frontend # Name for the front-end container +FRONTEND_SERVICE_INTERFACE=0.0.0.0 # Interface for the front-end service +FRONTEND_SERVICE_PORT=3000 # Port for the front-end service + +# ============================== +# TipTap Service Configuration +# ============================== +TIPTAP_URL="https://ok01532m.collab.tiptap.cloud" # URL for the TipTap service +TIPTAP_AUTH_KEY="6122462e59d7cc8c6146f4e3b5c93dfad28c8a219838df69b59ffcec4cdc0041" + # Authentication key for TipTap +TIPTAP_JWT_SIGNING_KEY="0f38cb0650a8fc262258ad415f25c52579bfc4095b222f486557d24c8fafaeb8" # JWT signing key for TipTap +``` - ```bash - cp .env.example .env - ``` +## Steps & Commands -2. Use Docker Compose to build and start services: - docker-compose --env-file .env up --build +1. **Clone the repository & set up the environment:** - ## This starts PostgreSQL (local), the Rust back-end, and the Next.js front-end + ```bash + # Clone the repository and change into the project directory + git clone && cd + + # Copy the example .env file and adjust values as needed + cp .env.example .env + ``` -3. Basic Management Commands: +1. **Build and Start the Containers with Docker Compose:** -```bash - docker-compose ps # List running containers - docker-compose logs -f # Follow logs; press Ctrl+C to exit - docker-compose restart rust-app # Restart the Rust back-end service - docker-compose down # Stop and remove all containers and networks - docker-compose down -v # Also remove volumes for a fresh start - docker-compose exec rust-app cargo check # Run a command inside the Rust back-end container - docker-compose exec rust-app cargo run # Run the Rust back-end application + ```bash + docker-compose --env-file .env up --build + # This command starts: + # - PostgreSQL (local) + # - Rust back-end + # - Next.js front-end ``` -4. Direct Docker Commands (Optional): +1. **Basic Management Commands:** - ```bash - docker pull ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest # Replace 'your-tag' accordingly + docker-compose ps # List running containers + docker-compose logs -f # Follow live logs (press Ctrl+C to exit) + docker-compose restart rust-app # Restart the Rust back-end container + docker-compose down # Stop and remove all containers and networks + docker-compose down -v # Stop containers and remove volumes for a fresh start + docker-compose exec rust-app cargo check # Run 'cargo check' inside the Rust back-end container + docker-compose exec rust-app cargo run # Run the Rust back-end application + docker-compose ps # List running containers + docker-compose logs -f # Follow live logs (press Ctrl+C to exit) + docker-compose restart rust-app # Restart the Rust back-end container + docker-compose exec rust-app cargo check # Run 'cargo check' inside the Rust back-end container + docker-compose exec rust-app cargo run # Run the Rust back-end application ``` - ## Run the Rust back-end image directly +1. **Direct Docker Commands (Optional):** ```bash + # Pull the Rust back-end image from GHCR (if not built locally) + docker pull ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest # Replace 'your-tag' as needed + + # Run the Rust back-end image directly docker run -p 4000:4000 --env-file .env --name refactor-backend ghcr.io/refactor-group/refactor-platform-rs/your-tag:latest ``` - -4. **Debugging / Troubleshooting:** - ```bash + **Note:** *By default, Docker Compose uses locally cached images. The remote image is pulled only once unless you force a new pull using commands like `docker-compose pull` or by passing the `--no-cache` flag.* +1. **Debugging & Troubleshooting:** + + ```bash + docker-compose exec rust-app bash # Access a shell in the Rust back-end container + docker-compose exec rust-app env # View environment variables in the Rust back-end container + docker-compose exec postgres bash # Access a shell in the PostgreSQL container + docker-compose exec postgres pg_isready -U $POSTGRES_USER -d $POSTGRES_DB + # Verify PostgreSQL is ready docker-compose exec rust-app bash # Access a shell in the Rust back-end container docker-compose exec rust-app env # Check environment variables inside the rust-app container docker-compose exec postgres bash # Access a shell in the PostgreSQL container for troubleshooting docker-compose exec postgres pg_isready -U $POSTGRES_USER -d $POSTGRES_DB # Verify PostgreSQL is ready + docker-compose exec rust-app cargo test # Run tests inside the Rust back-end container ``` -**Notes:** +**Final Notes:** - Ensure your `.env` file includes required variables such as `POSTGRES_USER`, `POSTGRES_PASSWORD`, `POSTGRES_DB`, `DATABASE_URL`, `BACKEND_PORT`, `BACKEND_INTERFACE`, `BACKEND_ALLOWED_ORIGINS`, `BACKEND_LOG_FILTER_LEVEL`, etc. -- The nextjs-app service uses the pre-built image from GHCR (update the image name if necessary). -- If using docker-compose, the `.env` file located in the project root is automatically loaded. - -*This guide provides all essential commands to safely work with the containers using Docker and Docker Compose.* +- Docker Compose automatically loads the `.env` file located in the project root. +- The pre-built images from GHCR for both the Rust back-end and the Next.js front-end are used by default. These remote images are only pulled if not already available locally, unless a pull is forced. +- The commands above follow best practices and help ensure a reliable setup every time you run the project. From db3620eb9e68a60d26bab67af5a98eb1399ab0cc Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sat, 12 Apr 2025 15:55:55 -0400 Subject: [PATCH 73/74] Update README.md adds badge for container build status to readme. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7a99a039..aa2efb8b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build & Tests (backend)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml) +[![Build & Tests (backend)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml/badge.svg)](https://github.com/Jim-Hodapp-Coaching/refactor-platform-rs/actions/workflows/ci.yml) [![Build and Deploy Containers](https://github.com/refactor-group/refactor-platform-rs/actions/workflows/build_and_deploy_containers.yml/badge.svg)](https://github.com/refactor-group/refactor-platform-rs/actions/workflows/build_and_deploy_containers.yml) # Refactor Coaching & Mentoring Platform @@ -209,4 +209,4 @@ Note that to generate a new Entity using the CLI you must ignore all other table ```bash DATABASE_URL=postgres://refactor:password@localhost:5432/refactor_platform sea-orm-cli generate entity -s refactor_platform -o entity/src -v --with-serde both --serde-skip-deserializing-primary-key --ignore-tables {table to ignore} --ignore-tables {other table to ignore} -``` \ No newline at end of file +``` From 5372ece4066088afc9e3cf85105fc7aef50c1588 Mon Sep 17 00:00:00 2001 From: Levi McDonough Date: Sun, 20 Apr 2025 17:46:04 -0400 Subject: [PATCH 74/74] Update Container-README.md removes values from tip tap env vars in Container-Readme --- docs/runbooks/Container-README.md | 49 +++++++++++++++---------------- 1 file changed, 24 insertions(+), 25 deletions(-) diff --git a/docs/runbooks/Container-README.md b/docs/runbooks/Container-README.md index 46084965..7d883c99 100644 --- a/docs/runbooks/Container-README.md +++ b/docs/runbooks/Container-README.md @@ -37,7 +37,7 @@ BACKEND_LOG_FILTER_LEVEL=DEBUG # Logging level for the back-end BACKEND_PORT=4000 # Port on which the Rust back-end listens BACKEND_INTERFACE=0.0.0.0 # Interface for the Rust back-end BACKEND_SERVICE_PROTOCOL=http # Protocol (usually http) -BACKEND_SERVICE_PORT=4000 # Derived service port +BACKEND_SERVICE_PORT=4000 # Derived service port BACKEND_SERVICE_HOST=localhost # Hostname used by the service BACKEND_API_VERSION=0.0.1 # API version @@ -47,16 +47,15 @@ BACKEND_API_VERSION=0.0.1 # API version FRONTEND_IMAGE_NAME=ghcr.io/refactor-group/refactor-platform-fe/:latest # Pre-built image for the Next.js front-end from GHCR FRONTEND_CONTAINER_NAME=refactor-platform-frontend # Name for the front-end container -FRONTEND_SERVICE_INTERFACE=0.0.0.0 # Interface for the front-end service -FRONTEND_SERVICE_PORT=3000 # Port for the front-end service +FRONTEND_SERVICE_INTERFACE=0.0.0.0 # Interface for the front-end service +FRONTEND_SERVICE_PORT=3000 # Port for the front-end service # ============================== # TipTap Service Configuration # ============================== -TIPTAP_URL="https://ok01532m.collab.tiptap.cloud" # URL for the TipTap service -TIPTAP_AUTH_KEY="6122462e59d7cc8c6146f4e3b5c93dfad28c8a219838df69b59ffcec4cdc0041" - # Authentication key for TipTap -TIPTAP_JWT_SIGNING_KEY="0f38cb0650a8fc262258ad415f25c52579bfc4095b222f486557d24c8fafaeb8" # JWT signing key for TipTap +TIPTAP_URL="" # URL for the TipTap service +TIPTAP_AUTH_KEY="" # Authentication key for TipTap +TIPTAP_JWT_SIGNING_KEY="" # JWT signing key for TipTap ``` ## Steps & Commands @@ -84,18 +83,18 @@ TIPTAP_JWT_SIGNING_KEY="0f38cb0650a8fc262258ad415f25c52579bfc4095b222f486557d24c 1. **Basic Management Commands:** ```bash - docker-compose ps # List running containers - docker-compose logs -f # Follow live logs (press Ctrl+C to exit) - docker-compose restart rust-app # Restart the Rust back-end container - docker-compose down # Stop and remove all containers and networks - docker-compose down -v # Stop containers and remove volumes for a fresh start + docker-compose ps # List running containers + docker-compose logs -f # Follow live logs (press Ctrl+C to exit) + docker-compose restart rust-app # Restart the Rust back-end container + docker-compose down # Stop and remove all containers and networks + docker-compose down -v # Stop containers and remove volumes for a fresh start docker-compose exec rust-app cargo check # Run 'cargo check' inside the Rust back-end container - docker-compose exec rust-app cargo run # Run the Rust back-end application - docker-compose ps # List running containers - docker-compose logs -f # Follow live logs (press Ctrl+C to exit) - docker-compose restart rust-app # Restart the Rust back-end container + docker-compose exec rust-app cargo run # Run the Rust back-end application + docker-compose ps # List running containers + docker-compose logs -f # Follow live logs (press Ctrl+C to exit) + docker-compose restart rust-app # Restart the Rust back-end container docker-compose exec rust-app cargo check # Run 'cargo check' inside the Rust back-end container - docker-compose exec rust-app cargo run # Run the Rust back-end application + docker-compose exec rust-app cargo run # Run the Rust back-end application ``` 1. **Direct Docker Commands (Optional):** @@ -113,16 +112,16 @@ TIPTAP_JWT_SIGNING_KEY="0f38cb0650a8fc262258ad415f25c52579bfc4095b222f486557d24c 1. **Debugging & Troubleshooting:** ```bash - docker-compose exec rust-app bash # Access a shell in the Rust back-end container - docker-compose exec rust-app env # View environment variables in the Rust back-end container - docker-compose exec postgres bash # Access a shell in the PostgreSQL container + docker-compose exec rust-app bash # Access a shell in the Rust back-end container + docker-compose exec rust-app env # View environment variables in the Rust back-end container + docker-compose exec postgres bash # Access a shell in the PostgreSQL container docker-compose exec postgres pg_isready -U $POSTGRES_USER -d $POSTGRES_DB - # Verify PostgreSQL is ready - docker-compose exec rust-app bash # Access a shell in the Rust back-end container - docker-compose exec rust-app env # Check environment variables inside the rust-app container - docker-compose exec postgres bash # Access a shell in the PostgreSQL container for troubleshooting + # Verify PostgreSQL is ready + docker-compose exec rust-app bash # Access a shell in the Rust back-end container + docker-compose exec rust-app env # Check environment variables inside the rust-app container + docker-compose exec postgres bash # Access a shell in the PostgreSQL container for troubleshooting docker-compose exec postgres pg_isready -U $POSTGRES_USER -d $POSTGRES_DB # Verify PostgreSQL is ready - docker-compose exec rust-app cargo test # Run tests inside the Rust back-end container + docker-compose exec rust-app cargo test # Run tests inside the Rust back-end container ``` **Final Notes:**