underpost 2.8.6 → 2.8.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.vscode/extensions.json +36 -3
- package/.vscode/settings.json +2 -0
- package/CHANGELOG.md +24 -4
- package/Dockerfile +9 -10
- package/README.md +41 -2
- package/bin/build.js +2 -2
- package/bin/db.js +1 -0
- package/bin/deploy.js +1521 -130
- package/bin/file.js +8 -0
- package/bin/index.js +1 -218
- package/cli.md +530 -0
- package/conf.js +4 -0
- package/docker-compose.yml +1 -1
- package/jsdoc.json +1 -1
- package/manifests/deployment/adminer/deployment.yaml +32 -0
- package/manifests/deployment/adminer/kustomization.yaml +7 -0
- package/manifests/deployment/adminer/service.yaml +13 -0
- package/manifests/deployment/dd-template-development/deployment.yaml +167 -0
- package/manifests/deployment/dd-template-development/proxy.yaml +46 -0
- package/manifests/deployment/fastapi/backend-deployment.yml +120 -0
- package/manifests/deployment/fastapi/backend-service.yml +19 -0
- package/manifests/deployment/fastapi/frontend-deployment.yml +54 -0
- package/manifests/deployment/fastapi/frontend-service.yml +15 -0
- package/manifests/deployment/fastapi/initial_data.sh +56 -0
- package/manifests/deployment/kafka/deployment.yaml +69 -0
- package/manifests/deployment/spark/spark-pi-py.yaml +21 -0
- package/manifests/envoy-service-nodeport.yaml +23 -0
- package/manifests/kubeadm-calico-config.yaml +119 -0
- package/manifests/kubelet-config.yaml +65 -0
- package/manifests/lxd/lxd-admin-profile.yaml +17 -0
- package/manifests/lxd/lxd-preseed.yaml +30 -0
- package/manifests/lxd/underpost-setup.sh +163 -0
- package/manifests/maas/lxd-preseed.yaml +32 -0
- package/manifests/maas/maas-setup.sh +82 -0
- package/manifests/mariadb/statefulset.yaml +2 -1
- package/manifests/mariadb/storage-class.yaml +10 -0
- package/manifests/mongodb/kustomization.yaml +1 -1
- package/manifests/mongodb/statefulset.yaml +12 -11
- package/manifests/mongodb/storage-class.yaml +9 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +3 -3
- package/manifests/mysql/kustomization.yaml +7 -0
- package/manifests/mysql/pv-pvc.yaml +27 -0
- package/manifests/mysql/statefulset.yaml +55 -0
- package/manifests/postgresql/configmap.yaml +9 -0
- package/manifests/postgresql/kustomization.yaml +10 -0
- package/manifests/postgresql/pv.yaml +15 -0
- package/manifests/postgresql/pvc.yaml +13 -0
- package/manifests/postgresql/service.yaml +10 -0
- package/manifests/postgresql/statefulset.yaml +37 -0
- package/manifests/valkey/service.yaml +3 -9
- package/manifests/valkey/statefulset.yaml +12 -13
- package/package.json +3 -9
- package/src/api/default/default.service.js +1 -1
- package/src/api/user/user.service.js +14 -11
- package/src/cli/baremetal.js +60 -0
- package/src/cli/cluster.js +551 -65
- package/src/cli/cron.js +39 -8
- package/src/cli/db.js +20 -10
- package/src/cli/deploy.js +288 -86
- package/src/cli/env.js +10 -4
- package/src/cli/fs.js +21 -9
- package/src/cli/image.js +116 -124
- package/src/cli/index.js +319 -0
- package/src/cli/lxd.js +395 -0
- package/src/cli/monitor.js +236 -0
- package/src/cli/repository.js +14 -8
- package/src/client/components/core/Account.js +28 -24
- package/src/client/components/core/Blockchain.js +1 -1
- package/src/client/components/core/CalendarCore.js +14 -84
- package/src/client/components/core/CommonJs.js +2 -1
- package/src/client/components/core/Css.js +0 -1
- package/src/client/components/core/CssCore.js +10 -2
- package/src/client/components/core/Docs.js +1 -1
- package/src/client/components/core/EventsUI.js +3 -3
- package/src/client/components/core/FileExplorer.js +86 -78
- package/src/client/components/core/JoyStick.js +2 -2
- package/src/client/components/core/LoadingAnimation.js +1 -17
- package/src/client/components/core/LogIn.js +3 -3
- package/src/client/components/core/LogOut.js +1 -1
- package/src/client/components/core/Modal.js +14 -8
- package/src/client/components/core/Panel.js +19 -61
- package/src/client/components/core/PanelForm.js +13 -22
- package/src/client/components/core/Recover.js +3 -3
- package/src/client/components/core/RichText.js +1 -11
- package/src/client/components/core/Router.js +3 -1
- package/src/client/components/core/SignUp.js +2 -2
- package/src/client/components/default/RoutesDefault.js +3 -2
- package/src/client/services/default/default.management.js +45 -38
- package/src/client/ssr/Render.js +2 -0
- package/src/index.js +34 -2
- package/src/mailer/MailerProvider.js +3 -0
- package/src/runtime/lampp/Dockerfile +65 -0
- package/src/server/client-build.js +13 -0
- package/src/server/conf.js +151 -1
- package/src/server/dns.js +56 -18
- package/src/server/json-schema.js +77 -0
- package/src/server/logger.js +3 -3
- package/src/server/network.js +7 -122
- package/src/server/peer.js +2 -2
- package/src/server/proxy.js +4 -4
- package/src/server/runtime.js +24 -11
- package/src/server/start.js +122 -0
- package/src/server/valkey.js +27 -13
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
---
|
|
2
|
+
apiVersion: apps/v1
|
|
3
|
+
kind: Deployment
|
|
4
|
+
metadata:
|
|
5
|
+
name: dd-template-development-blue
|
|
6
|
+
labels:
|
|
7
|
+
app: dd-template-development-blue
|
|
8
|
+
spec:
|
|
9
|
+
replicas: 1
|
|
10
|
+
selector:
|
|
11
|
+
matchLabels:
|
|
12
|
+
app: dd-template-development-blue
|
|
13
|
+
template:
|
|
14
|
+
metadata:
|
|
15
|
+
labels:
|
|
16
|
+
app: dd-template-development-blue
|
|
17
|
+
spec:
|
|
18
|
+
containers:
|
|
19
|
+
- name: dd-template-development-blue
|
|
20
|
+
image: localhost/debian-underpost:v2.8.8
|
|
21
|
+
# resources:
|
|
22
|
+
# requests:
|
|
23
|
+
# memory: "124Ki"
|
|
24
|
+
# cpu: "100m"
|
|
25
|
+
# limits:
|
|
26
|
+
# memory: "1992Ki"
|
|
27
|
+
# cpu: "1600m"
|
|
28
|
+
command:
|
|
29
|
+
- /bin/sh
|
|
30
|
+
- -c
|
|
31
|
+
- >
|
|
32
|
+
npm install -g npm@11.2.0 &&
|
|
33
|
+
npm install -g underpost &&
|
|
34
|
+
cd $(underpost root)/underpost &&
|
|
35
|
+
node bin/deploy update-default-conf template &&
|
|
36
|
+
mkdir -p /home/dd &&
|
|
37
|
+
cd /home/dd &&
|
|
38
|
+
underpost new engine
|
|
39
|
+
---
|
|
40
|
+
apiVersion: v1
|
|
41
|
+
kind: Service
|
|
42
|
+
metadata:
|
|
43
|
+
name: dd-template-development-blue-service
|
|
44
|
+
spec:
|
|
45
|
+
selector:
|
|
46
|
+
app: dd-template-development-blue
|
|
47
|
+
ports:
|
|
48
|
+
- name: "tcp-4001"
|
|
49
|
+
protocol: TCP
|
|
50
|
+
port: 4001
|
|
51
|
+
targetPort: 4001
|
|
52
|
+
- name: "udp-4001"
|
|
53
|
+
protocol: UDP
|
|
54
|
+
port: 4001
|
|
55
|
+
targetPort: 4001
|
|
56
|
+
|
|
57
|
+
- name: "tcp-4002"
|
|
58
|
+
protocol: TCP
|
|
59
|
+
port: 4002
|
|
60
|
+
targetPort: 4002
|
|
61
|
+
- name: "udp-4002"
|
|
62
|
+
protocol: UDP
|
|
63
|
+
port: 4002
|
|
64
|
+
targetPort: 4002
|
|
65
|
+
|
|
66
|
+
- name: "tcp-4003"
|
|
67
|
+
protocol: TCP
|
|
68
|
+
port: 4003
|
|
69
|
+
targetPort: 4003
|
|
70
|
+
- name: "udp-4003"
|
|
71
|
+
protocol: UDP
|
|
72
|
+
port: 4003
|
|
73
|
+
targetPort: 4003
|
|
74
|
+
|
|
75
|
+
- name: "tcp-4004"
|
|
76
|
+
protocol: TCP
|
|
77
|
+
port: 4004
|
|
78
|
+
targetPort: 4004
|
|
79
|
+
- name: "udp-4004"
|
|
80
|
+
protocol: UDP
|
|
81
|
+
port: 4004
|
|
82
|
+
targetPort: 4004
|
|
83
|
+
type: LoadBalancer
|
|
84
|
+
---
|
|
85
|
+
apiVersion: apps/v1
|
|
86
|
+
kind: Deployment
|
|
87
|
+
metadata:
|
|
88
|
+
name: dd-template-development-green
|
|
89
|
+
labels:
|
|
90
|
+
app: dd-template-development-green
|
|
91
|
+
spec:
|
|
92
|
+
replicas: 1
|
|
93
|
+
selector:
|
|
94
|
+
matchLabels:
|
|
95
|
+
app: dd-template-development-green
|
|
96
|
+
template:
|
|
97
|
+
metadata:
|
|
98
|
+
labels:
|
|
99
|
+
app: dd-template-development-green
|
|
100
|
+
spec:
|
|
101
|
+
containers:
|
|
102
|
+
- name: dd-template-development-green
|
|
103
|
+
image: localhost/debian-underpost:v2.8.8
|
|
104
|
+
# resources:
|
|
105
|
+
# requests:
|
|
106
|
+
# memory: "124Ki"
|
|
107
|
+
# cpu: "100m"
|
|
108
|
+
# limits:
|
|
109
|
+
# memory: "1992Ki"
|
|
110
|
+
# cpu: "1600m"
|
|
111
|
+
command:
|
|
112
|
+
- /bin/sh
|
|
113
|
+
- -c
|
|
114
|
+
- >
|
|
115
|
+
npm install -g npm@11.2.0 &&
|
|
116
|
+
npm install -g underpost &&
|
|
117
|
+
cd $(underpost root)/underpost &&
|
|
118
|
+
node bin/deploy update-default-conf template &&
|
|
119
|
+
mkdir -p /home/dd &&
|
|
120
|
+
cd /home/dd &&
|
|
121
|
+
underpost new engine
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
apiVersion: v1
|
|
125
|
+
kind: Service
|
|
126
|
+
metadata:
|
|
127
|
+
name: dd-template-development-green-service
|
|
128
|
+
spec:
|
|
129
|
+
selector:
|
|
130
|
+
app: dd-template-development-green
|
|
131
|
+
ports:
|
|
132
|
+
- name: "tcp-4001"
|
|
133
|
+
protocol: TCP
|
|
134
|
+
port: 4001
|
|
135
|
+
targetPort: 4001
|
|
136
|
+
- name: "udp-4001"
|
|
137
|
+
protocol: UDP
|
|
138
|
+
port: 4001
|
|
139
|
+
targetPort: 4001
|
|
140
|
+
|
|
141
|
+
- name: "tcp-4002"
|
|
142
|
+
protocol: TCP
|
|
143
|
+
port: 4002
|
|
144
|
+
targetPort: 4002
|
|
145
|
+
- name: "udp-4002"
|
|
146
|
+
protocol: UDP
|
|
147
|
+
port: 4002
|
|
148
|
+
targetPort: 4002
|
|
149
|
+
|
|
150
|
+
- name: "tcp-4003"
|
|
151
|
+
protocol: TCP
|
|
152
|
+
port: 4003
|
|
153
|
+
targetPort: 4003
|
|
154
|
+
- name: "udp-4003"
|
|
155
|
+
protocol: UDP
|
|
156
|
+
port: 4003
|
|
157
|
+
targetPort: 4003
|
|
158
|
+
|
|
159
|
+
- name: "tcp-4004"
|
|
160
|
+
protocol: TCP
|
|
161
|
+
port: 4004
|
|
162
|
+
targetPort: 4004
|
|
163
|
+
- name: "udp-4004"
|
|
164
|
+
protocol: UDP
|
|
165
|
+
port: 4004
|
|
166
|
+
targetPort: 4004
|
|
167
|
+
type: LoadBalancer
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# "http://default.net:4001/socket.io": "http://localhost:4001/socket.io",
|
|
2
|
+
# "http://default.net:4002/peer": "http://localhost:4002/peer",
|
|
3
|
+
# "http://default.net:4001/": "http://localhost:4001/",
|
|
4
|
+
# "http://www.default.net:4003/": "http://localhost:4003/"
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
apiVersion: projectcontour.io/v1
|
|
8
|
+
kind: HTTPProxy
|
|
9
|
+
metadata:
|
|
10
|
+
name: default.net
|
|
11
|
+
spec:
|
|
12
|
+
virtualhost:
|
|
13
|
+
fqdn: default.net
|
|
14
|
+
routes:
|
|
15
|
+
- conditions:
|
|
16
|
+
- prefix: /
|
|
17
|
+
enableWebsockets: true
|
|
18
|
+
services:
|
|
19
|
+
- name: dd-template-development-blue-service
|
|
20
|
+
port: 4001
|
|
21
|
+
weight: 100
|
|
22
|
+
|
|
23
|
+
- conditions:
|
|
24
|
+
- prefix: /peer
|
|
25
|
+
enableWebsockets: true
|
|
26
|
+
services:
|
|
27
|
+
- name: dd-template-development-blue-service
|
|
28
|
+
port: 4002
|
|
29
|
+
weight: 100
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
apiVersion: projectcontour.io/v1
|
|
33
|
+
kind: HTTPProxy
|
|
34
|
+
metadata:
|
|
35
|
+
name: www.default.net
|
|
36
|
+
spec:
|
|
37
|
+
virtualhost:
|
|
38
|
+
fqdn: www.default.net
|
|
39
|
+
routes:
|
|
40
|
+
- conditions:
|
|
41
|
+
- prefix: /
|
|
42
|
+
enableWebsockets: true
|
|
43
|
+
services:
|
|
44
|
+
- name: dd-template-development-blue-service
|
|
45
|
+
port: 4003
|
|
46
|
+
weight: 100
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: fastapi-backend
|
|
5
|
+
labels:
|
|
6
|
+
app: fastapi-backend
|
|
7
|
+
spec:
|
|
8
|
+
replicas: 2
|
|
9
|
+
selector:
|
|
10
|
+
matchLabels:
|
|
11
|
+
app: fastapi-backend
|
|
12
|
+
template:
|
|
13
|
+
metadata:
|
|
14
|
+
labels:
|
|
15
|
+
app: fastapi-backend
|
|
16
|
+
spec:
|
|
17
|
+
containers:
|
|
18
|
+
- name: fastapi-backend-container
|
|
19
|
+
image: localhost/fastapi-backend:latest
|
|
20
|
+
imagePullPolicy: IfNotPresent
|
|
21
|
+
|
|
22
|
+
ports:
|
|
23
|
+
- containerPort: 8000
|
|
24
|
+
name: http-api
|
|
25
|
+
|
|
26
|
+
env:
|
|
27
|
+
- name: POSTGRES_SERVER
|
|
28
|
+
value: postgres-service
|
|
29
|
+
- name: POSTGRES_PORT
|
|
30
|
+
value: '5432'
|
|
31
|
+
- name: POSTGRES_DB
|
|
32
|
+
valueFrom:
|
|
33
|
+
secretKeyRef:
|
|
34
|
+
name: fastapi-postgres-credentials
|
|
35
|
+
key: POSTGRES_DB
|
|
36
|
+
- name: POSTGRES_USER
|
|
37
|
+
valueFrom:
|
|
38
|
+
secretKeyRef:
|
|
39
|
+
name: fastapi-postgres-credentials
|
|
40
|
+
key: POSTGRES_USER
|
|
41
|
+
- name: POSTGRES_PASSWORD
|
|
42
|
+
valueFrom:
|
|
43
|
+
secretKeyRef:
|
|
44
|
+
name: fastapi-postgres-credentials
|
|
45
|
+
key: POSTGRES_PASSWORD
|
|
46
|
+
|
|
47
|
+
- name: PROJECT_NAME
|
|
48
|
+
value: 'Full Stack FastAPI Project'
|
|
49
|
+
- name: STACK_NAME
|
|
50
|
+
value: 'full-stack-fastapi-project'
|
|
51
|
+
|
|
52
|
+
- name: BACKEND_CORS_ORIGINS
|
|
53
|
+
value: 'http://localhost,http://localhost:5173,https://localhost,https://localhost:5173'
|
|
54
|
+
- name: SECRET_KEY
|
|
55
|
+
valueFrom:
|
|
56
|
+
secretKeyRef:
|
|
57
|
+
name: fastapi-backend-config-secret
|
|
58
|
+
key: SECRET_KEY
|
|
59
|
+
- name: FIRST_SUPERUSER
|
|
60
|
+
valueFrom:
|
|
61
|
+
secretKeyRef:
|
|
62
|
+
name: fastapi-backend-config-secret
|
|
63
|
+
key: FIRST_SUPERUSER
|
|
64
|
+
- name: FIRST_SUPERUSER_PASSWORD
|
|
65
|
+
valueFrom:
|
|
66
|
+
secretKeyRef:
|
|
67
|
+
name: fastapi-backend-config-secret
|
|
68
|
+
key: FIRST_SUPERUSER_PASSWORD
|
|
69
|
+
- name: USERS_OPEN_REGISTRATION
|
|
70
|
+
value: 'True'
|
|
71
|
+
|
|
72
|
+
# - name: SMTP_HOST
|
|
73
|
+
# valueFrom:
|
|
74
|
+
# secretKeyRef:
|
|
75
|
+
# name: fastapi-backend-config-secret
|
|
76
|
+
# key: SMTP_HOST
|
|
77
|
+
# - name: SMTP_USER
|
|
78
|
+
# valueFrom:
|
|
79
|
+
# secretKeyRef:
|
|
80
|
+
# name: fastapi-backend-config-secret
|
|
81
|
+
# key: SMTP_USER
|
|
82
|
+
# - name: SMTP_PASSWORD
|
|
83
|
+
# valueFrom:
|
|
84
|
+
# secretKeyRef:
|
|
85
|
+
# name: fastapi-backend-config-secret
|
|
86
|
+
# key: SMTP_PASSWORD
|
|
87
|
+
- name: EMAILS_FROM_EMAIL
|
|
88
|
+
value: 'info@example.com'
|
|
89
|
+
- name: SMTP_TLS
|
|
90
|
+
value: 'True'
|
|
91
|
+
- name: SMTP_SSL
|
|
92
|
+
value: 'False'
|
|
93
|
+
- name: SMTP_PORT
|
|
94
|
+
value: '587'
|
|
95
|
+
|
|
96
|
+
livenessProbe:
|
|
97
|
+
httpGet:
|
|
98
|
+
path: /docs
|
|
99
|
+
port: 8000
|
|
100
|
+
initialDelaySeconds: 30
|
|
101
|
+
periodSeconds: 20
|
|
102
|
+
timeoutSeconds: 10
|
|
103
|
+
failureThreshold: 3
|
|
104
|
+
|
|
105
|
+
readinessProbe:
|
|
106
|
+
httpGet:
|
|
107
|
+
path: /docs
|
|
108
|
+
port: 8000
|
|
109
|
+
initialDelaySeconds: 30
|
|
110
|
+
periodSeconds: 20
|
|
111
|
+
timeoutSeconds: 10
|
|
112
|
+
failureThreshold: 3
|
|
113
|
+
|
|
114
|
+
resources:
|
|
115
|
+
requests:
|
|
116
|
+
cpu: 200m
|
|
117
|
+
memory: 256Mi
|
|
118
|
+
limits:
|
|
119
|
+
cpu: 1000m
|
|
120
|
+
memory: 1Gi
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: Service
|
|
3
|
+
metadata:
|
|
4
|
+
name: fastapi-backend-service
|
|
5
|
+
labels:
|
|
6
|
+
app: fastapi-backend
|
|
7
|
+
spec:
|
|
8
|
+
selector:
|
|
9
|
+
app: fastapi-backend
|
|
10
|
+
ports:
|
|
11
|
+
- name: 'tcp-8000'
|
|
12
|
+
protocol: TCP
|
|
13
|
+
port: 8000
|
|
14
|
+
targetPort: 8000
|
|
15
|
+
- name: 'udp-8000'
|
|
16
|
+
protocol: UDP
|
|
17
|
+
port: 8000
|
|
18
|
+
targetPort: 8000
|
|
19
|
+
type: ClusterIP
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: react-frontend
|
|
5
|
+
labels:
|
|
6
|
+
app: react-frontend
|
|
7
|
+
spec:
|
|
8
|
+
replicas: 2
|
|
9
|
+
selector:
|
|
10
|
+
matchLabels:
|
|
11
|
+
app: react-frontend
|
|
12
|
+
template:
|
|
13
|
+
metadata:
|
|
14
|
+
labels:
|
|
15
|
+
app: react-frontend
|
|
16
|
+
spec:
|
|
17
|
+
containers:
|
|
18
|
+
- name: react-frontend-container
|
|
19
|
+
image: localhost/fastapi-frontend:latest
|
|
20
|
+
imagePullPolicy: IfNotPresent
|
|
21
|
+
|
|
22
|
+
ports:
|
|
23
|
+
- containerPort: 80
|
|
24
|
+
name: http-web
|
|
25
|
+
|
|
26
|
+
env:
|
|
27
|
+
- name: VITE_FASTAPI_URL
|
|
28
|
+
value: '/api'
|
|
29
|
+
|
|
30
|
+
livenessProbe:
|
|
31
|
+
httpGet:
|
|
32
|
+
path: /
|
|
33
|
+
port: 80
|
|
34
|
+
initialDelaySeconds: 5
|
|
35
|
+
periodSeconds: 10
|
|
36
|
+
timeoutSeconds: 3
|
|
37
|
+
failureThreshold: 3
|
|
38
|
+
|
|
39
|
+
readinessProbe:
|
|
40
|
+
httpGet:
|
|
41
|
+
path: /
|
|
42
|
+
port: 80
|
|
43
|
+
initialDelaySeconds: 3
|
|
44
|
+
periodSeconds: 5
|
|
45
|
+
timeoutSeconds: 3
|
|
46
|
+
failureThreshold: 3
|
|
47
|
+
|
|
48
|
+
resources:
|
|
49
|
+
requests:
|
|
50
|
+
cpu: 100m
|
|
51
|
+
memory: 128Mi
|
|
52
|
+
limits:
|
|
53
|
+
cpu: 500m
|
|
54
|
+
memory: 512Mi
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# IMPORTANT: For non-interactive scripts, 'conda activate' can be problematic
|
|
4
|
+
# because it relies on the shell's initialization.
|
|
5
|
+
# A more robust and recommended way to run commands within a Conda environment
|
|
6
|
+
# from a script is to use 'conda run'. This command directly executes a process
|
|
7
|
+
# in the specified environment without needing to manually source 'conda.sh'.
|
|
8
|
+
|
|
9
|
+
# Navigate to the application's root directory for module discovery.
|
|
10
|
+
# This is crucial for Python to correctly find your 'app' module using 'python -m'.
|
|
11
|
+
#
|
|
12
|
+
# Let's assume a common project structure:
|
|
13
|
+
# full-stack-fastapi-template/
|
|
14
|
+
# ├── backend/
|
|
15
|
+
# │ ├── app/
|
|
16
|
+
# │ │ └── initial_data.py (the Python script you want to run)
|
|
17
|
+
# │ └── initial_data.sh (this shell script)
|
|
18
|
+
# └── ...
|
|
19
|
+
#
|
|
20
|
+
# If `initial_data.sh` is located in `full-stack-fastapi-template/backend/`,
|
|
21
|
+
# and `app` is a subdirectory of `backend/`, then the Python command
|
|
22
|
+
# `python -m app.initial_data` needs to be executed from the `backend/` directory.
|
|
23
|
+
#
|
|
24
|
+
# If you are running this shell script from a different directory (e.g., `engine/`),
|
|
25
|
+
# Python's module import system won't automatically find 'app' unless the parent
|
|
26
|
+
# directory of 'app' is in the `PYTHONPATH` or you change the current working directory.
|
|
27
|
+
#
|
|
28
|
+
# The safest way is to change the current working directory to the script's location.
|
|
29
|
+
|
|
30
|
+
# Store the current directory to return to it later if needed (good practice for multi-step scripts).
|
|
31
|
+
CURRENT_DIR=$(pwd)
|
|
32
|
+
|
|
33
|
+
# Get the absolute path of the directory where this script is located.
|
|
34
|
+
# This is a robust way to ensure we always navigate to the correct 'backend' directory.
|
|
35
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
|
36
|
+
cd "$SCRIPT_DIR"
|
|
37
|
+
|
|
38
|
+
# Execute your Python script within the specified Conda environment using 'conda run'.
|
|
39
|
+
# -n fastapi_env specifies the Conda environment to use.
|
|
40
|
+
# This completely avoids the 'source conda.sh' issue and is generally more reliable.
|
|
41
|
+
conda run -n fastapi_env python -m app.initial_data
|
|
42
|
+
|
|
43
|
+
# Important Note: The 'ModuleNotFoundError: No module named 'sqlmodel'' indicates that
|
|
44
|
+
# the 'sqlmodel' package is not installed in your 'fastapi_env' Conda environment.
|
|
45
|
+
# After running this script, if you still get the 'sqlmodel' error,
|
|
46
|
+
# you will need to activate your environment manually and install it:
|
|
47
|
+
#
|
|
48
|
+
# conda activate fastapi_env
|
|
49
|
+
# pip install sqlmodel
|
|
50
|
+
# # or if it's a conda package:
|
|
51
|
+
# # conda install sqlmodel
|
|
52
|
+
#
|
|
53
|
+
# Then try running this script again.
|
|
54
|
+
|
|
55
|
+
# Optional Good Practice: Return to the original directory if the script is part of a larger workflow.
|
|
56
|
+
cd "$CURRENT_DIR"
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: StatefulSet
|
|
3
|
+
metadata:
|
|
4
|
+
name: kafka
|
|
5
|
+
namespace: kafka
|
|
6
|
+
labels:
|
|
7
|
+
app: kafka-app
|
|
8
|
+
spec:
|
|
9
|
+
serviceName: kafka-svc
|
|
10
|
+
replicas: 3
|
|
11
|
+
selector:
|
|
12
|
+
matchLabels:
|
|
13
|
+
app: kafka-app
|
|
14
|
+
template:
|
|
15
|
+
metadata:
|
|
16
|
+
labels:
|
|
17
|
+
app: kafka-app
|
|
18
|
+
spec:
|
|
19
|
+
containers:
|
|
20
|
+
- name: kafka-container
|
|
21
|
+
image: doughgle/kafka-kraft
|
|
22
|
+
ports:
|
|
23
|
+
- containerPort: 9092
|
|
24
|
+
- containerPort: 9093
|
|
25
|
+
env:
|
|
26
|
+
- name: REPLICAS
|
|
27
|
+
value: '3'
|
|
28
|
+
- name: SERVICE
|
|
29
|
+
value: kafka-svc
|
|
30
|
+
- name: NAMESPACE
|
|
31
|
+
value: kafka
|
|
32
|
+
- name: SHARE_DIR
|
|
33
|
+
value: /mnt/kafka
|
|
34
|
+
- name: CLUSTER_ID
|
|
35
|
+
value: bXktY2x1c3Rlci0xMjM0NQ==
|
|
36
|
+
- name: DEFAULT_REPLICATION_FACTOR
|
|
37
|
+
value: '3'
|
|
38
|
+
- name: DEFAULT_MIN_INSYNC_REPLICAS
|
|
39
|
+
value: '2'
|
|
40
|
+
volumeMounts:
|
|
41
|
+
- name: data
|
|
42
|
+
mountPath: /mnt/kafka
|
|
43
|
+
volumeClaimTemplates:
|
|
44
|
+
- metadata:
|
|
45
|
+
name: data
|
|
46
|
+
spec:
|
|
47
|
+
accessModes:
|
|
48
|
+
- 'ReadWriteOnce'
|
|
49
|
+
resources:
|
|
50
|
+
requests:
|
|
51
|
+
storage: '1Gi'
|
|
52
|
+
---
|
|
53
|
+
apiVersion: v1
|
|
54
|
+
kind: Service
|
|
55
|
+
metadata:
|
|
56
|
+
name: kafka-svc
|
|
57
|
+
namespace: kafka
|
|
58
|
+
labels:
|
|
59
|
+
app: kafka-app
|
|
60
|
+
spec:
|
|
61
|
+
type: NodePort
|
|
62
|
+
ports:
|
|
63
|
+
- name: '9092'
|
|
64
|
+
port: 9092
|
|
65
|
+
protocol: TCP
|
|
66
|
+
targetPort: 9092
|
|
67
|
+
nodePort: 30092
|
|
68
|
+
selector:
|
|
69
|
+
app: kafka-app
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
apiVersion: sparkoperator.k8s.io/v1beta2
|
|
2
|
+
kind: SparkApplication
|
|
3
|
+
metadata:
|
|
4
|
+
name: spark-pi-python
|
|
5
|
+
namespace: default
|
|
6
|
+
spec:
|
|
7
|
+
type: Python
|
|
8
|
+
pythonVersion: '3'
|
|
9
|
+
mode: cluster
|
|
10
|
+
image: spark:3.5.5
|
|
11
|
+
imagePullPolicy: IfNotPresent
|
|
12
|
+
mainApplicationFile: local:///opt/spark/examples/src/main/python/pi.py
|
|
13
|
+
sparkVersion: 3.5.5
|
|
14
|
+
driver:
|
|
15
|
+
cores: 1
|
|
16
|
+
memory: 512m
|
|
17
|
+
serviceAccount: spark-operator-spark
|
|
18
|
+
executor:
|
|
19
|
+
instances: 1
|
|
20
|
+
cores: 1
|
|
21
|
+
memory: 512m
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
apiVersion: v1
|
|
2
|
+
kind: Service
|
|
3
|
+
metadata:
|
|
4
|
+
labels:
|
|
5
|
+
app: envoy
|
|
6
|
+
name: envoy
|
|
7
|
+
namespace: projectcontour
|
|
8
|
+
spec:
|
|
9
|
+
externalTrafficPolicy: Cluster
|
|
10
|
+
ports:
|
|
11
|
+
- name: http
|
|
12
|
+
nodePort: 30080
|
|
13
|
+
port: 80
|
|
14
|
+
protocol: TCP
|
|
15
|
+
targetPort: 8080
|
|
16
|
+
- name: https
|
|
17
|
+
nodePort: 30443
|
|
18
|
+
port: 443
|
|
19
|
+
protocol: TCP
|
|
20
|
+
targetPort: 8443
|
|
21
|
+
selector:
|
|
22
|
+
app: envoy
|
|
23
|
+
type: NodePort
|