goproxy: add goproxy to AppManager and use it in CI via flake.nix

Change-Id: I489d202c34219434653cfe3afbb19937dadd204e
diff --git a/charts/goproxy/.helmignore b/charts/goproxy/.helmignore
new file mode 100644
index 0000000..0e8a0eb
--- /dev/null
+++ b/charts/goproxy/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/charts/goproxy/Chart.yaml b/charts/goproxy/Chart.yaml
new file mode 100644
index 0000000..4eb5f60
--- /dev/null
+++ b/charts/goproxy/Chart.yaml
@@ -0,0 +1,6 @@
+apiVersion: v2
+name: goproxy
+description: A Helm chart for goproxy
+type: application
+version: 0.0.1
+appVersion: "0.0.1"
diff --git a/charts/goproxy/templates/install.yaml b/charts/goproxy/templates/install.yaml
new file mode 100644
index 0000000..2d07294
--- /dev/null
+++ b/charts/goproxy/templates/install.yaml
@@ -0,0 +1,64 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: goproxy
+  namespace: {{ .Release.Namespace }}
+spec:
+  type: ClusterIP
+  selector:
+    app: goproxy
+  ports:
+  - name: http
+    port: {{ .Values.servicePort }}
+    targetPort: http
+    protocol: TCP
+---
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: goproxy
+  namespace: {{ .Release.Namespace }}
+spec:
+  selector:
+    matchLabels:
+      app: goproxy
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        app: goproxy
+    spec:
+      securityContext:
+        fsGroup: 65534
+        fsGroupChangePolicy: OnRootMismatch
+      containers:
+      - name: goproxy
+        image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
+        imagePullPolicy: {{ .Values.image.pullPolicy }}
+        ports:
+        - name: http
+          containerPort: {{ .Values.port }}
+          protocol: TCP
+        command:
+        - /usr/local/bin/goproxy
+        - server
+        - --address=:{{ .Values.port }}
+        - --cacher-dir=/go/pkg/mod
+        env:
+        - name: GOMODCACHE
+          value: /go/pkg/mod
+        volumeMounts:
+          - name: cache-volume
+            mountPath: /go/pkg/mod
+        securityContext:
+          runAsUser: 65534
+          runAsGroup: 65534
+      volumes:
+      - name: cache-volume
+        persistentVolumeClaim:
+          claimName: {{ .Values.persistentVolumeClaimName }}
+      tolerations:
+      - key: "pcloud"
+        operator: "Equal"
+        value: "role"
+        effect: "NoSchedule"
diff --git a/charts/goproxy/values.yaml b/charts/goproxy/values.yaml
new file mode 100644
index 0000000..82926f6
--- /dev/null
+++ b/charts/goproxy/values.yaml
@@ -0,0 +1,7 @@
+image:
+  repository: ghcr.io/goproxy/goproxy
+  tag: latest
+  pullPolicy: Always
+port: 8080
+servicePort: 80
+persistentVolumeClaimName: data
diff --git a/core/installer/app_repository.go b/core/installer/app_repository.go
index 509c7e9..d1c5f5c 100644
--- a/core/installer/app_repository.go
+++ b/core/installer/app_repository.go
@@ -39,6 +39,7 @@
 	// "values-tmpl/qbittorrent.cue",
 	// "values-tmpl/jellyfin.cue",
 	"values-tmpl/rpuppy.cue",
+	"values-tmpl/goproxy.cue",
 	"values-tmpl/certificate-issuer-custom.cue",
 }
 
diff --git a/core/installer/values-tmpl/goproxy.cue b/core/installer/values-tmpl/goproxy.cue
new file mode 100644
index 0000000..e7baaef
--- /dev/null
+++ b/core/installer/values-tmpl/goproxy.cue
@@ -0,0 +1,87 @@
+input: {
+	network:   #Network @name(Network)
+	subdomain: string   @name(Subdomain)
+}
+
+_domain: "\(input.subdomain).\(input.network.domain)"
+
+name:        "goproxy"
+namespace:   "app-goproxy"
+readme:      "goproxy application will be installed on \(input.network.name) network and be accessible to any user on https://\(_domain)"
+description: "Golang module proxy."
+icon: """
+			<svg width='50px' height='50px' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 39.68503937 35.28811582'>
+			  <defs>
+			    <style>
+			      .cls-1 {
+			        fill: currentColor;
+			      }
+			
+			      .cls-2 {
+			        fill: none;
+			        stroke: #3a3a3a;
+			        stroke-miterlimit: 10;
+			        stroke-width: .98133445px;
+			      }
+			    </style>
+			  </defs>
+			  <rect class='cls-2' x='-9.97439025' y='-12.17285203' width='59.63381987' height='59.63381987'/>
+			  <path class='cls-1' d='m14.69492647,20.58774252c0,.81187845-.65815748,1.47003733-1.47003733,1.47003733s-1.47003733-.65815888-1.47003733-1.47003733.65815748-1.47003733,1.47003733-1.47003733,1.47003733.65815888,1.47003733,1.47003733Zm11.76029864,1.47003733c.81187845,0,1.47003733-.65815888,1.47003733-1.47003733s-.65815888-1.47003733-1.47003733-1.47003733-1.47003733.65815888-1.47003733,1.47003733.65815888,1.47003733,1.47003733,1.47003733Zm11.93302847-1.67400512c-.28823261.13266248-.60148138.20220416-.91877333.20396779-.67326615-.00164868-1.30777436-.31516942-1.71810725-.84894566l-.47592391-.60455162v9.53870259c0,3.65345583-2.96171215,6.61516798-6.61516798,6.61516798H11.01983314c-3.65345653,0-6.61516798-2.96171215-6.61516798-6.61516798v-9.53870539l-.46489908.60087854c-.4112799.53507163-1.04691527.84983729-1.72178173.85262154-.31731614-.00153652-.63061468-.07108941-.91877333-.20396779-.93389637-.40992073-1.45678447-1.41441689-1.25688194-2.4145362L3.05958106,1.79882791C3.28415382.60189453,4.43651156-.18635988,5.63344528.03821253c.0427079.00801312.08516977.01728658.12732951.02780882h.02940072l9.74634766,2.88127322h8.60706789L33.89728908.08072171h.02940142c1.1815748-.29489426,2.3784896.42390294,2.67338421,1.6054781.01052294.04215975.01979535.08462091.02780882.12732881l3.01725128,16.17041062c.19308035.99533591-.3287598,1.99171485-1.25688124,2.39983549ZM14.18960113,4.08289846L5.38591511,1.49563243c-.05549777-.01236298-.1121963-.01852589-.16905396-.01837519-.35274343.00096593-.655062.25238438-.72031866.5990399L1.47929086,18.24670707c-.07691341.39858747.18385385.78405561.58244062.86096867.27107851.05230907.54860733-.05169782.7185424-.26927842L14.18960113,4.08289846Zm19.61581061,13.1513214l-9.92275197-12.81688797h-8.08520531l-9.92275197,12.81688797v11.43872797c0,2.84157738,2.30355327,5.14513065,5.14513065,5.14513065h8.08520531v-3.3700599l-2.72508204-2.72508204c-.28720218-.28720359-.28720218-.7528485,0-1.04005208s.7528499-.28720359,1.04005208,0l2.42004862,2.42004862,2.42004862-2.42004862c.28720359-.28720359.7528485-.28720359,1.04005208,0s.28720359.7528485,0,1.04005208l-2.72508204,2.72508204v3.3700599h8.08520531c2.84157738,0,5.14513065-2.30355327,5.14513065-5.14513065v-11.43872797Zm4.39541128,1.00697619l-3.01725128-16.17041062c-.07464473-.39901786-.45862401-.66197355-.85764328-.58732812-.01062388.00198795-.02120289.00420932-.03172863.00666341l-8.80368673,2.59277845,11.41300243,14.75182508c.25293745.31750505.71537192.36984776,1.03287697.11691312.21288131-.1695895.31462267-.44293353.26443052-.71044131Z'/>
+			</svg>"""
+
+_webPort: 8080
+_webServicePort: 80
+
+out: {
+	ingress: {
+		goproxy: {
+			auth:      enabled: false
+			network:   input.network
+			subdomain: input.subdomain
+			service: {
+				name: "goproxy"
+				port: _webServicePort
+			}
+		}
+	}
+
+	images: {
+		goproxy: {
+			registry: "ghcr.io"
+                        repository: "goproxy"
+			name:       "goproxy"
+			tag:        "0.26.1"
+			pullPolicy: "IfNotPresent"
+		}
+	}
+
+	charts: {
+		goproxy: {
+			kind:    "GitRepository"
+			address: "https://code.v1.dodo.cloud/helm-charts"
+			branch:  "main"
+			path:    "charts/goproxy"
+		}
+	}
+
+	volume: data: size: "50Gi"
+
+	helm: {
+		goproxy: {
+			chart: charts.goproxy
+			info:  "Installing goproxy server"
+			values: {
+				image: {
+					repository: images.goproxy.fullName
+					tag:        images.goproxy.tag
+					pullPolicy: images.goproxy.pullPolicy
+				}
+				port: _webPort
+                                servicePort: _webServicePort
+                                persistentVolumeClaimName: "data"
+			}
+		}
+	}
+}
+
+url: "https://\(_domain)"
diff --git a/flake.nix b/flake.nix
index 5a108db..4ca91c3 100644
--- a/flake.nix
+++ b/flake.nix
@@ -52,6 +52,9 @@
 
           PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD = "1";
           PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = "true";
+
+          GOPROXY = "https://goproxy.v1.dodo.cloud";
+          GONOPROXY = "none";
         };
       }
     );