underpost 2.8.652 → 2.8.782
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 +37 -2
- package/.vscode/settings.json +2 -0
- package/CHANGELOG.md +24 -4
- package/README.md +5 -4
- package/bin/deploy.js +1455 -144
- package/cli.md +56 -14
- package/docker-compose.yml +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/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/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 +1 -1
- 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/statefulset.yaml +4 -3
- package/package.json +2 -1
- package/src/cli/cluster.js +281 -27
- package/src/cli/deploy.js +81 -15
- package/src/cli/fs.js +14 -3
- package/src/cli/image.js +34 -7
- package/src/cli/index.js +37 -2
- package/src/cli/lxd.js +19 -0
- package/src/cli/monitor.js +75 -30
- package/src/cli/repository.js +9 -6
- package/src/client/components/core/JoyStick.js +2 -2
- package/src/client/components/core/Modal.js +1 -0
- package/src/index.js +1 -1
- package/src/runtime/lampp/Dockerfile +1 -1
- package/src/server/conf.js +5 -1
- package/src/server/dns.js +47 -17
- package/src/server/runtime.js +2 -0
- package/src/server/start.js +0 -1
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.8.
|
|
1
|
+
## underpost ci/cd cli v2.8.782
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -10,17 +10,17 @@ Commands:
|
|
|
10
10
|
new <app-name> Create a new project
|
|
11
11
|
start [options] <deploy-id> [env] Start up server, build pipelines, or services
|
|
12
12
|
clone [options] <uri> Clone github repository
|
|
13
|
-
pull <path> <uri>
|
|
13
|
+
pull [options] <path> <uri> Pull github repository
|
|
14
14
|
cmt [options] <path> <commit-type> [module-tag] [message] Commit github repository
|
|
15
15
|
push [options] <path> <uri> Push github repository
|
|
16
16
|
env <deploy-id> [env] Set environment variables files and conf related to <deploy-id>
|
|
17
17
|
config <operator> [key] [value] Manage configuration, operators
|
|
18
18
|
root Get npm root path
|
|
19
19
|
cluster [options] [pod-name] Manage cluster, for default initialization base kind cluster
|
|
20
|
-
deploy [options]
|
|
20
|
+
deploy [options] [deploy-list] [env] Manage deployment, for default deploy development pods
|
|
21
21
|
secret [options] <platform> Manage secrets
|
|
22
22
|
dockerfile-image-build [options] Build image from Dockerfile
|
|
23
|
-
dockerfile-pull-base-images
|
|
23
|
+
dockerfile-pull-base-images [options] Pull underpost dockerfile images requirements
|
|
24
24
|
install Fast import underpost npm dependencies
|
|
25
25
|
db [options] <deploy-list> Manage databases
|
|
26
26
|
script [options] <operator> <script-name> [script-value] Supports a number of built-in underpost global scripts and their preset life cycle events as well as arbitrary scripts
|
|
@@ -28,6 +28,7 @@ Commands:
|
|
|
28
28
|
fs [options] [path] File storage management, for default upload file
|
|
29
29
|
test [options] [deploy-list] Manage Test, for default run current underpost default test
|
|
30
30
|
monitor [options] <deploy-id> [env] Monitor health server management
|
|
31
|
+
lxd [options] Lxd management
|
|
31
32
|
help [command] display help for command
|
|
32
33
|
|
|
33
34
|
```
|
|
@@ -79,6 +80,7 @@ Arguments:
|
|
|
79
80
|
|
|
80
81
|
Options:
|
|
81
82
|
--bare Clone only .git files
|
|
83
|
+
-g8 Use g8 repo extension
|
|
82
84
|
-h, --help display help for command
|
|
83
85
|
|
|
84
86
|
```
|
|
@@ -95,6 +97,7 @@ Arguments:
|
|
|
95
97
|
uri e.g. username/repository
|
|
96
98
|
|
|
97
99
|
Options:
|
|
100
|
+
-g8 Use g8 repo extension
|
|
98
101
|
-h, --help display help for command
|
|
99
102
|
|
|
100
103
|
```
|
|
@@ -134,6 +137,7 @@ Arguments:
|
|
|
134
137
|
|
|
135
138
|
Options:
|
|
136
139
|
-f Force push overwriting repository
|
|
140
|
+
-g8 Use g8 repo extension
|
|
137
141
|
-h, --help display help for command
|
|
138
142
|
|
|
139
143
|
```
|
|
@@ -196,18 +200,25 @@ Arguments:
|
|
|
196
200
|
Options:
|
|
197
201
|
--reset Delete all clusters and prune all data and caches
|
|
198
202
|
--mariadb Init with mariadb statefulset
|
|
203
|
+
--mysql Init with mysql statefulset
|
|
199
204
|
--mongodb Init with mongodb statefulset
|
|
205
|
+
--postgresql Init with postgresql statefulset
|
|
200
206
|
--mongodb4 Init with mongodb 4.4 service
|
|
201
207
|
--valkey Init with valkey service
|
|
202
208
|
--contour Init with project contour base HTTPProxy and envoy
|
|
203
209
|
--cert-manager Init with letsencrypt-prod ClusterIssuer
|
|
210
|
+
--dedicated-gpu Init with dedicated gpu base resources env
|
|
204
211
|
--info Get all kinds objects deployed
|
|
205
212
|
--full Init with all statefulsets and services available
|
|
206
213
|
--ns-use <ns-name> Switches current context to namespace
|
|
214
|
+
--kubeadm Init with kubeadm controlplane management
|
|
207
215
|
--dev init with dev cluster
|
|
208
216
|
--list-pods Display list pods information
|
|
209
217
|
--info-capacity display current total machine capacity info
|
|
210
218
|
--info-capacity-pod display current machine capacity pod info
|
|
219
|
+
--pull-image Set optional pull associated image
|
|
220
|
+
--init-host Install k8s node necessary cli env: kind, kubeadm,
|
|
221
|
+
docker, podman, helm
|
|
211
222
|
-h, --help display help for command
|
|
212
223
|
|
|
213
224
|
```
|
|
@@ -215,7 +226,7 @@ Options:
|
|
|
215
226
|
|
|
216
227
|
### `deploy` :
|
|
217
228
|
```
|
|
218
|
-
Usage: underpost deploy [options]
|
|
229
|
+
Usage: underpost deploy [options] [deploy-list] [env]
|
|
219
230
|
|
|
220
231
|
Manage deployment, for default deploy development pods
|
|
221
232
|
|
|
@@ -238,6 +249,13 @@ Options:
|
|
|
238
249
|
--replicas <replicas> Set custom number of replicas
|
|
239
250
|
--versions <deployment-versions> Comma separated custom deployment versions
|
|
240
251
|
--traffic <traffic-versions> Comma separated custom deployment traffic
|
|
252
|
+
--disable-update-deployment Disable update deployments
|
|
253
|
+
--info-traffic get traffic conf form current resources
|
|
254
|
+
deployments
|
|
255
|
+
--kubeadm Enable kubeadm context
|
|
256
|
+
--restore-hosts Restore defautl etc hosts
|
|
257
|
+
--rebuild-clients-bundle Inside container, rebuild clients bundle,
|
|
258
|
+
only static public or storage client files
|
|
241
259
|
-h, --help display help for command
|
|
242
260
|
|
|
243
261
|
```
|
|
@@ -274,6 +292,7 @@ Options:
|
|
|
274
292
|
--dockerfile-name [dockerfile-name] set Dockerfile name
|
|
275
293
|
--podman-save Export tar file from podman
|
|
276
294
|
--kind-load Import tar image to Kind cluster
|
|
295
|
+
--kubeadm-load Import tar image to Kubeadm cluster
|
|
277
296
|
--secrets Dockerfile env secrets
|
|
278
297
|
--secrets-path [secrets-path] Dockerfile custom path env secrets
|
|
279
298
|
--no-cache Build without using cache
|
|
@@ -289,7 +308,11 @@ Options:
|
|
|
289
308
|
Pull underpost dockerfile images requirements
|
|
290
309
|
|
|
291
310
|
Options:
|
|
292
|
-
|
|
311
|
+
--path [path] Dockerfile path
|
|
312
|
+
--kind-load Import tar image to Kind cluster
|
|
313
|
+
--kubeadm-load Import tar image to Kubeadm cluster
|
|
314
|
+
--version Set custom version
|
|
315
|
+
-h, --help display help for command
|
|
293
316
|
|
|
294
317
|
```
|
|
295
318
|
|
|
@@ -382,16 +405,17 @@ Options:
|
|
|
382
405
|
File storage management, for default upload file
|
|
383
406
|
|
|
384
407
|
Arguments:
|
|
385
|
-
path
|
|
408
|
+
path Absolute or relative directory
|
|
386
409
|
|
|
387
410
|
Options:
|
|
388
|
-
--rm
|
|
389
|
-
--git
|
|
390
|
-
--recursive
|
|
391
|
-
--deploy-id <deploy-id>
|
|
392
|
-
--pull
|
|
393
|
-
--force
|
|
394
|
-
-
|
|
411
|
+
--rm Remove file
|
|
412
|
+
--git Current git changes
|
|
413
|
+
--recursive Upload files recursively
|
|
414
|
+
--deploy-id <deploy-id> Deploy configuration id
|
|
415
|
+
--pull Download file
|
|
416
|
+
--force Force action
|
|
417
|
+
--storage-file-path <storage-file-path> custom file storage path
|
|
418
|
+
-h, --help display help for command
|
|
395
419
|
|
|
396
420
|
```
|
|
397
421
|
|
|
@@ -432,8 +456,26 @@ Options:
|
|
|
432
456
|
--ms-interval <ms-interval> Custom ms interval delta time
|
|
433
457
|
--now Exec immediately monitor script
|
|
434
458
|
--single Disable recurrence
|
|
459
|
+
--replicas <replicas> Set custom number of replicas
|
|
435
460
|
--type <type> Set custom monitor type
|
|
461
|
+
--sync Sync with current proxy deployments proxy
|
|
462
|
+
traffic
|
|
436
463
|
-h, --help display help for command
|
|
437
464
|
|
|
438
465
|
```
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
### `lxd` :
|
|
469
|
+
```
|
|
470
|
+
Usage: underpost lxd [options]
|
|
471
|
+
|
|
472
|
+
Lxd management
|
|
473
|
+
|
|
474
|
+
Options:
|
|
475
|
+
--init Init lxd
|
|
476
|
+
--reset Reset lxd on current machine
|
|
477
|
+
--install Install lxd on current machine
|
|
478
|
+
-h, --help display help for command
|
|
479
|
+
|
|
480
|
+
```
|
|
439
481
|
|
package/docker-compose.yml
CHANGED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: Deployment
|
|
3
|
+
metadata:
|
|
4
|
+
name: adminer
|
|
5
|
+
labels:
|
|
6
|
+
app: adminer
|
|
7
|
+
group: db
|
|
8
|
+
spec:
|
|
9
|
+
replicas: 1
|
|
10
|
+
selector:
|
|
11
|
+
matchLabels:
|
|
12
|
+
app: adminer
|
|
13
|
+
template:
|
|
14
|
+
metadata:
|
|
15
|
+
labels:
|
|
16
|
+
app: adminer
|
|
17
|
+
group: db
|
|
18
|
+
spec:
|
|
19
|
+
containers:
|
|
20
|
+
- name: adminer
|
|
21
|
+
image: adminer:4.7.6-standalone
|
|
22
|
+
ports:
|
|
23
|
+
- containerPort: 8080
|
|
24
|
+
env:
|
|
25
|
+
- name: ADMINER_DESIGN
|
|
26
|
+
value: pepa-linha
|
|
27
|
+
- name: ADMINER_DEFAULT_SERVER
|
|
28
|
+
value: postgres
|
|
29
|
+
resources:
|
|
30
|
+
limits:
|
|
31
|
+
memory: '256Mi'
|
|
32
|
+
cpu: '500m'
|
|
@@ -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
|