underpost 2.8.65 → 2.8.71
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 +3 -2
- package/.vscode/settings.json +2 -0
- package/CHANGELOG.md +24 -4
- package/README.md +39 -2
- package/bin/deploy.js +1351 -145
- package/bin/file.js +8 -0
- package/bin/index.js +1 -240
- package/cli.md +451 -0
- package/docker-compose.yml +1 -1
- package/jsdoc.json +1 -1
- package/manifests/calico-custom-resources.yaml +25 -0
- 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/kubeadm-calico-config.yaml +119 -0
- package/manifests/mongodb-4.4/service-deployment.yaml +1 -1
- 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 +6 -4
- package/package.json +2 -1
- package/src/cli/cluster.js +163 -18
- package/src/cli/deploy.js +68 -8
- package/src/cli/fs.js +14 -3
- package/src/cli/image.js +1 -1
- package/src/cli/index.js +312 -0
- package/src/cli/monitor.js +93 -39
- 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/server/client-build.js +13 -0
- 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
|
@@ -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,119 @@
|
|
|
1
|
+
# This consolidated YAML file contains configurations for:
|
|
2
|
+
# 1. Calico Installation (Installation and APIServer resources)
|
|
3
|
+
# 2. A permissive Egress NetworkPolicy for the 'default' namespace
|
|
4
|
+
#
|
|
5
|
+
# These are standard Kubernetes resources that can be applied directly using 'kubectl apply'.
|
|
6
|
+
# The kubeadm-specific ClusterConfiguration and InitConfiguration have been removed
|
|
7
|
+
# as they are only processed by the 'kubeadm init' command, not 'kubectl apply'.
|
|
8
|
+
|
|
9
|
+
# --- Calico Installation: Base configuration for Calico ---
|
|
10
|
+
# For more information, see: https://projectcalico.docs.tigera.io/master/reference/installation/api#operator.tigera.io/v1.Installation
|
|
11
|
+
apiVersion: operator.tigera.io/v1
|
|
12
|
+
kind: Installation
|
|
13
|
+
metadata:
|
|
14
|
+
name: default
|
|
15
|
+
spec:
|
|
16
|
+
# Configures Calico networking.
|
|
17
|
+
calicoNetwork:
|
|
18
|
+
# Note: The ipPools section cannot be modified post-install.
|
|
19
|
+
ipPools:
|
|
20
|
+
- blockSize: 26
|
|
21
|
+
cidr: 192.168.0.0/16
|
|
22
|
+
encapsulation: VXLANCrossSubnet
|
|
23
|
+
natOutgoing: Enabled
|
|
24
|
+
nodeSelector: all()
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
# This section configures the Calico API server.
|
|
28
|
+
# For more information, see: https://projectcalico.docs.tigera.io/master/reference/installation/api#operator.tigera.io/v1.APIServer
|
|
29
|
+
apiVersion: operator.tigera.io/v1
|
|
30
|
+
kind: APIServer
|
|
31
|
+
metadata:
|
|
32
|
+
name: default
|
|
33
|
+
spec: {}
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
# This consolidated NetworkPolicy file ensures that all pods in the specified namespaces
|
|
37
|
+
# have unrestricted egress (outbound) access.
|
|
38
|
+
# This is useful for troubleshooting or for environments where strict egress control
|
|
39
|
+
# is not immediately required for these system/default namespaces.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
# Policy for the 'default' namespace
|
|
43
|
+
apiVersion: networking.k8s.io/v1
|
|
44
|
+
kind: NetworkPolicy
|
|
45
|
+
metadata:
|
|
46
|
+
name: allow-all-egress-default-namespace
|
|
47
|
+
namespace: default # This policy applies to the 'default' namespace
|
|
48
|
+
spec:
|
|
49
|
+
podSelector: {} # Selects all pods in this namespace
|
|
50
|
+
policyTypes:
|
|
51
|
+
- Egress
|
|
52
|
+
egress:
|
|
53
|
+
- to:
|
|
54
|
+
- ipBlock:
|
|
55
|
+
cidr: 0.0.0.0/0 # Allows traffic to any IPv4 address
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
# Policy for the 'kube-system' namespace
|
|
59
|
+
apiVersion: networking.k8s.io/v1
|
|
60
|
+
kind: NetworkPolicy
|
|
61
|
+
metadata:
|
|
62
|
+
name: allow-all-egress-kube-system-namespace
|
|
63
|
+
namespace: kube-system # This policy applies to the 'kube-system' namespace
|
|
64
|
+
spec:
|
|
65
|
+
podSelector: {} # Selects all pods in this namespace
|
|
66
|
+
policyTypes:
|
|
67
|
+
- Egress
|
|
68
|
+
egress:
|
|
69
|
+
- to:
|
|
70
|
+
- ipBlock:
|
|
71
|
+
cidr: 0.0.0.0/0 # Allows traffic to any IPv4 address
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
# Policy for the 'kube-node-lease' namespace
|
|
75
|
+
apiVersion: networking.k8s.io/v1
|
|
76
|
+
kind: NetworkPolicy
|
|
77
|
+
metadata:
|
|
78
|
+
name: allow-all-egress-kube-node-lease-namespace
|
|
79
|
+
namespace: kube-node-lease # This policy applies to the 'kube-node-lease' namespace
|
|
80
|
+
spec:
|
|
81
|
+
podSelector: {} # Selects all pods in this namespace
|
|
82
|
+
policyTypes:
|
|
83
|
+
- Egress
|
|
84
|
+
egress:
|
|
85
|
+
- to:
|
|
86
|
+
- ipBlock:
|
|
87
|
+
cidr: 0.0.0.0/0 # Allows traffic to any IPv4 address
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
# Policy for the 'kube-public' namespace
|
|
91
|
+
apiVersion: networking.k8s.io/v1
|
|
92
|
+
kind: NetworkPolicy
|
|
93
|
+
metadata:
|
|
94
|
+
name: allow-all-egress-kube-public-namespace
|
|
95
|
+
namespace: kube-public # This policy applies to the 'kube-public' namespace
|
|
96
|
+
spec:
|
|
97
|
+
podSelector: {} # Selects all pods in this namespace
|
|
98
|
+
policyTypes:
|
|
99
|
+
- Egress
|
|
100
|
+
egress:
|
|
101
|
+
- to:
|
|
102
|
+
- ipBlock:
|
|
103
|
+
cidr: 0.0.0.0/0 # Allows traffic to any IPv4 address
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
# Policy for the 'tigera-operator' namespace
|
|
107
|
+
apiVersion: networking.k8s.io/v1
|
|
108
|
+
kind: NetworkPolicy
|
|
109
|
+
metadata:
|
|
110
|
+
name: allow-all-egress-tigera-operator-namespace
|
|
111
|
+
namespace: tigera-operator # This policy applies to the 'tigera-operator' namespace
|
|
112
|
+
spec:
|
|
113
|
+
podSelector: {} # Selects all pods in this namespace
|
|
114
|
+
policyTypes:
|
|
115
|
+
- Egress
|
|
116
|
+
egress:
|
|
117
|
+
- to:
|
|
118
|
+
- ipBlock:
|
|
119
|
+
cidr: 0.0.0.0/0 # Allows traffic to any IPv4 address
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
kind: PersistentVolume
|
|
2
|
+
apiVersion: v1
|
|
3
|
+
metadata:
|
|
4
|
+
name: postgres-pv-volume
|
|
5
|
+
labels:
|
|
6
|
+
type: local
|
|
7
|
+
app: postgres
|
|
8
|
+
spec:
|
|
9
|
+
storageClassName: manual
|
|
10
|
+
capacity:
|
|
11
|
+
storage: 5Gi
|
|
12
|
+
accessModes:
|
|
13
|
+
- ReadWriteMany
|
|
14
|
+
hostPath:
|
|
15
|
+
path: '/mnt/data'
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
apiVersion: apps/v1
|
|
2
|
+
kind: StatefulSet
|
|
3
|
+
metadata:
|
|
4
|
+
name: postgres
|
|
5
|
+
spec:
|
|
6
|
+
serviceName: postgres
|
|
7
|
+
replicas: 1
|
|
8
|
+
selector:
|
|
9
|
+
matchLabels:
|
|
10
|
+
app: postgres
|
|
11
|
+
template:
|
|
12
|
+
metadata:
|
|
13
|
+
labels:
|
|
14
|
+
app: postgres
|
|
15
|
+
spec:
|
|
16
|
+
containers:
|
|
17
|
+
- name: postgres
|
|
18
|
+
image: postgres:latest
|
|
19
|
+
imagePullPolicy: Never
|
|
20
|
+
ports:
|
|
21
|
+
- containerPort: 5432
|
|
22
|
+
envFrom:
|
|
23
|
+
- configMapRef:
|
|
24
|
+
name: postgres-config
|
|
25
|
+
env:
|
|
26
|
+
- name: POSTGRES_PASSWORD
|
|
27
|
+
valueFrom:
|
|
28
|
+
secretKeyRef:
|
|
29
|
+
name: postgres-secret
|
|
30
|
+
key: password
|
|
31
|
+
volumeMounts:
|
|
32
|
+
- mountPath: /var/lib/postgresql/data
|
|
33
|
+
name: postgredb
|
|
34
|
+
volumes:
|
|
35
|
+
- name: postgredb
|
|
36
|
+
persistentVolumeClaim:
|
|
37
|
+
claimName: postgres-pv-claim
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
---
|
|
2
1
|
apiVersion: apps/v1
|
|
3
2
|
kind: StatefulSet
|
|
4
3
|
metadata:
|
|
@@ -15,9 +14,14 @@ spec:
|
|
|
15
14
|
labels:
|
|
16
15
|
app: service-valkey
|
|
17
16
|
spec:
|
|
17
|
+
# Prevent automatic token mounting if you're not using the default ServiceAccount
|
|
18
|
+
automountServiceAccountToken: false
|
|
19
|
+
|
|
18
20
|
containers:
|
|
19
21
|
- name: service-valkey
|
|
20
|
-
image:
|
|
22
|
+
image: valkey/valkey:latest
|
|
23
|
+
# Ensure you pull only if not present (Never will error if missing)
|
|
24
|
+
imagePullPolicy: Never
|
|
21
25
|
env:
|
|
22
26
|
- name: TZ
|
|
23
27
|
value: Europe/Zurich
|
|
@@ -35,5 +39,3 @@ spec:
|
|
|
35
39
|
failureThreshold: 2
|
|
36
40
|
periodSeconds: 30
|
|
37
41
|
timeoutSeconds: 5
|
|
38
|
-
restartPolicy: Always
|
|
39
|
-
automountServiceAccountToken: false
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"type": "module",
|
|
3
3
|
"main": "src/index.js",
|
|
4
4
|
"name": "underpost",
|
|
5
|
-
"version": "2.8.
|
|
5
|
+
"version": "2.8.71",
|
|
6
6
|
"description": "pwa api rest template",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"start": "env-cmd -f .env.production node --max-old-space-size=8192 src/server",
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
"dev": "env-cmd -f .env.development node src/client.dev default",
|
|
12
12
|
"dev-img": "env-cmd -f .env.development node src/server",
|
|
13
13
|
"prod-img": "env-cmd -f .env.production node src/server",
|
|
14
|
+
"monitor": "pm2 start bin/deploy.js --name monitor -- monitor",
|
|
14
15
|
"dev-api": "env-cmd -f .env.development nodemon --watch src --ignore src/client src/api",
|
|
15
16
|
"dev-client": "env-cmd -f .env.development node src/client.dev",
|
|
16
17
|
"proxy": "node src/proxy proxy",
|