From 1eab5bf6b9b24bf2e701aa261bb67fd8da8ad907 Mon Sep 17 00:00:00 2001
From: Neil South <104848880+neildsouth@users.noreply.github.com>
Date: Thu, 27 Jun 2024 10:56:05 +0100
Subject: [PATCH] updating the dev guide so it works (#1004)

Signed-off-by: Neil South <neil.south@answerdigital.com>
---
 guidelines/mwm-developer-setup.md             | 22 ++++++++--
 .../TaskManager/appsettings.Local.json        |  6 +--
 .../WorkflowManager/appsettings.Local.json    |  9 ++++-
 .../WorkflowManager.Tests/packages.lock.json  | 40 +++++++++----------
 4 files changed, 48 insertions(+), 29 deletions(-)
 mode change 100644 => 100755 tests/UnitTests/WorkflowManager.Tests/packages.lock.json

diff --git a/guidelines/mwm-developer-setup.md b/guidelines/mwm-developer-setup.md
index 2805972d5..736342a31 100755
--- a/guidelines/mwm-developer-setup.md
+++ b/guidelines/mwm-developer-setup.md
@@ -21,7 +21,7 @@
 - python 3 installed.
 - Helm 3 https://helm.sh/docs/intro/install/
 - rabbitmqadmin https://www.rabbitmq.com/management-cli.html
-- mc.exe https://github.com/minio/mc install and add its location to the storage_settings_executableLocation setting (appsettings.local.json) including the name itself ! ie `mc.exe` if its in the folder of the running executable (\bin\Debug\net8.0).
+- mc.exe https://github.com/minio/mc install and add its location to the storage_settings_executableLocation setting (appsettings.local.json) including the name itself ! ie `mc.exe` if its in the folder of the running executable (\bin\Debug\net8.0). (for TaskManager)
 
 Note. if you already have docker container for Minio Rabbit etc running Stop these.
 
@@ -44,6 +44,7 @@ To disable argo authentication run
     ]}]'
 
 Note. below Im using bash as its my preferred option, But if you to are using bash and your on windows (wsl2) you MUST make sure you windows .kube/config is also pointing to the same K8's cluster, this is because the code running in vs will look in there for the context to write k8's secrets too!
+you can do this by coping the relevent sections from ~/.kube/config to C:\Users\yourname\.kube\config
 
 now in a bash window (can be cmd or powershell)
 
@@ -73,6 +74,21 @@ from a bash terminal in the root folder of the project
 - `helm upgrade -i -n argo -f deploy/helm/rabbitmq-local.yaml rabbit deploy/helm`
 
 ### running in VisualStudio
+---
+### NEW
+------
+You must now also run Informaticsgateway (mig), this is a separate project and is required for the workflow to validate and run.
+
+### create an AETitle in the mig
+below assumes you are running mig on port 5010.
+```
+curl -X POST 'http://localhost:5010/config/destination' -H 'Content-Type: application/json' -d '{"name": "MY_SCANNER",  "hostIp": "127.0.0.1",  "port": 10,  "aeTitle": "MY_SCANNER"}'
+
+```
+
+
+----
+
 Now assuming your launchSettings in workflow manager has the line 
 `"ASPNETCORE_ENVIRONMENT": "Local"`
 AND in taskManager has the line
@@ -181,7 +197,7 @@ You can use Mongo Compass, with connection string `mongodb://root:rootpassword@l
 ### now we need an argo template to run.
 navigate to [https://localhost:2746/workflow-templates?namespace=argo](https://localhost:2746/workflow-templates?namespace=argo) proceed passed the warnings about been insecure. (Chrome, click advance and then proceed to destination)
 click on `CREATE NEW WORKFLOW TEMPLATE` button top left.
-set the name to `name: simple-workflow` so it matches the workflow we posted above.
+set the name to `name: simple-workflow` and its namespace to `namespace: argo` so it matches the workflow we posted above.
 then click the `Create` button.
 switch the tab back to [workflows](https://localhost:2746/workflows?limit=50) in the left menu
 
@@ -190,7 +206,7 @@ switch the tab back to [workflows](https://localhost:2746/workflows?limit=50) in
 
 In the command below replace xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx with the new workflowId from above ie. `9235f5e8-9ad2-44d2-8b41-2c1e4d2464c6`
 
-```rabbitmqadmin -u admin -p admin -P 30672 -V monaideploy publish exchange=monaideploy routing_key=md.workflow.request  properties="{\"app_id\": \"16988a78-87b5-4168-a5c3-2cfc2bab8e54\",\"type\": \"WorkflowRequestMessage\",\"message_id\": \"0277e763-316c-4104-aeda-3620e7a642c7\",\"correlation_id\":\"ab482a7c-4da7-4e76-8d36-d194dd35555e\",\"content_type\": \"application/json\"}" payload="{\"payload_id\":\"00000000-1000-0000-0000-000000000000\",\"workflows\":[\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"],\"file_count\":0,\"correlation_id\":\"e4b06f00-5ce3-4477-86cb-4f3bf20680c2\",\"bucket\":\"bucket1\",\"calling_aetitle\":\"MWM\",\"called_aetitle\":\"Basic_AE_3\",\"timestamp\":\"2022-07-13T11:34:34.8428704+01:00\"}"```
+```rabbitmqadmin -u admin -p admin -P 30672 -V monaideploy publish exchange=monaideploy routing_key=md.workflow.request  properties="{\"app_id\": \"16988a78-87b5-4168-a5c3-2cfc2bab8e54\",\"type\": \"WorkflowRequestMessage\",\"message_id\": \"0277e763-316c-4104-aeda-3620e7a642c7\",\"correlation_id\":\"ab482a7c-4da7-4e76-8d36-d194dd35555e\",\"content_type\": \"application/json\"}" payload="{\"payload_id\":\"00000000-1000-0000-0000-000000000000\",\"workflows\":[\"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\"],\"trigger\":{\"source\":\"MY_SCANNER\",\"destination\":\"PROD_PACS\"},\"file_count\":0,\"correlation_id\":\"e4b06f00-5ce3-4477-86cb-4f3bf20680c2\",\"bucket\":\"bucket1\",\"calling_aetitle\":\"MWM\",\"called_aetitle\":\"Basic_AE_3\",\"timestamp\":\"2022-07-13T11:34:34.8428704+01:00\"}"```
 
 paste the above (with the proper workflowId) into bash and press enter.
 
diff --git a/src/TaskManager/TaskManager/appsettings.Local.json b/src/TaskManager/TaskManager/appsettings.Local.json
index fff763dd0..f58a147a7 100755
--- a/src/TaskManager/TaskManager/appsettings.Local.json
+++ b/src/TaskManager/TaskManager/appsettings.Local.json
@@ -1,6 +1,6 @@
 {
   "WorkloadManagerDatabase": {
-    "ConnectionString": "mongodb://root:rootpassword@localhost:27017",
+    "ConnectionString": "mongodb://root:rootpassword@localhost:30017",
     "DatabaseName": "WorkloadManager"
   },
   "WorkflowManager": {
@@ -43,7 +43,7 @@
         "endpoint": "localhost",
         "username": "admin",
         "password": "admin",
-        "port": "5672",
+        "port": "30072",
         "virtualHost": "monaideploy",
         "exchange": "monaideploy",
         "deadLetterExchange": "monaideploy-dead-letter",
@@ -55,7 +55,7 @@
         "endpoint": "localhost",
         "username": "admin",
         "password": "admin",
-        "port": "5672",
+        "port": "30072",
         "virtualHost": "monaideploy",
         "exchange": "monaideploy",
         "exportRequestQueue": "export_tasks"
diff --git a/src/WorkflowManager/WorkflowManager/appsettings.Local.json b/src/WorkflowManager/WorkflowManager/appsettings.Local.json
index cd86c2532..cc582a9dd 100755
--- a/src/WorkflowManager/WorkflowManager/appsettings.Local.json
+++ b/src/WorkflowManager/WorkflowManager/appsettings.Local.json
@@ -1,6 +1,6 @@
 {
   "WorkloadManagerDatabase": {
-    "ConnectionString": "mongodb://root:rootpassword@localhost:27017",
+    "ConnectionString": "mongodb://root:rootpassword@localhost:30017",
     "DatabaseName": "WorkloadManager"
   },
   "MonaiDeployAuthentication": {
@@ -100,7 +100,7 @@
     "migExternalAppPlugins2": [
       "Monai.Deploy.InformaticsGateway.PlugIns.RemoteAppExecution.DicomDeidentifier, Monai.Deploy.InformaticsGateway.PlugIns.RemoteAppExecution, Version=0.0.0.0"
     ],
-    "migExternalAppPlugins": [""],
+    "migExternalAppPlugins": [ "" ],
     "InformaticsGateway": {
       "apiHost": "http://localhost:5010",
       "username": "aide",
@@ -117,5 +117,10 @@
       "LogHttpResponseBody": true
     },
     "AllowedHosts": "*"
+  },
+  "InformaticsGateway": {
+    "apiHost": "http://localhost:5010",
+    "username": "",
+    "password": ""
   }
 }
\ No newline at end of file
diff --git a/tests/UnitTests/WorkflowManager.Tests/packages.lock.json b/tests/UnitTests/WorkflowManager.Tests/packages.lock.json
old mode 100644
new mode 100755
index 4094bcd73..9e85dade8
--- a/tests/UnitTests/WorkflowManager.Tests/packages.lock.json
+++ b/tests/UnitTests/WorkflowManager.Tests/packages.lock.json
@@ -48,13 +48,13 @@
       },
       "xunit": {
         "type": "Direct",
-        "requested": "[2.6.5, )",
-        "resolved": "2.6.5",
-        "contentHash": "iPSL63kw21BdSsdA79bvbVNvyn17DWI4D6VbgNxYtvzgViKrmbRLr8sWPxSlc4AvnofEuFfAi/rrLSzSRomwCg==",
+        "requested": "[2.7.0, )",
+        "resolved": "2.7.0",
+        "contentHash": "KcCI5zxh8zbUfQTeErc4oT7YokViVND2V0p4vDJ2VD4lhF9V5qCYMMDNixme7FdwYy3SwPHF+2xC2Dq4Z9GSlA==",
         "dependencies": {
-          "xunit.analyzers": "1.9.0",
-          "xunit.assert": "2.6.5",
-          "xunit.core": "[2.6.5]"
+          "xunit.analyzers": "1.11.0",
+          "xunit.assert": "2.7.0",
+          "xunit.core": "[2.7.0]"
         }
       },
       "xunit.runner.visualstudio": {
@@ -1876,39 +1876,37 @@
       },
       "xunit.analyzers": {
         "type": "Transitive",
-        "resolved": "1.9.0",
-        "contentHash": "02ucFDty6Y9BBT5c35YueFfbM3uEzeFdRvlNtAPhZVUkGUlhl3jsV2XesgTj986/PZXIjpVoc2D8ee6p1ha/Fw=="
+        "resolved": "1.11.0",
+        "contentHash": "SCv+Ihxv+fCqotGeM8sVwLhw8nzAJ2aFRN5lcoKn9QtGdbVJ79JqDc+4u8/Ddnp2udxtmv+xYFWkHNlb/sk01w=="
       },
       "xunit.assert": {
         "type": "Transitive",
-        "resolved": "2.6.5",
-        "contentHash": "gb5uv7vjBFz7nhEa6aXK5sVJwsG/88xf8DN5wqK0ejCDsDybqICyNJIj+eoD43xbmdPZryNDPpeWDCfiKI/bnA=="
+        "resolved": "2.7.0",
+        "contentHash": "CCTs3bUhmIS4tDwK6Cn/IiabG3RhYzdf65eIkO7u9/grKoN9MrN780LzVED3E8v+vwmmj7b5TW3/GFuZHPAzWA=="
       },
       "xunit.core": {
         "type": "Transitive",
-        "resolved": "2.6.5",
-        "contentHash": "hpdMnSNlx4ejaxpaIAFaqHt4q9ZCnzZLnURrSa5CzYXxHhIQbV8/0yXLjRdublhreonGXVMmsQ1KHlS9WbfpCw==",
+        "resolved": "2.7.0",
+        "contentHash": "98tzqYAbtc/p/2Ba455XTNbD12Qoo8kPehjC4oDT46CAsLli5JOCU9hFF2MV3HHWMw/Y3yFUV2Vcukplbs6kuA==",
         "dependencies": {
-          "xunit.extensibility.core": "[2.6.5]",
-          "xunit.extensibility.execution": "[2.6.5]"
+          "xunit.extensibility.core": "[2.7.0]",
+          "xunit.extensibility.execution": "[2.7.0]"
         }
       },
       "xunit.extensibility.core": {
         "type": "Transitive",
-        "resolved": "2.6.5",
-        "contentHash": "dSGRkVxzH27XaL83+Z9kNPllqgsmsiPayXw+0weCGsrZQxfSCBNNkSb9nYUpkVoEBCUviXOmo1tfApqhgqTjog==",
+        "resolved": "2.7.0",
+        "contentHash": "JLnx4PI0vn1Xr1Ust6ydrp2t/ktm2dyGPAVoDJV5gQuvBMSbd2K7WGzODa2ttiz030CeQ8nbsXl05+cvf7QNyA==",
         "dependencies": {
-          "NETStandard.Library": "1.6.1",
           "xunit.abstractions": "2.0.3"
         }
       },
       "xunit.extensibility.execution": {
         "type": "Transitive",
-        "resolved": "2.6.5",
-        "contentHash": "jUMr88e0lSqDq8Vut0XVqx7plFg91QsKW/rX6gaVnJL6Z19LmNSDmyqd7cg6HQGfboAmyoFZyydA4Kcgouu1BA==",
+        "resolved": "2.7.0",
+        "contentHash": "bjY+crT1jOyxKagFjCMdEVzoenO2v66ru8+CK/0UaXvyG4U9Q3UTieJkbQXbi7/1yZIK1sGh01l5/jh2CwLJtQ==",
         "dependencies": {
-          "NETStandard.Library": "1.6.1",
-          "xunit.extensibility.core": "[2.6.5]"
+          "xunit.extensibility.core": "[2.7.0]"
         }
       },
       "ZstdSharp.Port": {