From 1c3321613d62f5ee7d4ed2892b8c56c102e81ac5 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 12 Apr 2025 15:55:36 -0400 Subject: [PATCH 01/15] Added Docker file --- Dockerfile | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..74c9a60 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,75 @@ +# Stage 1: Build the application +# Use a specific Rust version for reproducibility. Choose one that matches your development environment. +# Using slim variant for smaller base image +FROM rust:1.86 as builder + +# Set the working directory inside the container +WORKDIR /usr/src/app + +# Install build dependencies if needed (e.g., for certain crates like sqlx with native TLS) +# RUN apt-get update && apt-get install -y pkg-config libssl-dev + +# Install build dependencies if needed (e.g., git for cloning) +RUN apt-get update && apt-get install -y --no-install-recommends \ + pkg-config libssl3 \ + ca-certificates \ + openssh-client git \ + && rm -rf /var/lib/apt/lists/* + +# << --- ADD HOST KEY HERE --- >> +# Replace 'yourgithost.com' with the actual hostname (e.g., github.com) +RUN mkdir -p -m 0700 ~/.ssh && \ + ssh-keyscan git.kundeng.us >> ~/.ssh/known_hosts + +# Copy Cargo manifests +COPY Cargo.toml Cargo.lock ./ + +# Build *only* dependencies to leverage Docker cache +# This dummy build caches dependencies as a separate layer +RUN --mount=type=ssh mkdir src && \ + echo "fn main() {println!(\"if you see this, the build broke\")}" > src/main.rs && \ + cargo build --release --quiet && \ + rm -rf src target/release/deps/icarus* # Clean up dummy build artifacts (replace icarus) + +# Copy the actual source code +COPY src ./src +# If you have other directories like `templates` or `static`, copy them too +# COPY templates ./templates +# COPY static ./static +# COPY .env ./.env +# COPY migrations ./migrations + +# << --- SSH MOUNT ADDED HERE --- >> +# Build *only* dependencies to leverage Docker cache +# This dummy build caches dependencies as a separate layer +# Mount the SSH agent socket for this command +RUN --mount=type=ssh \ + cargo build --release --quiet + +# Stage 2: Create the final, smaller runtime image +# Use a minimal base image like debian-slim or even distroless for security/size +FROM ubuntu:24.04 + +# Install runtime dependencies if needed (e.g., SSL certificates) +RUN apt-get update && apt-get install -y ca-certificates libssl-dev libssl3 && rm -rf /var/lib/apt/lists/* + +# Set the working directory +WORKDIR /usr/local/bin + +# Copy the compiled binary from the builder stage +# Replace 'icarus' with the actual name of your binary (usually the crate name) +COPY --from=builder /usr/src/app/target/release/icarus . + +# Copy other necessary files like .env (if used for runtime config) or static assets +# It's generally better to configure via environment variables in Docker though +# COPY --from=builder /usr/src/app/.env . +# COPY --from=builder /usr/src/app/migrations ./migrations +# COPY --from=builder /usr/src/app/templates ./templates +# COPY --from=builder /usr/src/app/static ./static + +# Expose the port your Axum app listens on (e.g., 3000 or 8000) +EXPOSE 3000 + +# Set the command to run your application +# Ensure this matches the binary name copied above +CMD ["./icarus"] -- 2.47.3 From fadd1ae5e6647bd8692031736eb9683d639cd34d Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 12 Apr 2025 16:05:54 -0400 Subject: [PATCH 02/15] Added docker files --- docker-compose.yaml | 54 +++++++++++++++++++++++++++++++++++++++++++++ dockerignore.yaml | 19 ++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 docker-compose.yaml create mode 100644 dockerignore.yaml diff --git a/docker-compose.yaml b/docker-compose.yaml new file mode 100644 index 0000000..2b76b8b --- /dev/null +++ b/docker-compose.yaml @@ -0,0 +1,54 @@ +version: '3.8' # Use a recent version + +services: + # Your Rust Application Service + app: + build: . # Tells docker-compose to build the Dockerfile in the current directory + container_name: icarus # Optional: Give the container a specific name + ports: + # Map host port 8000 to container port 3000 (adjust as needed) + # Format: "HOST_PORT:CONTAINER_PORT" + - "8000:3000" + environment: + # Pass environment variables to your Rust application + # RUST_LOG: info # Example: Set log level + # IMPORTANT: Configure DATABASE_URL to connect to the 'db' service + # The hostname 'db' matches the service name defined below. + DATABASE_URL: postgresql://icarus:password@db:5432/icarus + # Add any other environment variables your app needs + # APP_HOST: 0.0.0.0 + # APP_PORT: 3000 + depends_on: + db: + condition: service_healthy # Wait for the DB to be healthy before starting the app + restart: unless-stopped # Optional: Restart policy + + # PostgreSQL Database Service + db: + image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) + container_name: icarus_db # Optional: Give the container a specific name + environment: + # These MUST match the user, password, and database name in the DATABASE_URL above + POSTGRES_USER: icarus + POSTGRES_PASSWORD: password + POSTGRES_DB: icarus + volumes: + # Persist database data using a named volume + - postgres_data:/var/lib/postgresql/data + ports: [] + # Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging) + # - "5432:5432" + # pass: + healthcheck: + # Checks if Postgres is ready to accept connections + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + restart: always # Optional: Restart policy + +# Define the named volume for data persistence +volumes: + postgres_data: + driver: local # Use the default local driver diff --git a/dockerignore.yaml b/dockerignore.yaml new file mode 100644 index 0000000..9b144ce --- /dev/null +++ b/dockerignore.yaml @@ -0,0 +1,19 @@ +# Ignore build artifacts +target/ +pkg/ + +# Ignore git directory +.git/ + +# Ignore environment files (configure via docker-compose instead) +.env* + +# Ignore IDE/editor specific files +.idea/ +.vscode/ + +# Ignore OS specific files +*.DS_Store + +# Add any other files/directories you don't need in the image +# e.g., logs/, tmp/ \ No newline at end of file -- 2.47.3 From 88a8f170547e57e1f86b5abf6ccfc4c6b2433fd4 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 12 Apr 2025 16:22:40 -0400 Subject: [PATCH 03/15] Updated docker Added icarus_auth and second db --- docker-compose.yaml | 54 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 52 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 2b76b8b..2e80cd9 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -23,6 +23,25 @@ services: condition: service_healthy # Wait for the DB to be healthy before starting the app restart: unless-stopped # Optional: Restart policy + # --- Web API Service --- + auth: + build: + context: ../icarus_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile) + dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name + container_name: auth_api + restart: unless-stopped + ports: + - "8000:3000" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile) + environment: + # Environment variables your API needs, e.g., database connection + DATABASE_URL: postgresql://icarus_op:password@postgres:5432/icarus_auth + # Add other necessary environment variables + depends_on: + - auth_db # Ensures Postgres starts before the web API attempts to connect + # Optional: Mount local code for development (live reload) + # volumes: + # - ./path/to/your/web-api-repo:/app + # PostgreSQL Database Service db: image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) @@ -35,9 +54,33 @@ services: volumes: # Persist database data using a named volume - postgres_data:/var/lib/postgresql/data - ports: [] + ports: # Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging) - # - "5432:5432" + - "5432:5432" + # pass: + healthcheck: + # Checks if Postgres is ready to accept connections + test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] + interval: 10s + timeout: 5s + retries: 5 + start_period: 10s + restart: always # Optional: Restart policy + + auth_db: + image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) + container_name: icarus_auth_db # Optional: Give the container a specific name + environment: + # These MUST match the user, password, and database name in the DATABASE_URL above + POSTGRES_USER: icarus + POSTGRES_PASSWORD: password + POSTGRES_DB: icarus_auth + volumes: + # Persist database data using a named volume + - postgres_data_auth:/var/lib/postgresql/data + ports: + # Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging) + - "5433:5432" # pass: healthcheck: # Checks if Postgres is ready to accept connections @@ -52,3 +95,10 @@ services: volumes: postgres_data: driver: local # Use the default local driver + postgres_data_auth: + driver: local # Use the default local driver + +# Define the network (optional, but good practice) +networks: + app-network: + driver: bridge -- 2.47.3 From 4a39facc84b6cba700923553f729482205cc6c8d Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 12 Apr 2025 16:25:40 -0400 Subject: [PATCH 04/15] Cleanup --- docker-compose.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 2e80cd9..98c636b 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,8 +1,8 @@ version: '3.8' # Use a recent version services: - # Your Rust Application Service - app: + # --- Web API --- + api: build: . # Tells docker-compose to build the Dockerfile in the current directory container_name: icarus # Optional: Give the container a specific name ports: @@ -23,7 +23,7 @@ services: condition: service_healthy # Wait for the DB to be healthy before starting the app restart: unless-stopped # Optional: Restart policy - # --- Web API Service --- + # --- Web API auth --- auth: build: context: ../icarus_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile) @@ -43,6 +43,7 @@ services: # - ./path/to/your/web-api-repo:/app # PostgreSQL Database Service + # --- icarus web api db db: image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) container_name: icarus_db # Optional: Give the container a specific name @@ -67,6 +68,7 @@ services: start_period: 10s restart: always # Optional: Restart policy + # --- icarus web auth api db auth_db: image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) container_name: icarus_auth_db # Optional: Give the container a specific name @@ -101,4 +103,4 @@ volumes: # Define the network (optional, but good practice) networks: app-network: - driver: bridge + driver: bridge \ No newline at end of file -- 2.47.3 From de0157ac9fe5193c7da863cbf7aa928b656cae07 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 12 Apr 2025 16:33:33 -0400 Subject: [PATCH 05/15] Docker changes --- docker-compose.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 98c636b..a8446b2 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -31,7 +31,7 @@ services: container_name: auth_api restart: unless-stopped ports: - - "8000:3000" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile) + - "8001:3000" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile) environment: # Environment variables your API needs, e.g., database connection DATABASE_URL: postgresql://icarus_op:password@postgres:5432/icarus_auth @@ -74,7 +74,7 @@ services: container_name: icarus_auth_db # Optional: Give the container a specific name environment: # These MUST match the user, password, and database name in the DATABASE_URL above - POSTGRES_USER: icarus + POSTGRES_USER: icarus_op POSTGRES_PASSWORD: password POSTGRES_DB: icarus_auth volumes: -- 2.47.3 From 194d86d16880c6491c8daf198f4d27ef9f6fe802 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sat, 12 Apr 2025 17:25:58 -0400 Subject: [PATCH 06/15] Saving changes Still running into issues with icarus_auth starting in docker. Must be related to credentials or url --- Dockerfile | 4 ++-- docker-compose.yaml | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 74c9a60..9f6aa10 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ COPY src ./src # If you have other directories like `templates` or `static`, copy them too # COPY templates ./templates # COPY static ./static -# COPY .env ./.env +COPY .env ./.env # COPY migrations ./migrations # << --- SSH MOUNT ADDED HERE --- >> @@ -62,7 +62,7 @@ COPY --from=builder /usr/src/app/target/release/icarus . # Copy other necessary files like .env (if used for runtime config) or static assets # It's generally better to configure via environment variables in Docker though -# COPY --from=builder /usr/src/app/.env . +COPY --from=builder /usr/src/app/.env . # COPY --from=builder /usr/src/app/migrations ./migrations # COPY --from=builder /usr/src/app/templates ./templates # COPY --from=builder /usr/src/app/static ./static diff --git a/docker-compose.yaml b/docker-compose.yaml index a8446b2..311d60e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -20,7 +20,9 @@ services: # APP_PORT: 3000 depends_on: db: - condition: service_healthy # Wait for the DB to be healthy before starting the app + condition: service_healthy + networks: + - app-network restart: unless-stopped # Optional: Restart policy # --- Web API auth --- @@ -34,10 +36,15 @@ services: - "8001:3000" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile) environment: # Environment variables your API needs, e.g., database connection - DATABASE_URL: postgresql://icarus_op:password@postgres:5432/icarus_auth + DATABASE_URL: postgresql://icarus_op:password@auth_db:5432/icarus_auth # Add other necessary environment variables + env_file: + - ../icarus_auth/.env depends_on: - - auth_db # Ensures Postgres starts before the web API attempts to connect + auth_db: + condition: service_healthy + networks: + - app-network # Optional: Mount local code for development (live reload) # volumes: # - ./path/to/your/web-api-repo:/app -- 2.47.3 From be32576c868001bb911dc3bcc4192d81f214442c Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 11:47:13 -0400 Subject: [PATCH 07/15] Changes to docker --- docker-compose.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 311d60e..0d4842e 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -14,19 +14,19 @@ services: # RUST_LOG: info # Example: Set log level # IMPORTANT: Configure DATABASE_URL to connect to the 'db' service # The hostname 'db' matches the service name defined below. - DATABASE_URL: postgresql://icarus:password@db:5432/icarus + DATABASE_URL: postgresql://icarus:password@main_db:5432/icarus_db # Add any other environment variables your app needs # APP_HOST: 0.0.0.0 # APP_PORT: 3000 depends_on: - db: + main_db: condition: service_healthy networks: - app-network restart: unless-stopped # Optional: Restart policy # --- Web API auth --- - auth: + auth_api: build: context: ../icarus_auth # IMPORTANT: Relative path to the local checkout of your web API repo (containing the Dockerfile) dockerfile: Dockerfile # Optional: Specify if your Dockerfile has a non-standard name @@ -36,10 +36,10 @@ services: - "8001:3000" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile) environment: # Environment variables your API needs, e.g., database connection - DATABASE_URL: postgresql://icarus_op:password@auth_db:5432/icarus_auth + DATABASE_URL: postgresql://icarus:password@auth_db:5432/icarus_auth_db # Add other necessary environment variables - env_file: - - ../icarus_auth/.env + # env_file: + # - ../icarus_auth/.env depends_on: auth_db: condition: service_healthy @@ -51,14 +51,14 @@ services: # PostgreSQL Database Service # --- icarus web api db - db: + main_db: image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) container_name: icarus_db # Optional: Give the container a specific name environment: # These MUST match the user, password, and database name in the DATABASE_URL above POSTGRES_USER: icarus POSTGRES_PASSWORD: password - POSTGRES_DB: icarus + POSTGRES_DB: icarus_db volumes: # Persist database data using a named volume - postgres_data:/var/lib/postgresql/data @@ -81,9 +81,9 @@ services: container_name: icarus_auth_db # Optional: Give the container a specific name environment: # These MUST match the user, password, and database name in the DATABASE_URL above - POSTGRES_USER: icarus_op + POSTGRES_USER: icarus POSTGRES_PASSWORD: password - POSTGRES_DB: icarus_auth + POSTGRES_DB: icarus_auth_db volumes: # Persist database data using a named volume - postgres_data_auth:/var/lib/postgresql/data -- 2.47.3 From d0cfcf34991e77f863f136ec5e8d3a018c35c92f Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:35:07 -0400 Subject: [PATCH 08/15] Got auth_api working --- docker-compose.yaml | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 0d4842e..26d0ebf 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,20 +9,22 @@ services: # Map host port 8000 to container port 3000 (adjust as needed) # Format: "HOST_PORT:CONTAINER_PORT" - "8000:3000" - environment: + # environment: # Pass environment variables to your Rust application # RUST_LOG: info # Example: Set log level # IMPORTANT: Configure DATABASE_URL to connect to the 'db' service # The hostname 'db' matches the service name defined below. - DATABASE_URL: postgresql://icarus:password@main_db:5432/icarus_db + # DATABASE_URL: postgresql://icarus:password@main_db:5432/icarus_db # Add any other environment variables your app needs # APP_HOST: 0.0.0.0 # APP_PORT: 3000 + env_file: + - .env depends_on: main_db: condition: service_healthy networks: - - app-network + - main-api-network restart: unless-stopped # Optional: Restart policy # --- Web API auth --- @@ -34,17 +36,17 @@ services: restart: unless-stopped ports: - "8001:3000" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile) - environment: + # environment: # Environment variables your API needs, e.g., database connection - DATABASE_URL: postgresql://icarus:password@auth_db:5432/icarus_auth_db + # DATABASE_URL: postgresql://icarus:password@auth_db:5432/icarus_auth_db # Add other necessary environment variables - # env_file: - # - ../icarus_auth/.env + env_file: + - ../icarus_auth/.env depends_on: auth_db: condition: service_healthy networks: - - app-network + - auth-api-network # Optional: Mount local code for development (live reload) # volumes: # - ./path/to/your/web-api-repo:/app @@ -56,9 +58,9 @@ services: container_name: icarus_db # Optional: Give the container a specific name environment: # These MUST match the user, password, and database name in the DATABASE_URL above - POSTGRES_USER: icarus - POSTGRES_PASSWORD: password - POSTGRES_DB: icarus_db + POSTGRES_USER: ${POSTGRES_USER:-icarus} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password} + POSTGRES_DB: ${POSTGRES_DB:-icarus_db} volumes: # Persist database data using a named volume - postgres_data:/var/lib/postgresql/data @@ -74,6 +76,8 @@ services: retries: 5 start_period: 10s restart: always # Optional: Restart policy + networks: + - main-api-network # --- icarus web auth api db auth_db: @@ -81,9 +85,9 @@ services: container_name: icarus_auth_db # Optional: Give the container a specific name environment: # These MUST match the user, password, and database name in the DATABASE_URL above - POSTGRES_USER: icarus - POSTGRES_PASSWORD: password - POSTGRES_DB: icarus_auth_db + POSTGRES_USER: ${POSTGRES_USER:-icarus_op} + POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-password} + POSTGRES_DB: ${POSTGRES_DB:-icarus_auth_db} volumes: # Persist database data using a named volume - postgres_data_auth:/var/lib/postgresql/data @@ -99,6 +103,8 @@ services: retries: 5 start_period: 10s restart: always # Optional: Restart policy + networks: + - auth-api-network # Define the named volume for data persistence volumes: @@ -109,5 +115,7 @@ volumes: # Define the network (optional, but good practice) networks: - app-network: + main-api-network: + driver: bridge + auth-api-network: driver: bridge \ No newline at end of file -- 2.47.3 From 72cf8ca9175596df588e64ebdcf0eda3955005dc Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:36:30 -0400 Subject: [PATCH 09/15] Cleanup --- docker-compose.yaml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 26d0ebf..6b93d40 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -9,15 +9,6 @@ services: # Map host port 8000 to container port 3000 (adjust as needed) # Format: "HOST_PORT:CONTAINER_PORT" - "8000:3000" - # environment: - # Pass environment variables to your Rust application - # RUST_LOG: info # Example: Set log level - # IMPORTANT: Configure DATABASE_URL to connect to the 'db' service - # The hostname 'db' matches the service name defined below. - # DATABASE_URL: postgresql://icarus:password@main_db:5432/icarus_db - # Add any other environment variables your app needs - # APP_HOST: 0.0.0.0 - # APP_PORT: 3000 env_file: - .env depends_on: @@ -52,7 +43,7 @@ services: # - ./path/to/your/web-api-repo:/app # PostgreSQL Database Service - # --- icarus web api db + # --- icarus web api db --- main_db: image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) container_name: icarus_db # Optional: Give the container a specific name @@ -67,7 +58,6 @@ services: ports: # Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging) - "5432:5432" - # pass: healthcheck: # Checks if Postgres is ready to accept connections test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] @@ -79,7 +69,7 @@ services: networks: - main-api-network - # --- icarus web auth api db + # --- icarus web auth api db --- auth_db: image: postgres:17.4-alpine # Use an official Postgres image (Alpine variant is smaller) container_name: icarus_auth_db # Optional: Give the container a specific name @@ -94,7 +84,6 @@ services: ports: # Optional: Expose port 5432 ONLY if you need to connect directly from your host machine (e.g., for debugging) - "5433:5432" - # pass: healthcheck: # Checks if Postgres is ready to accept connections test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"] -- 2.47.3 From e8ce5777391d5127f57d62b9d129c1895cf432fc Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:41:45 -0400 Subject: [PATCH 10/15] Docker cleanup --- Dockerfile | 6 ------ docker-compose.yaml | 1 - 2 files changed, 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9f6aa10..97a8c0d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,10 +34,7 @@ RUN --mount=type=ssh mkdir src && \ # Copy the actual source code COPY src ./src # If you have other directories like `templates` or `static`, copy them too -# COPY templates ./templates -# COPY static ./static COPY .env ./.env -# COPY migrations ./migrations # << --- SSH MOUNT ADDED HERE --- >> # Build *only* dependencies to leverage Docker cache @@ -63,9 +60,6 @@ COPY --from=builder /usr/src/app/target/release/icarus . # Copy other necessary files like .env (if used for runtime config) or static assets # It's generally better to configure via environment variables in Docker though COPY --from=builder /usr/src/app/.env . -# COPY --from=builder /usr/src/app/migrations ./migrations -# COPY --from=builder /usr/src/app/templates ./templates -# COPY --from=builder /usr/src/app/static ./static # Expose the port your Axum app listens on (e.g., 3000 or 8000) EXPOSE 3000 diff --git a/docker-compose.yaml b/docker-compose.yaml index 6b93d40..041fdb3 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -29,7 +29,6 @@ services: - "8001:3000" # Map host port 8000 to container port 8000 (adjust container port based on your app's EXPOSE in Dockerfile) # environment: # Environment variables your API needs, e.g., database connection - # DATABASE_URL: postgresql://icarus:password@auth_db:5432/icarus_auth_db # Add other necessary environment variables env_file: - ../icarus_auth/.env -- 2.47.3 From d545df6fce8775af3803d85906bdfacd79a0af64 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:45:59 -0400 Subject: [PATCH 11/15] Updated gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 4579bb3..8422d0b 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /target Cargo.lock +.env -- 2.47.3 From ac8b11824c34db5876d72e6ceaa1a08b4d428f15 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:46:34 -0400 Subject: [PATCH 12/15] Added README --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..64ee5d9 --- /dev/null +++ b/README.md @@ -0,0 +1,15 @@ + + +# Getting Started +## Docker +Make sure `icarus_auth` is located in the root of the parent directory if using docker. + +Create a `.env` file for both projects - `icarus_auth` and `icarus` - in the root of each project. + +Build containers +``` +docker compose build --ssh default api auth_api +``` + +Bring it up +docker compose up -d --force-recreate api auth_api \ No newline at end of file -- 2.47.3 From 454ff08d4815b4e6d4da5603e58332e72c9adc34 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:47:06 -0400 Subject: [PATCH 13/15] Updated gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8422d0b..427ed2c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,5 @@ /target Cargo.lock .env + +.DS_STORE -- 2.47.3 From 6107209ee11876bbaaeecb26956e1ac4e32a59c5 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:48:59 -0400 Subject: [PATCH 14/15] Added directory to ignore to dockerignore --- dockerignore.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dockerignore.yaml b/dockerignore.yaml index 9b144ce..42e9c27 100644 --- a/dockerignore.yaml +++ b/dockerignore.yaml @@ -5,6 +5,8 @@ pkg/ # Ignore git directory .git/ +.github/ + # Ignore environment files (configure via docker-compose instead) .env* -- 2.47.3 From 7fc9d22b3dfb7c13a24348dbe1b40d2e13dbb720 Mon Sep 17 00:00:00 2001 From: phoenix Date: Sun, 13 Apr 2025 14:49:16 -0400 Subject: [PATCH 15/15] File name change --- dockerignore.yaml => .dockerignore.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename dockerignore.yaml => .dockerignore.yaml (100%) diff --git a/dockerignore.yaml b/.dockerignore.yaml similarity index 100% rename from dockerignore.yaml rename to .dockerignore.yaml -- 2.47.3