DodoApp: Auto generate SSH key to access source repositories

Change-Id: I5caaed03ecb52b24c7d30fb121c15d7739607e99
diff --git a/core/installer/app_configs/dodo_app.cue b/core/installer/app_configs/dodo_app.cue
index 56dbdfc..2e1ec57 100644
--- a/core/installer/app_configs/dodo_app.cue
+++ b/core/installer/app_configs/dodo_app.cue
@@ -13,9 +13,9 @@
 	// app-runner registers itself as worker, which later is used by dodo-app server
 	// to ping runners on git push.
 	// TODO(gio): Rethink these variables together with flags in app-runner
-	managerAddr:   string | *""
-	appId:         string | *""
-	sshPrivateKey: string
+	managerAddr: string | *""
+	appId:       string | *""
+	key:         #SSHKey
 	// TODO(gio): this should not be necessary as app.dev.username is autogenerated
 	username?: string
 	if _cluster != _|_ {
@@ -497,16 +497,14 @@
 									containerPort: p.value
 									protocol:      p.protocol
 								}]
-								appDir:   svc.rootDir
-								appId:    input.appId
-								repoAddr: svc.source.repository
-								branch:   svc.source.branch
-								rootDir:  svc.source.rootDir
-								if input.sshPrivateKey != "" {
-									sshPrivateKey: base64.Encode(null, input.sshPrivateKey)
-								}
-								runCfg:      base64.Encode(null, json.Marshal(svc.runConfiguration))
-								managerAddr: input.managerAddr
+								appDir:        svc.rootDir
+								appId:         input.appId
+								repoAddr:      svc.source.repository
+								branch:        svc.source.branch
+								rootDir:       svc.source.rootDir
+								sshPrivateKey: base64.Encode(null, input.key.private)
+								runCfg:        base64.Encode(null, json.Marshal(svc.runConfiguration))
+								managerAddr:   input.managerAddr
 								volumes: [
 									for v in svc.volume {
 										name:      v.name
diff --git a/core/installer/samples/blog.rest b/core/installer/samples/blog.rest
new file mode 100644
index 0000000..0a8606d
--- /dev/null
+++ b/core/installer/samples/blog.rest
@@ -0,0 +1,46 @@
+POST http://appmanager.hgrz-appmanager.svc.cluster.local/api/dodo-app
+Content-Type: application/json
+
+{
+  "id": "blog",
+  "config": {
+    "service": [{
+      "name": "blog",
+      "source": {
+        "repository": "git@github.com:giolekva/dodo-blog.git"
+      },
+      "ingress": [{
+        "auth": {
+          "enabled": true,
+          "noAuthPathPatterns": [
+            "^/_next/.*$",
+            "^/$",
+            "^/entry/.*$"
+          ],
+          "groups": "pr"
+        },
+        "network": "Private",
+        "subdomain": "blog"
+      }],
+      "type": "nextjs:deno-2.0.0",
+      "preBuildCommands": [
+        {
+          "bin": "/usr/bin/deno",
+          "args": [
+            "run",
+            "-A",
+            "npm:prisma",
+            "migrate",
+            "dev"
+          ]
+        }
+      ]
+    }],
+      "postgresql": [
+        {
+          "name": "db",
+          "size": "1Gi"
+        }
+      ]
+  }
+}
\ No newline at end of file
diff --git a/core/installer/canvas-app.cue b/core/installer/samples/canvas.rest
similarity index 100%
rename from core/installer/canvas-app.cue
rename to core/installer/samples/canvas.rest
diff --git a/core/installer/server/appmanager/server.go b/core/installer/server/appmanager/server.go
index 3360ff4..f4b543b 100644
--- a/core/installer/server/appmanager/server.go
+++ b/core/installer/server/appmanager/server.go
@@ -161,9 +161,8 @@
 }
 
 type dodoAppInstallReq struct {
-	Id            string         `json:"id"`
-	SSHPrivateKey string         `json:"sshPrivateKey"`
-	Config        map[string]any `json:"config"`
+	Id     string         `json:"id"`
+	Config map[string]any `json:"config"`
 }
 
 func (s *Server) handleDodoAppInstall(w http.ResponseWriter, r *http.Request) {
@@ -192,9 +191,8 @@
 	appDir := filepath.Join("/dodo-app", req.Id)
 	namespace := "dodo-app-testttt" // TODO(gio)
 	if _, err := s.m.Install(app, req.Id, appDir, namespace, map[string]any{
-		"managerAddr":   "", // TODO(gio)
-		"appId":         req.Id,
-		"sshPrivateKey": req.SSHPrivateKey,
+		"managerAddr": "", // TODO(gio)
+		"appId":       req.Id,
 	}); err != nil {
 		http.Error(w, err.Error(), http.StatusInternalServerError)
 		return