From cfeb42d2d2fe43e68976e44273588830c67c8edd Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 09:26:52 +0300 Subject: [PATCH 1/3] Initial commit with task details for issue #32 Adding CLAUDE.md with task information for AI processing. This file will be removed when the task is complete. Issue: https://github.com/linksplatform/Data.Doublets.Gql/issues/32 --- CLAUDE.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 00000000..25735d7c --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,5 @@ +Issue to solve: https://github.com/linksplatform/Data.Doublets.Gql/issues/32 +Your prepared branch: issue-32-77fca98e +Your prepared working directory: /tmp/gh-issue-solver-1757572010387 + +Proceed. \ No newline at end of file From 84ed4c67c8bbfc22fda830e1939a8db6ea9d519f Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 09:27:10 +0300 Subject: [PATCH 2/3] Remove CLAUDE.md - PR created successfully --- CLAUDE.md | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 CLAUDE.md diff --git a/CLAUDE.md b/CLAUDE.md deleted file mode 100644 index 25735d7c..00000000 --- a/CLAUDE.md +++ /dev/null @@ -1,5 +0,0 @@ -Issue to solve: https://github.com/linksplatform/Data.Doublets.Gql/issues/32 -Your prepared branch: issue-32-77fca98e -Your prepared working directory: /tmp/gh-issue-solver-1757572010387 - -Proceed. \ No newline at end of file From 8e14643b1650165a7b3716afaa81ec3574b6ac25 Mon Sep 17 00:00:00 2001 From: konard Date: Thu, 11 Sep 2025 09:30:07 +0300 Subject: [PATCH 3/3] Add Docker support for GQL server MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add Dockerfile with multi-stage build using .NET 6 SDK and runtime - Add docker-compose.yml for easy deployment with volume persistence - Add .dockerignore to optimize build context - Update README.md with Docker deployment instructions - Configure container to use persistent data volume at /app/data - Set default port mapping to match production server (29018) 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .dockerignore | 31 +++++++++++++++++++++++++++++++ Dockerfile | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 26 ++++++++++++++++++++++++++ docker-compose.yml | 19 +++++++++++++++++++ 4 files changed, 114 insertions(+) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docker-compose.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..a81c05fc --- /dev/null +++ b/.dockerignore @@ -0,0 +1,31 @@ +# Directories +**/bin +**/obj +**/out +**/TestResults +**/.vs +**/.vscode +.git +.github +.gitignore +.gitmodules + +# Files +**/*.md +**/*.log +**/*.user +**/*.suo +**/*.userprefs +**/.DS_Store +**/Thumbs.db + +# Exclude non-C# language folders +cpp/ +python/ +rust/ +Settings/ + +# Keep only necessary files for build +!csharp/ +!Dockerfile +!docker-compose.yml \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..874c6c3f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,38 @@ +# Use the .NET 6 SDK for building +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /app + +# Copy solution and project files +COPY csharp/Platform.Data.Doublets.Gql.sln ./ +COPY csharp/Platform.Data.Doublets.Gql.Schema/Platform.Data.Doublets.Gql.Schema.csproj ./Platform.Data.Doublets.Gql.Schema/ +COPY csharp/Platform.Data.Doublets.Gql.Server/Platform.Data.Doublets.Gql.Server.csproj ./Platform.Data.Doublets.Gql.Server/ +COPY csharp/Platform.Data.Doublets.Gql.Tests/Platform.Data.Doublets.Gql.Tests.csproj ./Platform.Data.Doublets.Gql.Tests/ + +# Restore packages +RUN dotnet restore + +# Copy source code +COPY csharp/ ./ + +# Build and publish the application +RUN dotnet publish Platform.Data.Doublets.Gql.Server/Platform.Data.Doublets.Gql.Server.csproj -c Release -o out --no-restore + +# Use the .NET 6 runtime for the final image +FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS runtime +WORKDIR /app + +# Copy the published application +COPY --from=build /app/out . + +# Create directory for database files +RUN mkdir -p /app/data + +# Set environment variables +ENV ASPNETCORE_URLS=http://+:80 +ENV ASPNETCORE_ENVIRONMENT=Production + +# Expose port 80 +EXPOSE 80 + +# Run the application with the database path in the data volume +ENTRYPOINT ["dotnet", "Platform.Data.Doublets.Gql.Server.dll", "/app/data/db.links"] \ No newline at end of file diff --git a/README.md b/README.md index 889bd58f..6b0cd488 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,32 @@ http://linksplatform.ddns.net:29018/v1/graphql ## Start locally +### Option 1: Using Docker (Recommended) + +The easiest way to run the GQL server is using Docker: + +```bash +# Build and run with docker-compose +docker-compose up -d + +# Or build and run manually +docker build -t doublets-gql . +docker run -p 29018:80 -v $(pwd)/data:/app/data doublets-gql +``` + +Navigate to: +* http://localhost:29018/ui/playground +* http://localhost:29018/ui/graphiql +* http://localhost:29018/ui/altair +* http://localhost:29018/ui/voyager + +Or make request at: +http://localhost:29018/v1/graphql + +The database file will be stored in the `./data` directory on your host machine. + +### Option 2: Using .NET directly + Execute: ``` cd csharp/Platform.Data.Doublets.Gql.Server diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 00000000..df7db3bd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.8' + +services: + gql-server: + build: . + ports: + - "29018:80" + volumes: + - ./data:/app/data + environment: + - ASPNETCORE_ENVIRONMENT=Production + - ASPNETCORE_URLS=http://+:80 + restart: unless-stopped + healthcheck: + test: ["CMD", "curl", "-f", "http://localhost:80/ui/playground"] + interval: 30s + timeout: 10s + retries: 3 + start_period: 40s \ No newline at end of file