🌳
pt0/deployF/servicesF/nostrF/eptNostrAI.mts
11import {
12 strfryName, strfryImage, strfryPort, strfryDbPath, strfryDataSizeGb, strfryConfig,
13 nostrudelName, nostrudelImage, nostrudelPort,
16const wsIngressAnnotH = {
17 'nginx.ingress.kubernetes.io/proxy-read-timeout': '3600',
18 'nginx.ingress.kubernetes.io/proxy-send-timeout': '3600',
19 'nginx.ingress.kubernetes.io/websocket-services': `${strfryName} ${nostrudelName}`,
22export const eptNostr = async ({strfryHostname, nostrudelHostname}: {strfryHostname: string, nostrudelHostname: string}) => {
23 const {cluster_name} = getKlusterCtx()
24 const action = getAction()
26 const {volumes: strfryPvcVols, volumeMounts: strfryPvcMnts} = pvcVolumeMounts({name: strfryName, mountPath: strfryDbPath})
28 const strfryCfgMapName = `${strfryName}-config`
29 const {configMap: strfryConfigMap, volume: strfryCfgVol} = configMapWithHash({
30 name: strfryCfgMapName,
31 data: {'strfry.conf': strfryConfig},
32 mountPath: '/etc/strfry',
33 })
35 const strfryDeployment = deployTmpl({
36 name: strfryName,
37 volumes: [...strfryPvcVols, strfryCfgVol],
38 containers: [{
39 name: strfryName,
40 image: strfryImage,
41 ports: [{containerPort: strfryPort}],
42 volumeMounts: [
43 ...strfryPvcMnts,
44 {name: strfryCfgMapName, mountPath: '/etc/strfry.conf', subPath: 'strfry.conf'},
45 ],
46 }],
47 })
49 const nostrudelDeployment = deployTmpl({
50 name: nostrudelName,
51 containers: [{
52 name: nostrudelName,
53 image: nostrudelImage,
54 ports: [{containerPort: nostrudelPort}],
55 env: [
56 {name: 'CACHE_RELAY', value: `${strfryName}:${strfryPort}`},
57 ],
58 }],
59 })
61 const resources = [
62 strfryConfigMap,
63 strfryDeployment,
64 kubeSvcTmpl({name: strfryName, portNo: strfryPort}),
65 genericIngressTmpl({name: strfryName, hostname: strfryHostname, portNo: strfryPort, ingressAnnotationsH: wsIngressAnnotH}),
66 nostrudelDeployment,
67 kubeSvcTmpl({name: nostrudelName, portNo: nostrudelPort}),
68 genericIngressTmpl({name: nostrudelName, hostname: nostrudelHostname, portNo: nostrudelPort, ingressAnnotationsH: wsIngressAnnotH}),
69 ]
71 await Promise.all([
72 resourcesAction({resources, action, cluster_name}),
73 kubeActionPvc({action, cluster_name, name: strfryName, sizeGb: strfryDataSizeGb}),
74 ])
76 if (action === 'apply') {
77 await waitForDeploymentRollout({resource: strfryDeployment, cluster_name})
78 await waitForDeploymentRollout({resource: nostrudelDeployment, cluster_name})
79 }