From db15e33ebdf1c6b1d4be63903105762fccff6992 Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 12 Mar 2025 14:41:21 +0300 Subject: [PATCH 1/2] docs(README): update README to reflect changes in storage of name and description input --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3c39e98..fc5ef3a 100644 --- a/README.md +++ b/README.md @@ -31,17 +31,17 @@ CompareWare is an open-source platform for comparing tools (software, hardware, ### Key Concepts - **PK (Primary Key)**: Unique identifier for table records (🔑) - **FK (Foreign Key)**: Reference linking related tables (➡️) +- **Core (core properties)**: name and description. -### **Tables Overview** +### Tables Overview -### Core Tables | Table | Columns (PK/FK) | Description | Example Data | |-------|------------------|-------------|--------------| | **urls** | `id` (PK), `url`, `created_at` | Stores comparison URLs | `1, "/laptops", 2024-03-01` | -| **items** | `id` (PK), `url_id` (FK), `name`, `description`, `wikidata_id` | Comparison items | `"item1", 1, "MacBook Pro", "16-inch", "Q214276"` | -| **properties** | `id` (PK), `name`, `global_usage_count` | Available properties | `25, "screen_size", 150` | -| **item_properties** | `item_id` (PK/FK), `property_id` (PK/FK), `value` | Item-specific values | `"item1", 25, "16 inches"` | -| **selected_properties** | `url_id` (PK/FK), `property_id` (PK/FK) | Active properties per URL | `1, 25` | +| **items** | `id` (PK), `url_id` (FK), `wikidata_id` | Comparison items | `"item1", 1, "Q214276"` | +| **properties** | `id` (PK), `name` | All available properties (including core) | `1.0, "name"`
`2.0, "description"`
`3.0, "screen_size"` | +| **item_properties** | `item_id` (PK/FK), `property_id` (PK/FK), `value` | All property values including name/description | `"item1", 1.0, "MacBook Pro"`
`"item1", 2.0, "16-inch laptop"`
`"item1", 3.0, "16 inches"` | +| **selected_properties** | `url_id` (PK/FK), `property_id` (PK/FK) | Active properties per URL (excludes core) | `1, 3.0` | ### Data Flow ```mermaid From 3ef759e5c23f5a177e20c420b6d4d6d19a2955b6 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 15 Mar 2025 16:31:23 +0300 Subject: [PATCH 2/2] buid(docker): add deckerfile and docker-compose.toml from dev --- docker-compose.yml | 11 +++++++++ dockerfile | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 docker-compose.yml create mode 100644 dockerfile diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..87d62e3 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,11 @@ +services: + app: + build: . + ports: + - "3000:3000" + volumes: + - ./compareware.db:/app/compareware.db + environment: + - RUST_LOG=info + - LEPTOS_ENV=production + restart: unless-stopped \ No newline at end of file diff --git a/dockerfile b/dockerfile new file mode 100644 index 0000000..b61ad15 --- /dev/null +++ b/dockerfile @@ -0,0 +1,56 @@ +# Build stage +FROM rust:1.83.0-slim-bullseye as builder + +# Install essential build tools +RUN apt-get update && \ + apt-get install -y \ + libsqlite3-dev \ + build-essential \ + clang \ + libssl-dev \ + pkg-config \ + curl \ + cmake \ + protobuf-compiler \ + && rm -rf /var/lib/apt/lists/* + +# Install Rust toolchain +RUN rustup component add rust-src + +# Install cargo-leptos & wasm-bindgen-cli +RUN cargo install cargo-leptos --version 0.2.24 --locked +RUN cargo install wasm-bindgen-cli --version 0.2.99 --locked + +# Build application +WORKDIR /app +COPY . . +# Explicitly set WASM target +RUN rustup target add wasm32-unknown-unknown +# Build project +ENV LEPTOS_OUTPUT_NAME="compareware" + +# Build with release profile +RUN cargo leptos build --release + +# Runtime stage +FROM debian:bullseye-slim + +# Install runtime dependencies in Debian +RUN apt-get update && \ + apt-get install -y \ + libssl-dev \ + libsqlite3-0 \ + ca-certificates \ + && rm -rf /var/lib/apt/lists/* + +# Copy build artifacts +COPY --from=builder /app/target/release/compareware /app/ +COPY --from=builder /app/target/site /app/site +COPY assets /app/assets + +# Configure container, expose port and set entrypoint +WORKDIR /app +EXPOSE 3000 +ENV LEPTOS_SITE_ADDR=0.0.0.0:3000 +ENV LEPTOS_SITE_ROOT="site" +CMD ["./compareware"] \ No newline at end of file