From 325e2f1ee9ae30603cb54036da7d2fb88be113d1 Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 20 Apr 2026 12:18:16 +0200 Subject: [PATCH 1/2] vscode debugging options --- .gitignore | 5 ++- .vscode/docker-compose.debug.yml | 9 ++++ .vscode/launch.json | 61 ++++++++++++++++++++++++++ .vscode/tasks.json | 73 ++++++++++++++++++++++++++++++++ README.Docker.md | 10 ++++- 5 files changed, 155 insertions(+), 3 deletions(-) create mode 100644 .vscode/docker-compose.debug.yml create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json diff --git a/.gitignore b/.gitignore index 065c614..7292033 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,9 @@ obj/ *.log # VS Code -.vscode/ -!.vscode/extensions.json +#.vscode/ +#!.vscode/extensions.json +.vscode/extensions.json !.vscode/launch.json !.vscode/tasks.json diff --git a/.vscode/docker-compose.debug.yml b/.vscode/docker-compose.debug.yml new file mode 100644 index 0000000..ff69307 --- /dev/null +++ b/.vscode/docker-compose.debug.yml @@ -0,0 +1,9 @@ +services: + worktracker: + entrypoint: + - /bin/sh + - -c + command: + - while sleep 1000; do :; done + healthcheck: + disable: true \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2b0caf4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,61 @@ +{ + "version": "0.2.0", + "compounds": [ + { + "name": "WorkTracker: Debug in Docker", + "configurations": [ + "WorkTracker: Debug App in Docker", + "WorkTracker: Debug Edge" + ], + "stopAll": true + } + ], + "configurations": [ + { + "name": "WorkTracker: Debug App in Docker", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "WorkTracker: Docker Debug Prepare", + "postDebugTask": "WorkTracker: Docker Debug Down", + "program": "/workspace/bin/Debug/net10.0/WorkTracker.dll", + "args": [ + "--urls", + "http://+:8080" + ], + "cwd": "/workspace", + "env": { + "ASPNETCORE_ENVIRONMENT": "Development", + "ASPNETCORE_URLS": "http://+:8080", + "DOTNET_USE_POLLING_FILE_WATCHER": "1", + "UseHttpsRedirection": "false" + }, + "sourceFileMap": { + "/workspace": "${workspaceFolder}" + }, + "pipeTransport": { + "pipeProgram": "docker", + "pipeArgs": [ + "exec", + "-i", + "worktracker-dev", + "sh", + "-c" + ], + "debuggerPath": "/vsdbg/vsdbg", + "pipeCwd": "${workspaceFolder}", + "quoteArgs": false + }, + "justMyCode": true, + "requireExactSource": false, + "console": "internalConsole" + }, + { + "name": "WorkTracker: Debug Edge", + "type": "msedge", + "request": "launch", + "url": "http://localhost:8002", + "webRoot": "${workspaceFolder}", + "internalConsoleOptions": "neverOpen" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..3edf94c --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,73 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "WorkTracker: Docker Debug Up", + "type": "shell", + "command": "docker", + "args": [ + "compose", + "-f", + "docker-compose.yml", + "-f", + "docker-compose.override.yml", + "-f", + ".vscode/docker-compose.debug.yml", + "up", + "-d", + "--build", + "worktracker" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [] + }, + { + "label": "WorkTracker: Docker Debug Build", + "type": "shell", + "command": "docker", + "args": [ + "exec", + "worktracker-dev", + "dotnet", + "build", + "WorkTracker.csproj", + "-c", + "Debug" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": "$msCompile" + }, + { + "label": "WorkTracker: Docker Debug Prepare", + "dependsOrder": "sequence", + "dependsOn": [ + "WorkTracker: Docker Debug Up", + "WorkTracker: Docker Debug Build" + ], + "problemMatcher": [] + }, + { + "label": "WorkTracker: Docker Debug Down", + "type": "shell", + "command": "docker", + "args": [ + "compose", + "-f", + "docker-compose.yml", + "-f", + "docker-compose.override.yml", + "-f", + ".vscode/docker-compose.debug.yml", + "down" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [] + } + ] +} \ No newline at end of file diff --git a/README.Docker.md b/README.Docker.md index df5160d..1663df6 100644 --- a/README.Docker.md +++ b/README.Docker.md @@ -25,6 +25,14 @@ Development in Docker: - The override file keeps a containerized `dotnet watch` flow for cases where you still want Docker. - The development container mounts the workspace into `/workspace` and stores its Couchbase Lite files under `./.docker-data/couchbase-dev` on the host. +Debugging in Docker from VS Code: + +- Use the `WorkTracker: Debug in Docker` launch configuration. +- VS Code brings up the development container with `docker compose`, builds the app in `Debug`, and launches `WorkTracker.dll` under `vsdbg` inside the container. +- When the app reports that it is listening, VS Code automatically opens Microsoft Edge in browser debug mode against http://localhost:8002. +- The app remains available at http://localhost:8002 while the debugger is attached. +- Stopping the debug session runs `docker compose down` for the debug stack. + Manual development start: - `docker compose up --build` @@ -37,4 +45,4 @@ Notes: - The base compose file remains production-oriented; the override file is the optional containerized development layer. - The first container build takes longer because the dev image installs the .NET debugger. -- The Dockerfile uses the .NET 9 `*-noble` images so local builds and container builds stay aligned with the SDK available in VS Code. +- The Dockerfile uses the .NET 10 `*-noble` images so local builds and container builds stay aligned with the SDK available in VS Code. From 08e573d63c6fae9f60aecb0d8e011a1e0bfadf1c Mon Sep 17 00:00:00 2001 From: Marco Date: Mon, 20 Apr 2026 14:11:18 +0200 Subject: [PATCH 2/2] Removed auth --- .vscode/tasks.json | 40 +++++++++ Components/Layout/NavMenu.razor | 23 +++-- Components/Pages/ChangePassword.razor | 20 +++++ Components/Pages/Login.razor | 20 +++++ Configuration/AppAuthOptions.cs | 12 +++ Dockerfile | 2 +- Dockerfile.playwright | 10 +++ Program.cs | 88 +++++++++++++++---- README.Docker.md | 15 ++++ .../Auth/DefaultAdminAuthenticationHandler.cs | 48 ++++++++++ appsettings.json | 5 ++ docker-compose.tests.yml | 10 +++ docker-compose.yml | 2 +- package.json | 10 +++ playwright.config.ts | 15 ++++ tests/playwright/auth-bypass.spec.ts | 33 +++++++ tests/playwright/health.spec.ts | 21 +++++ 17 files changed, 348 insertions(+), 26 deletions(-) create mode 100644 Configuration/AppAuthOptions.cs create mode 100644 Dockerfile.playwright create mode 100644 Services/Auth/DefaultAdminAuthenticationHandler.cs create mode 100644 docker-compose.tests.yml create mode 100644 package.json create mode 100644 playwright.config.ts create mode 100644 tests/playwright/auth-bypass.spec.ts create mode 100644 tests/playwright/health.spec.ts diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 3edf94c..ef494e7 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -68,6 +68,46 @@ "cwd": "${workspaceFolder}" }, "problemMatcher": [] + }, + { + "label": "WorkTracker: Docker Playwright Tests", + "type": "shell", + "command": "docker", + "args": [ + "compose", + "-f", + "docker-compose.yml", + "-f", + "docker-compose.tests.yml", + "up", + "--build", + "--abort-on-container-exit", + "--exit-code-from", + "playwright", + "playwright" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [] + }, + { + "label": "WorkTracker: Docker Playwright Down", + "type": "shell", + "command": "docker", + "args": [ + "compose", + "-f", + "docker-compose.yml", + "-f", + "docker-compose.tests.yml", + "down", + "--volumes" + ], + "options": { + "cwd": "${workspaceFolder}" + }, + "problemMatcher": [] } ] } \ No newline at end of file diff --git a/Components/Layout/NavMenu.razor b/Components/Layout/NavMenu.razor index 3ff3c9a..fe28638 100644 --- a/Components/Layout/NavMenu.razor +++ b/Components/Layout/NavMenu.razor @@ -1,4 +1,8 @@ -