blob: 07c2f1aac74bd0fcd1fd86960ec5623bd3907862 [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)
gio4ece99c2024-07-18 11:05:50 +040011 allowedNetworks: [...#Network] | *[] @name(Allowed Networks)
gio11617ac2024-07-15 16:09:04 +040012 external: bool | *false @name(External)
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"
gio8c942d22024-07-17 13:43:02 +040024icon: """
25<svg width='50px' height='50px' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 39.68503937 39.68503937'>
26 <defs>
27 <style>
28 .cls-1 {
29 fill: currentColor;
30 }
31
32 .cls-2 {
33 fill: none;
34 stroke: #3a3a3a;
35 stroke-miterlimit: 10;
36 stroke-width: .98133445px;
37 }
38 </style>
39 </defs>
40 <rect class='cls-2' x='-9.97439025' y='-9.97439025' width='59.63381987' height='59.63381987'/>
41 <g>
42 <path class='cls-1' d='m4.14612077,30.30093685c-.14455793,0-.27755122-.09490976-.31962256-.24086342-.0510439-.17705854.05064512-.36129513.22730488-.41233903,1.25755428-.36368781,2.55678112-.58301708,3.86179028-.65400001.18343903-.00159512.34035915.13159756.35052805.31423903.00977012.18423659-.13099939.34055854-.31463781.35092683-1.25456343.06779268-2.50374331.27914634-3.71264637.62847805-.03090549.00877317-.06201037.01355854-.09271646.01355854Zm4.93770004-4.95923419c-2.75357929,0-6.44887871-.96664391-8.31317751-2.32568783-.14874512-.10767073-.18144512-.31583415-.07317622-.46497805.10846829-.14834634.31703049-.18264147.46517744-.07257805,2.42179392,1.76340733,7.41831409,2.59446588,9.65766594,2.01304392.55071586-.14276342.90842196-.36289025,1.0342372-.63485854.62189818-1.34787806.53257135-6.24250981.37904086-9.06587569-.38601952.18583171-.93175062.37644878-1.39573172.25681464-.28692256-.07337561-.51243293-.25442195-.6520061-.52559269-.22411464-.43467074-.22411464-.93872928-.00019939-1.41886099.19600061-.42031464.54433537-.79197806.99834696-1.08149269-.2881189-.08294634-.50984086-.20497317-.66875488-.36767561-.18443598-.18742683-.2759561-.42190976-.26439147-.67792684.00957073-.21693659.15831586-.68590244.65519635-1.06713659.32460732-.24804147.85717867-.49448781,1.69222501-.49448781.01774573,0,.03549146,0,.05363598.00079756-.22610854-.33577317-.30287378-.70265123-.17865366-1.01768781.15093842-.38282927.67613232-.89805367,2.46546039-.50166586-.02292988-.10208781-.03110488-.20736586-.02352805-.31264391.02711707-.37724634.25920732-.68510488.60574757-.80553659.27495915-.0941122.80314391-.13478781,1.53071892.45859756.10288537-.20258049.27635488-.35411708.50764757-.42988537.68989025-.22650732,1.75044697.31663171,2.44292929,1.79371465.07816098.16589268.00638049.36448537-.16011037.44264635-.16589268.07816098-.36488415.00717805-.44284574-.16030976-.54892135-1.17002196-1.29822989-1.55444636-1.63260733-1.44358538-.18523354.06061463-.16848476.29509756-.14216525.42908781.02911098.14675122-.04326768.29509756-.17665976.36209269-.13379085.06699512-.29549634.03668781-.39618842-.07337561-.61571708-.67553415-1.09106342-.82547562-1.31278538-.74970732-.12780915.04466342-.15472683.1595122-.1595122.22411464-.01176402.1635.08733293.39638781.400575.55829269.15392927.0797561.22112378.26399269.15432805.42430244-.06639695.16030976-.24385427.24405366-.40954756.18822439-1.96160124-.63326342-2.56495612-.33019025-2.63195124-.1595122-.07616707.19300976.19520305.66676098.77802074.9403244.15372988.07257805.22850122.24883903.17346951.40914878-.05503171.16110732-.22291829.25442195-.38761464.21693659-1.29743233-.28712195-1.98512929-.04147317-2.33326465.22012683-.318825.23767317-.40336647.52000976-.40735427.57743415-.00299085.06859024.02073659.1268122.07457195.1818439.09770122.09889756.44324452.32380976,1.55085733.29988293.16868415.01595122.31782805.12122927.33896342.29110976s-.089925.32859512-.25701403.36608049c-.86635062.1962-1.56920123.67074879-1.83399148,1.23861221-.09550793.20497317-.17506464.51602196-.01176402.83345123.05263902.10208781.12202683.15871464.2249122.18503415.41233903.10687317,1.12755184-.29270488,1.34588416-.44025366.09889756-.0654.22610854-.07337561.3331811-.02312927.10727195.05263902.17805549.15871464.18563232.27834878.02033781.32460732.49089878,7.97082446-.40815183,9.91846838-.21514208.46577561-.71022805.80314391-1.47130062,1.00093903-.53895183.13957317-1.18996099.20497317-1.90397746.20497317Z'/>
43 <path class='cls-1' d='m11.94387449,37.48137838c-.10607561,0-.21035671-.0510439-.27495915-.1451561-.10388232-.15153659-.06520061-.35890244.08653537-.46258537,3.14278905-2.15261709,6.70589274-5.42341468,6.36054884-11.66512693-.17346951-3.13600978-.52678903-4.53572931-.71640915-5.28703175-.02372744-.0941122-.0450622-.18024878-.0634061-.26000488-.00179451-.00558293-.00358902-.01116585-.00518415-.01674878-.25422256-.91958781-.7134183-1.78095367-1.19953172-2.69256588-.56287866-1.05597074-1.1446994-2.14703417-1.45395367-3.42233418-.63745062-2.62796344.96245672-3.85301711,3.5609104-4.88266834,2.02819758-.80473903,3.08975125.58301708,3.86478113,1.59512197.20876159.27356342.40615793.53117561.59817074.71940001.77542867.76007562,1.70578355,1.03682928,4.64140614.4354683,2.94599088-.60215854,4.46275248-.07736342,6.00882444,2.08402685.90682684,1.26971708,1.3287366,3.12723661.9811994,4.3211854-.14276342.4905-.41253842.82866586-.77961586.9770122-.70444574.28393171-1.04261159-.17067805-1.31398172-.5375561-.34235305-.46178781-.76825062-1.03603172-2.06029941-1.25855123-1.37260245-.15552439-2.77830368-.21374634-4.17722565-.16988049.68550366.86296098,1.88942197,2.65986588,1.86768843,4.61389028-.00159512.13797805-.08813049.26080244-.21793354.3086561-.1288061.04625854-.27495915.01036829-.36608049-.0941122-2.19907502-2.52109027-5.16181468-3.43110735-7.20117811-3.44147564-1.06255062-.00558293-1.6639116.24166098-1.85353172.4538122q-.36169391.40595854-.18543293,1.1038244c.19520305.77363415.55869147,2.21402929.73575001,5.41384395.36767561,6.64767079-3.61873357,10.17528302-6.64906652,12.25053669-.05762378.03987805-.12302378.05901951-.188025.05901951Zm8.10561227-19.94700017h.03808354c1.98173965.01036829,4.77380126.8095244,7.0257147,2.96373661-.40456281-2.02181709-2.03158721-3.73737076-2.05052929-3.75730979-.09012439-.09331463-.11744085-.23129268-.0695872-.35252195.04765427-.12122927.1615061-.20337805.29150854-.2105561,1.65812928-.09092195,3.33679576-.04147317,4.98834517.14675122,1.5739866.27037317,2.13188051,1.02327074,2.50115124,1.52094879.29410061.39718537.32181586.40117317.5293811.31663171.21633842-.08773171.33138659-.34534391.38980793-.54632927.24963659-.85737806-.01714756-2.5346488-.88369757-3.7469415-1.39134513-1.9460488-2.63753417-2.37035124-5.33329029-1.8192366-2.85486954.58540976-4.17762443.43148049-5.241172-.61252683-.22590915-.22092439-.43726281-.49767805-.66097866-.78958537-.7522994-.98339269-1.52912379-2.00108051-3.09034942-1.38137562-2.79884088,1.10940733-3.62551284,2.18451953-3.15913905,4.10743906.28931525,1.19235367.85119696,2.24593173,1.39433599,3.26521466.31443842.58939757.61791037,1.15885611.86814513,1.74426587.04366646-.05423415.09211829-.11165854.14615305-.17227317.38362683-.43068293,1.22664879-.67633171,2.31611709-.67633171Z'/>
44 <path class='cls-1' d='m16.5348349,14.71739281c-.16270244,0-.30506708-.11963415-.3291933-.28552683-.07078354-.48810732.01774573-.87253171.2635939-1.14370245.38123415-.42031464,1.02506525-.45301464,1.60608843-.4211122.18363842.00877317.32560427.16429756.3168311.34853415-.00877317.18343903-.15771768.3230122-.34833476.31663171-.3700683-.01914146-.88250123-.01515366-1.0812933.20417561-.10587622.1164439-.13877561.31822683-.09770122.59976586.02631951.1818439-.09969512.35092683-.28173842.37724634-.01615061.00239268-.03230122.0039878-.04825244.0039878Z'/>
45 <path class='cls-1' d='m24.36488985,16.85485624c-4.86452382,0-6.3264531-1.01050976-7.78040678-3.28754637-.09889756-.15552439-.05343659-.36129513.10148964-.46019269.15572378-.09730244.36089634-.05263902.4599933.10129024,1.46691404,2.29777319,2.91827564,3.09054881,8.14907934,2.96931954.18642988-.02392683.33637134.14116829.34075793.32460732.0041872.18423659-.14136768.33657073-.32520549.34055854-.32879452.00797561-.64403049.01196341-.94570794.01196341Z'/>
46 <path class='cls-1' d='m25.03045449,29.77614172c-.15891403,0-.29968354-.11484878-.32779756-.27675366-.03130427-.18104634.09012439-.35331952.27137012-.38442439,2.01942441-.35092683,6.08299761-1.05597074,7.44722567-4.46713906-3.95051894,1.92690733-9.43075984,3.9144293-14.09968183,1.53849514-.16389878-.08294634-.22929878-.28393171-.14595366-.44743171.08354451-.1635.28472927-.2289.44783049-.14595366,4.68786407,2.38311222,10.35433546.0614122,14.20934647-1.89340977.1164439-.05981707.25701403-.04386585.35910183.03668781.10188842.08214878.14655183.21613903.11385183.34295122-1.14848781,4.46554394-5.92328603,5.29341224-8.21806836,5.69139517-.01914146.0039878-.03828293.00558293-.057225.00558293Zm-.15353049-12.92447572c-.0225311,0-.0450622-.00239268-.06799207-.00717805-.18004939-.03748537-.29569573-.21374634-.25840976-.39399513.21932927-1.05916098,1.07052623-4.01093418,2.35798904-4.93610492.1491439-.10846829.35730732-.07337561.46477866.07576829.10727195.14994146.07337561.35730732-.07596768.46497805-.93713415.67314147-1.78912867,3.05465856-2.09479392,4.53094394-.03250061.15711951-.17107683.26558781-.32560427.26558781Zm-5.16021956-4.10424882c-.26498964,0-.68650062-.13638293-.98638355-.89167318-.06799207-.17067805.01575183-.36448537.18662927-.43227805.17007988-.06699512.36448537.01515366.43227805.18662927.13399025.3373683.29110976.49289269.37724634.47056098.07078354-.00638049.14655183-.09171951.15911342-.15711951.12541646-.57504147-.23468232-1.13732196-.80095062-1.26094391-.08075305-.01674878-.1615061-.02073659-.24086342-.02392683-.16130671.0183439-.33597256-.14116829-.34035915-.32540488-.0039878-.18343903.14176646-.33577317.32560427-.33976098.12940427-.00797561.26299573.00957073.39618842.03828293.92676586.20258049,1.5147677,1.11977562,1.31278538,2.04494636-.06759329.35411708-.39020671.65320244-.74871037.68749757-.0225311.00159512-.04685671.00319024-.07257805.00319024Z'/>
47 <path class='cls-1' d='m24.39001302,31.87372711c-.1736689,0-.32002134-.13478781-.33178537-.31104878-.0123622-.18343903.12641342-.34215366.30985244-.35491464,4.62764821-.31104878,6.81156957-1.74187319,6.67638298-4.37462199-.00937134-.18343903.13179695-.33976098.31543537-.34933171.18702805-.00638049.34015976.13239512.34973049.31583415.15552439,3.02993417-2.29936831,4.73671468-7.29688543,5.07328541-.00757683,0-.01515366.00079756-.02273049.00079756Z'/>
48 <path class='cls-1' d='m22.10460202,34.88053201c-1.87067928,0-3.83866101-.55111464-5.75300676-1.63579758-.16011037-.09012439-.21633842-.29350244-.12561585-.4538122.09052317-.15871464.29350244-.21613903.4538122-.12521707,2.81140246,1.59193172,5.72828237,1.97236831,8.21388117,1.06952928,1.73589148-.63007318,3.08396893-1.8375805,3.60617198-3.22932442.06480183-.17227317.25601708-.25920732.42888842-.19460488.17207378.06460244.25940671.25681464.19480427.42908781-.58979635,1.57119514-2.08622014,2.92465612-4.00275918,3.62092686-.95727257.34693903-1.97157075.5192122-3.01617625.5192122Z'/>
49 <path class='cls-1' d='m19.84251969,39.68503937C8.90137874,39.68503937,0,30.78346124,0,19.84251969S8.90137874,0,19.84251969,0s19.84251969,8.90157813,19.84251969,19.84251969-8.90137874,19.84251969-19.84251969,19.84251969Zm0-38.35311253C9.63573301,1.33192684,1.33192684,9.63613179,1.33192684,19.84251969s8.30380617,18.51059284,18.51059284,18.51059284,18.51059284-8.30420495,18.51059284-18.51059284S30.04930636,1.33192684,19.84251969,1.33192684Z'/>
50 </g>
51</svg>"""
gio0eaf2712024-04-14 13:08:46 +040052_domain: "\(input.subdomain).\(input.network.domain)"
gio11617ac2024-07-15 16:09:04 +040053url: "https://\(_domain)"
gio0eaf2712024-04-14 13:08:46 +040054
55images: {
56 softserve: {
57 repository: "charmcli"
58 name: "soft-serve"
59 tag: "v0.7.1"
60 pullPolicy: "IfNotPresent"
61 }
62 dodoApp: {
63 repository: "giolekva"
64 name: "pcloud-installer"
65 tag: "latest"
66 pullPolicy: "Always"
67 }
68}
69
70charts: {
71 softserve: {
giof8843412024-05-22 16:38:05 +040072 kind: "GitRepository"
gio9877f292024-08-17 15:11:15 +040073 address: "https://code.v1.dodo.cloud/helm-charts"
giof8843412024-05-22 16:38:05 +040074 branch: "main"
75 path: "charts/soft-serve"
gio0eaf2712024-04-14 13:08:46 +040076 }
77 dodoApp: {
giof8843412024-05-22 16:38:05 +040078 kind: "GitRepository"
gio9877f292024-08-17 15:11:15 +040079 address: "https://code.v1.dodo.cloud/helm-charts"
giof8843412024-05-22 16:38:05 +040080 branch: "main"
81 path: "charts/dodo-app"
gio0eaf2712024-04-14 13:08:46 +040082 }
83}
84
gioa60f0de2024-07-08 10:49:48 +040085volumes: db: size: "10Gi"
86
87ingress: {
88 "dodo-app": {
gio11617ac2024-07-15 16:09:04 +040089 auth: {
90 if input.external {
91 enabled: false
92 }
93 if !input.external {
94 enabled: true
95 }
96 }
gioa60f0de2024-07-08 10:49:48 +040097 network: input.network
98 subdomain: input.subdomain
99 service: {
100 name: "web"
101 port: name: "http"
102 }
103 }
104}
105
gio0eaf2712024-04-14 13:08:46 +0400106portForward: [#PortForward & {
107 allocator: input.network.allocatePortAddr
gioefa0ed42024-06-13 12:31:43 +0400108 reservator: input.network.reservePortAddr
giocdfa3722024-06-13 20:10:14 +0400109 deallocator: input.network.deallocatePortAddr
gio0eaf2712024-04-14 13:08:46 +0400110 sourcePort: input.sshPort
gio3e67ce12024-06-13 19:47:19 +0400111 serviceName: "soft-serve"
gio0eaf2712024-04-14 13:08:46 +0400112 targetPort: 22
113}]
114
115helm: {
116 softserve: {
117 chart: charts.softserve
giof9f0bee2024-06-11 20:10:05 +0400118 info: "Installing Git server"
gio0eaf2712024-04-14 13:08:46 +0400119 values: {
120 serviceType: "ClusterIP"
121 addressPool: ""
122 reservedIP: ""
gio266c04f2024-07-03 14:18:45 +0400123 adminKey: strings.Join([input.fluxKeys.public, input.dAppKeys.public], "\n")
gio0eaf2712024-04-14 13:08:46 +0400124 privateKey: input.ssKeys.private
125 publicKey: input.ssKeys.public
126 ingress: {
127 enabled: false
128 }
129 image: {
130 repository: images.softserve.fullName
131 tag: images.softserve.tag
132 pullPolicy: images.softserve.pullPolicy
133 }
134 }
135 }
136 "dodo-app": {
137 chart: charts.dodoApp
giof9f0bee2024-06-11 20:10:05 +0400138 info: "Installing supervisor"
gio0eaf2712024-04-14 13:08:46 +0400139 values: {
140 image: {
141 repository: images.dodoApp.fullName
142 tag: images.dodoApp.tag
143 pullPolicy: images.dodoApp.pullPolicy
144 }
gio3a5baed2024-07-16 15:39:31 +0400145 clusterRoleName: "\(release.namespace)-dodo-app"
gioa60f0de2024-07-08 10:49:48 +0400146 port: 8080
147 apiPort: 8081
gio0eaf2712024-04-14 13:08:46 +0400148 repoAddr: "soft-serve.\(release.namespace).svc.cluster.local:22"
149 sshPrivateKey: base64.Encode(null, input.dAppKeys.private)
gioa60f0de2024-07-08 10:49:48 +0400150 self: "api.\(release.namespace).svc.cluster.local"
gio11617ac2024-07-15 16:09:04 +0400151 repoPublicAddr: "ssh://\(_domain):\(input.sshPort)"
gio0eaf2712024-04-14 13:08:46 +0400152 namespace: release.namespace
giocb34ad22024-07-11 08:01:13 +0400153 envAppManagerAddr: "http://appmanager.\(global.namespacePrefix)appmanager.svc.cluster.local"
gio0eaf2712024-04-14 13:08:46 +0400154 envConfig: base64.Encode(null, json.Marshal(global))
gio266c04f2024-07-03 14:18:45 +0400155 gitRepoPublicKey: input.ssKeys.public
gioa60f0de2024-07-08 10:49:48 +0400156 persistentVolumeClaimName: volumes.db.name
gio4ece99c2024-07-18 11:05:50 +0400157 allowedNetworks: strings.Join([for n in input.allowedNetworks { n.name }], ",")
gio11617ac2024-07-15 16:09:04 +0400158 external: input.external
giocafd4e62024-07-31 10:53:40 +0400159 fetchUsersAddr: "http://memberships-api.\(global.namespacePrefix)core-auth-memberships.svc.cluster.local/api/users"
gio0eaf2712024-04-14 13:08:46 +0400160 }
161 }
162}
163
164resources: {
165 "config-kustomization": {
166 apiVersion: "kustomize.toolkit.fluxcd.io/v1"
167 kind: "Kustomization"
168 metadata: {
gio266c04f2024-07-03 14:18:45 +0400169 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400170 namespace: release.namespace
171 }
172 spec: {
173 interval: "1m"
gio266c04f2024-07-03 14:18:45 +0400174 path: "./"
gio0eaf2712024-04-14 13:08:46 +0400175 sourceRef: {
176 kind: "GitRepository"
gio266c04f2024-07-03 14:18:45 +0400177 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400178 namespace: release.namespace
179 }
180 prune: true
181 }
182 }
183 "config-secret": {
184 apiVersion: "v1"
185 kind: "Secret"
186 type: "Opaque"
187 metadata: {
gio266c04f2024-07-03 14:18:45 +0400188 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400189 namespace: release.namespace
190 }
191 data: {
192 identity: base64.Encode(null, input.fluxKeys.private)
193 "identity.pub": base64.Encode(null, input.fluxKeys.public)
194 known_hosts: base64.Encode(null, "soft-serve.\(release.namespace).svc.cluster.local \(input.ssKeys.public)")
195 }
196 }
197 "config-source": {
198 apiVersion: "source.toolkit.fluxcd.io/v1"
199 kind: "GitRepository"
200 metadata: {
gio266c04f2024-07-03 14:18:45 +0400201 name: "config"
gio0eaf2712024-04-14 13:08:46 +0400202 namespace: release.namespace
203 }
204 spec: {
205 interval: "1m0s"
gio266c04f2024-07-03 14:18:45 +0400206 ref: branch: "master"
207 secretRef: name: "config"
gio0eaf2712024-04-14 13:08:46 +0400208 timeout: "60s"
gio266c04f2024-07-03 14:18:45 +0400209 url: "ssh://soft-serve.\(release.namespace).svc.cluster.local:22/config"
gio0eaf2712024-04-14 13:08:46 +0400210 }
211 }
212}