blob: 974225f3c580ec9a2a429c6e9222d916d635f4fe [file] [log] [blame]
gio0eaf2712024-04-14 13:08:46 +04001import (
2 "encoding/base64"
3 "encoding/json"
4 "strings"
5)
6
7input: {
8 network: #Network @name(Network)
9 subdomain: string @name(Subdomain)
gioefa0ed42024-06-13 12:31:43 +040010 sshPort: int @name(SSH Port) @role(port)
gio23bdc1b2024-07-11 16:07:47 +040011 adminKey: string | *"" @name(Admin SSH Public Key)
12 allowedNetworks: string | *"" @name(Allowed Networks)
gio0eaf2712024-04-14 13:08:46 +040013
14 // TODO(gio): auto generate
15 ssKeys: #SSHKey
16 fluxKeys: #SSHKey
17 dAppKeys: #SSHKey
18}
19
20name: "Dodo App"
21namespace: "dodo-app"
22readme: "Deploy app by pushing to Git repository"
23description: "Deploy app by pushing to Git repository"
24icon: "<svg xmlns='http://www.w3.org/2000/svg' width='50' height='50' viewBox='0 0 48 48'><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M2.837 27.257c3.363 2.45 11.566 3.523 12.546 1.4s.424-10.94.424-10.94s-1.763 1.192-2.302.147s.44-2.433 2.319-2.858c-1.96.05-2.221-.571-2.205-.93s.67-1.878 3.527-1.241c-1.6-.751-1.943-2.956 2.352-1.568c-1.421-.735-.36-2.825 1.649-.62c-.261-1.323 1.584-1.46 2.694.907M10.648 34.633a19 19 0 0 0-4.246.719'/><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M15.144 43.402c3.625-2.482 7.685-6.32 7.293-13.406s-1.6-6.368-.523-7.577s6.924-.99 10.712 3.353c.032-2.874-2.504-5.508-2.504-5.508a33 33 0 0 1 5.53.163c2.852.49 2.394 2.514 3.58 2.035s.971-3.472-.39-5.377c-1.666-2.33-3.223-2.83-6.358-2.188s-4.474.458-5.54-.587s-2.026-3.538-4.605-2.515c-2.935 1.164-4.398 2.438-3.767 5.04s2.34 4.558 2.972 6.844'/><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M22.001 16.552c-.925-.043-1.894.055-1.709 1.328'/><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M20.662 16.763c1.72 2.695 3.405 3.643 9.46 3.501'/><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M32.14 14.966c-1.223.879-2.18 3.781-2.496 5.307M23.1 14.908c.48 1.209 1.23.728 1.315.283a1.552 1.552 0 0 0-1.543-1.883m-.408 17.472c5.328 2.71 11.631.229 16.269-2.123c-1.176 4.572-5.911 5.585-8.916 6.107'/><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M29.099 37.115c4.376-.294 8.024-1.578 7.833-5.296'/><path fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M20.27 38.702c6.771 3.834 12.505.798 13.786-2.615'/><circle cx='24' cy='24' r='21.5' fill='none' stroke='currentColor' stroke-linecap='round' stroke-linejoin='round'/></svg>"
25_domain: "\(input.subdomain).\(input.network.domain)"
26
27images: {
28 softserve: {
29 repository: "charmcli"
30 name: "soft-serve"
31 tag: "v0.7.1"
32 pullPolicy: "IfNotPresent"
33 }
34 dodoApp: {
35 repository: "giolekva"
36 name: "pcloud-installer"
37 tag: "latest"
38 pullPolicy: "Always"
39 }
40}
41
42charts: {
43 softserve: {
giof8843412024-05-22 16:38:05 +040044 kind: "GitRepository"
45 address: "https://github.com/giolekva/pcloud.git"
46 branch: "main"
47 path: "charts/soft-serve"
gio0eaf2712024-04-14 13:08:46 +040048 }
49 dodoApp: {
giof8843412024-05-22 16:38:05 +040050 kind: "GitRepository"
51 address: "https://github.com/giolekva/pcloud.git"
52 branch: "main"
53 path: "charts/dodo-app"
gio0eaf2712024-04-14 13:08:46 +040054 }
55}
56
gioa60f0de2024-07-08 10:49:48 +040057volumes: db: size: "10Gi"
58
59ingress: {
60 "dodo-app": {
61 auth: enabled: false
62 network: input.network
63 subdomain: input.subdomain
64 service: {
65 name: "web"
66 port: name: "http"
67 }
68 }
69}
70
gio0eaf2712024-04-14 13:08:46 +040071portForward: [#PortForward & {
72 allocator: input.network.allocatePortAddr
gioefa0ed42024-06-13 12:31:43 +040073 reservator: input.network.reservePortAddr
giocdfa3722024-06-13 20:10:14 +040074 deallocator: input.network.deallocatePortAddr
gio0eaf2712024-04-14 13:08:46 +040075 sourcePort: input.sshPort
gio3e67ce12024-06-13 19:47:19 +040076 serviceName: "soft-serve"
gio0eaf2712024-04-14 13:08:46 +040077 targetPort: 22
78}]
79
80helm: {
81 softserve: {
82 chart: charts.softserve
giof9f0bee2024-06-11 20:10:05 +040083 info: "Installing Git server"
gio0eaf2712024-04-14 13:08:46 +040084 values: {
85 serviceType: "ClusterIP"
86 addressPool: ""
87 reservedIP: ""
gio266c04f2024-07-03 14:18:45 +040088 adminKey: strings.Join([input.fluxKeys.public, input.dAppKeys.public], "\n")
gio0eaf2712024-04-14 13:08:46 +040089 privateKey: input.ssKeys.private
90 publicKey: input.ssKeys.public
91 ingress: {
92 enabled: false
93 }
94 image: {
95 repository: images.softserve.fullName
96 tag: images.softserve.tag
97 pullPolicy: images.softserve.pullPolicy
98 }
99 }
100 }
101 "dodo-app": {
102 chart: charts.dodoApp
giof9f0bee2024-06-11 20:10:05 +0400103 info: "Installing supervisor"
gio0eaf2712024-04-14 13:08:46 +0400104 values: {
105 image: {
106 repository: images.dodoApp.fullName
107 tag: images.dodoApp.tag
108 pullPolicy: images.dodoApp.pullPolicy
109 }
gioa60f0de2024-07-08 10:49:48 +0400110 port: 8080
111 apiPort: 8081
gio0eaf2712024-04-14 13:08:46 +0400112 repoAddr: "soft-serve.\(release.namespace).svc.cluster.local:22"
113 sshPrivateKey: base64.Encode(null, input.dAppKeys.private)
gioa60f0de2024-07-08 10:49:48 +0400114 self: "api.\(release.namespace).svc.cluster.local"
gio0eaf2712024-04-14 13:08:46 +0400115 namespace: release.namespace
giocb34ad22024-07-11 08:01:13 +0400116 envAppManagerAddr: "http://appmanager.\(global.namespacePrefix)appmanager.svc.cluster.local"
gio0eaf2712024-04-14 13:08:46 +0400117 envConfig: base64.Encode(null, json.Marshal(global))
gio266c04f2024-07-03 14:18:45 +0400118 appAdminKey: input.adminKey
119 gitRepoPublicKey: input.ssKeys.public
gioa60f0de2024-07-08 10:49:48 +0400120 persistentVolumeClaimName: volumes.db.name
gio23bdc1b2024-07-11 16:07:47 +0400121 allowedNetworks: input.allowedNetworks
gio0eaf2712024-04-14 13:08:46 +0400122 }
123 }
124}
125
126resources: {
127 "config-kustomization": {
128 apiVersion: "kustomize.toolkit.fluxcd.io/v1"
129 kind: "Kustomization"
130 metadata: {
gio266c04f2024-07-03 14:18:45 +0400131 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400132 namespace: release.namespace
133 }
134 spec: {
135 interval: "1m"
gio266c04f2024-07-03 14:18:45 +0400136 path: "./"
gio0eaf2712024-04-14 13:08:46 +0400137 sourceRef: {
138 kind: "GitRepository"
gio266c04f2024-07-03 14:18:45 +0400139 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400140 namespace: release.namespace
141 }
142 prune: true
143 }
144 }
145 "config-secret": {
146 apiVersion: "v1"
147 kind: "Secret"
148 type: "Opaque"
149 metadata: {
gio266c04f2024-07-03 14:18:45 +0400150 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400151 namespace: release.namespace
152 }
153 data: {
154 identity: base64.Encode(null, input.fluxKeys.private)
155 "identity.pub": base64.Encode(null, input.fluxKeys.public)
156 known_hosts: base64.Encode(null, "soft-serve.\(release.namespace).svc.cluster.local \(input.ssKeys.public)")
157 }
158 }
159 "config-source": {
160 apiVersion: "source.toolkit.fluxcd.io/v1"
161 kind: "GitRepository"
162 metadata: {
gio266c04f2024-07-03 14:18:45 +0400163 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400164 namespace: release.namespace
165 }
166 spec: {
167 interval: "1m0s"
gio266c04f2024-07-03 14:18:45 +0400168 ref: branch: "master"
169 secretRef: name: "config"
gio0eaf2712024-04-14 13:08:46 +0400170 timeout: "60s"
gio266c04f2024-07-03 14:18:45 +0400171 url: "ssh://soft-serve.\(release.namespace).svc.cluster.local:22/config"
gio0eaf2712024-04-14 13:08:46 +0400172 }
173 }
174}
175
176help: [{
177 title: "How to use"
Davit Tabidze9ca49262024-07-10 15:51:27 +0400178 "contents": """
179 Clone: git clone ssh://\(_domain):\(input.sshPort)/app <div onClick='copyToClipboard(this, "git clone ssh://\(_domain):\(input.sshPort)/app")' style='display: inline-block; cursor: pointer;'> <svg width='26px' height='26px' viewBox='-0 -0 28.80 28.80' fill='#7f9f7f' xmlns='http://www.w3.org/2000/svg' style='outline: none;'> <g id='SVGRepo_bgCarrier' stroke-width='0'></g> <g id='SVGRepo_tracerCarrier' stroke-linecap='round' stroke-linejoin='round'></g> <g id='SVGRepo_iconCarrier'> <path fill-rule='evenodd' clip-rule='evenodd' d='M19.5 16.5L19.5 4.5L18.75 3.75H9L8.25 4.5L8.25 7.5L5.25 7.5L4.5 8.25V20.25L5.25 21H15L15.75 20.25V17.25H18.75L19.5 16.5ZM15.75 15.75L15.75 8.25L15 7.5L9.75 7.5V5.25L18 5.25V15.75H15.75ZM6 9L14.25 9L14.25 19.5L6 19.5L6 9Z' fill='#7f9f7f'></path> </g> </svg> </div> Server public key: \(input.ssKeys.public)
gio0eaf2712024-04-14 13:08:46 +0400180 """
181}]