underpost 2.8.67 → 2.8.75
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 +34 -1
- package/README.md +1 -1
- package/bin/deploy.js +284 -3
- package/cli.md +4 -1
- package/docker-compose.yml +1 -1
- package/manifests/deployment/adminer/service.yaml +1 -1
- 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/kubeadm-calico-config.yaml +119 -0
- package/manifests/kubelet-config.yaml +65 -0
- package/manifests/postgresql/statefulset.yaml +1 -1
- package/package.json +1 -1
- package/src/cli/cluster.js +164 -37
- package/src/cli/deploy.js +15 -0
- package/src/cli/image.js +15 -3
- package/src/cli/index.js +3 -0
- package/src/index.js +1 -1
- package/manifests/calico-custom-resources.yaml +0 -25
package/.vscode/extensions.json
CHANGED
|
@@ -5,15 +5,48 @@
|
|
|
5
5
|
"codeium.codeium",
|
|
6
6
|
"eamodio.gitlens",
|
|
7
7
|
"esbenp.prettier-vscode",
|
|
8
|
+
"formulahendry.code-runner",
|
|
8
9
|
"foxundermoon.shell-format",
|
|
10
|
+
"github.codespaces",
|
|
9
11
|
"github.vscode-github-actions",
|
|
10
12
|
"golang.go",
|
|
11
13
|
"google.geminicodeassist",
|
|
14
|
+
"gruntfuggly.todo-tree",
|
|
15
|
+
"mechatroner.rainbow-csv",
|
|
16
|
+
"mindaro-dev.file-downloader",
|
|
17
|
+
"mindaro.mindaro",
|
|
18
|
+
"ms-azuretools.vscode-containers",
|
|
19
|
+
"ms-azuretools.vscode-docker",
|
|
20
|
+
"ms-kubernetes-tools.vscode-kubernetes-tools",
|
|
12
21
|
"ms-python.black-formatter",
|
|
13
22
|
"ms-python.debugpy",
|
|
14
23
|
"ms-python.python",
|
|
15
24
|
"ms-python.vscode-pylance",
|
|
25
|
+
"oderwat.indent-rainbow",
|
|
26
|
+
"pleiades.java-extension-pack-jdk",
|
|
27
|
+
"ravioshankar.scala-gurus",
|
|
28
|
+
"redhat.java",
|
|
29
|
+
"redhat.vscode-xml",
|
|
30
|
+
"redhat.vscode-yaml",
|
|
31
|
+
"ritwickdey.liveserver",
|
|
32
|
+
"scala-lang.scala",
|
|
33
|
+
"scala-lang.scala-snippets",
|
|
34
|
+
"scalameta.metals",
|
|
35
|
+
"shardulm94.trailing-spaces",
|
|
16
36
|
"streetsidesoftware.code-spell-checker",
|
|
17
|
-
"
|
|
37
|
+
"tamasfe.even-better-toml",
|
|
38
|
+
"tobermory.es6-string-html",
|
|
39
|
+
"visualstudioexptteam.intellicode-api-usage-examples",
|
|
40
|
+
"visualstudioexptteam.vscodeintellicode",
|
|
41
|
+
"vmware.vscode-boot-dev-pack",
|
|
42
|
+
"vmware.vscode-spring-boot",
|
|
43
|
+
"vscjava.vscode-gradle",
|
|
44
|
+
"vscjava.vscode-java-debug",
|
|
45
|
+
"vscjava.vscode-java-dependency",
|
|
46
|
+
"vscjava.vscode-java-pack",
|
|
47
|
+
"vscjava.vscode-java-test",
|
|
48
|
+
"vscjava.vscode-maven",
|
|
49
|
+
"vscjava.vscode-spring-boot-dashboard",
|
|
50
|
+
"vscjava.vscode-spring-initializr"
|
|
18
51
|
]
|
|
19
52
|
}
|
package/README.md
CHANGED
package/bin/deploy.js
CHANGED
|
@@ -816,8 +816,8 @@ try {
|
|
|
816
816
|
shellExec(`node bin/deploy update-dependencies`);
|
|
817
817
|
shellExec(`auto-changelog`);
|
|
818
818
|
shellExec(`node bin/build dd`);
|
|
819
|
-
shellExec(`node bin deploy --build-manifest --sync --info-router --replicas 1 dd`);
|
|
820
|
-
shellExec(`node bin deploy --build-manifest --sync --info-router --replicas 1 dd production`);
|
|
819
|
+
shellExec(`node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 dd`);
|
|
820
|
+
shellExec(`node bin deploy --kubeadm --build-manifest --sync --info-router --replicas 1 dd production`);
|
|
821
821
|
break;
|
|
822
822
|
}
|
|
823
823
|
|
|
@@ -1000,6 +1000,8 @@ EOF`);
|
|
|
1000
1000
|
shellExec(`sudo chmod 700 ~/.ssh/`);
|
|
1001
1001
|
shellExec(`sudo chmod 600 ~/.ssh/authorized_keys`);
|
|
1002
1002
|
shellExec(`sudo chmod 644 ~/.ssh/known_hosts`);
|
|
1003
|
+
shellExec(`sudo chmod 600 ~/.ssh/id_rsa`);
|
|
1004
|
+
shellExec(`sudo chmod 600 /etc/ssh/ssh_host_ed25519_key`);
|
|
1003
1005
|
shellExec(`chown -R ${user}:${user} ~/.ssh`);
|
|
1004
1006
|
|
|
1005
1007
|
shellExec(`ufw allow ${port}/tcp`);
|
|
@@ -1197,6 +1199,17 @@ EOF`);
|
|
|
1197
1199
|
break;
|
|
1198
1200
|
}
|
|
1199
1201
|
|
|
1202
|
+
case 'pg-stop': {
|
|
1203
|
+
shellExec(`sudo systemctl stop postgresql-14`);
|
|
1204
|
+
shellExec(`sudo systemctl disable postgresql-14`);
|
|
1205
|
+
break;
|
|
1206
|
+
}
|
|
1207
|
+
case 'pg-start': {
|
|
1208
|
+
shellExec(`sudo systemctl enable postgresql-14`);
|
|
1209
|
+
shellExec(`sudo systemctl restart postgresql-14`);
|
|
1210
|
+
break;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1200
1213
|
case 'pg-list-db': {
|
|
1201
1214
|
shellExec(`sudo -i -u postgres psql -c "\\l"`);
|
|
1202
1215
|
break;
|
|
@@ -1213,6 +1226,11 @@ EOF`);
|
|
|
1213
1226
|
break;
|
|
1214
1227
|
}
|
|
1215
1228
|
|
|
1229
|
+
case 'maas-stop': {
|
|
1230
|
+
shellExec(`sudo snap stop maas`);
|
|
1231
|
+
break;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1216
1234
|
case 'maas': {
|
|
1217
1235
|
dotenv.config({ path: `${getUnderpostRootPath()}/.env`, override: true });
|
|
1218
1236
|
const IP_ADDRESS = getLocalIPv4Address();
|
|
@@ -1415,6 +1433,8 @@ EOF`);
|
|
|
1415
1433
|
// Check firewall-cmd
|
|
1416
1434
|
// firewall-cmd --permanent --add-service=rpc-bind
|
|
1417
1435
|
// firewall-cmd --reload
|
|
1436
|
+
// systemctl disable firewalld
|
|
1437
|
+
// sudo firewall-cmd --permanent --add-port=10259/tcp --zone=public
|
|
1418
1438
|
|
|
1419
1439
|
// Image extension transform (.img.xz to .tar.gz):
|
|
1420
1440
|
// tar -cvzf image-name.tar.gz image-name.img.xz
|
|
@@ -2122,8 +2142,269 @@ EOF`);
|
|
|
2122
2142
|
break;
|
|
2123
2143
|
}
|
|
2124
2144
|
|
|
2125
|
-
|
|
2145
|
+
case 'fastapi-models': {
|
|
2146
|
+
shellExec(`chmod +x ../full-stack-fastapi-template/backend/initial_data.sh`);
|
|
2147
|
+
shellExec(`../full-stack-fastapi-template/backend/initial_data.sh`);
|
|
2148
|
+
shellExec(`../full-stack-fastapi-template/backend/initial_data.sh`);
|
|
2126
2149
|
break;
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
case 'fastapi': {
|
|
2153
|
+
// node bin/deploy fastapi reset
|
|
2154
|
+
// node bin/deploy fastapi reset build-back build-front secret run-back run-front
|
|
2155
|
+
// https://github.com/NonsoEchendu/full-stack-fastapi-project
|
|
2156
|
+
// https://github.com/fastapi/full-stack-fastapi-template
|
|
2157
|
+
const path = `../full-stack-fastapi-template`;
|
|
2158
|
+
const VITE_API_URL = `http://localhost:8000`;
|
|
2159
|
+
|
|
2160
|
+
if (process.argv.includes('reset')) shellExec(`sudo rm -rf ${path}`);
|
|
2161
|
+
|
|
2162
|
+
if (!fs.existsSync(path))
|
|
2163
|
+
shellExec(`cd .. && git clone https://github.com/fastapi/full-stack-fastapi-template.git`);
|
|
2164
|
+
|
|
2165
|
+
shellExec(`cd ${path} && git checkout . && git clean -f -d`);
|
|
2166
|
+
const password = fs.readFileSync(`/home/dd/engine/engine-private/postgresql-password`, 'utf8');
|
|
2167
|
+
|
|
2168
|
+
fs.writeFileSync(
|
|
2169
|
+
`${path}/.env`,
|
|
2170
|
+
fs
|
|
2171
|
+
.readFileSync(`${path}/.env`, 'utf8')
|
|
2172
|
+
.replace(`FIRST_SUPERUSER=admin@example.com`, `FIRST_SUPERUSER=development@underpost.net`)
|
|
2173
|
+
.replace(`FIRST_SUPERUSER_PASSWORD=changethis`, `FIRST_SUPERUSER_PASSWORD=${password}`)
|
|
2174
|
+
.replace(`SECRET_KEY=changethis`, `SECRET_KEY=${password}`)
|
|
2175
|
+
.replace(`POSTGRES_DB=app`, `POSTGRES_DB=postgresdb`)
|
|
2176
|
+
.replace(`POSTGRES_USER=postgres`, `POSTGRES_USER=admin`)
|
|
2177
|
+
.replace(`POSTGRES_PASSWORD=changethis`, `POSTGRES_PASSWORD=${password}`),
|
|
2178
|
+
'utf8',
|
|
2179
|
+
);
|
|
2180
|
+
fs.writeFileSync(
|
|
2181
|
+
`${path}/backend/app/core/db.py`,
|
|
2182
|
+
fs
|
|
2183
|
+
.readFileSync(`${path}/backend/app/core/db.py`, 'utf8')
|
|
2184
|
+
.replace(` # from sqlmodel import SQLModel`, ` from sqlmodel import SQLModel`)
|
|
2185
|
+
.replace(` # SQLModel.metadata.create_all(engine)`, ` SQLModel.metadata.create_all(engine)`),
|
|
2186
|
+
|
|
2187
|
+
'utf8',
|
|
2188
|
+
);
|
|
2189
|
+
|
|
2190
|
+
fs.copySync(`./manifests/deployment/fastapi/initial_data.sh`, `${path}/backend/initial_data.sh`);
|
|
2191
|
+
|
|
2192
|
+
fs.writeFileSync(
|
|
2193
|
+
`${path}/frontend/Dockerfile`,
|
|
2194
|
+
fs
|
|
2195
|
+
.readFileSync(`${path}/frontend/Dockerfile`, 'utf8')
|
|
2196
|
+
.replace('ARG VITE_API_URL=${VITE_API_URL}', `ARG VITE_API_URL='${VITE_API_URL}'`),
|
|
2197
|
+
'utf8',
|
|
2198
|
+
);
|
|
2199
|
+
|
|
2200
|
+
fs.writeFileSync(
|
|
2201
|
+
`${path}/frontend/.env`,
|
|
2202
|
+
fs
|
|
2203
|
+
.readFileSync(`${path}/frontend/.env`, 'utf8')
|
|
2204
|
+
.replace(`VITE_API_URL=http://localhost:8000`, `VITE_API_URL=${VITE_API_URL}`)
|
|
2205
|
+
.replace(`MAILCATCHER_HOST=http://localhost:1080`, `MAILCATCHER_HOST=http://localhost:1081`),
|
|
2206
|
+
|
|
2207
|
+
'utf8',
|
|
2208
|
+
);
|
|
2209
|
+
|
|
2210
|
+
if (process.argv.includes('models')) {
|
|
2211
|
+
shellExec(`node bin/deploy fastapi-models`);
|
|
2212
|
+
break;
|
|
2213
|
+
}
|
|
2214
|
+
|
|
2215
|
+
if (process.argv.includes('build-back')) {
|
|
2216
|
+
const imageName = `fastapi-backend:latest`;
|
|
2217
|
+
shellExec(`sudo podman pull docker.io/library/python:3.10`);
|
|
2218
|
+
shellExec(`sudo podman pull ghcr.io/astral-sh/uv:0.5.11`);
|
|
2219
|
+
shellExec(`sudo rm -rf ${path}/${imageName.replace(':', '_')}.tar`);
|
|
2220
|
+
const args = [
|
|
2221
|
+
`node bin dockerfile-image-build --path ${path}/backend/`,
|
|
2222
|
+
`--image-name=${imageName} --image-path=${path}`,
|
|
2223
|
+
`--podman-save --${process.argv.includes('kubeadm') ? 'kubeadm' : 'kind'}-load --no-cache`,
|
|
2224
|
+
];
|
|
2225
|
+
shellExec(args.join(' '));
|
|
2226
|
+
}
|
|
2227
|
+
if (process.argv.includes('build-front')) {
|
|
2228
|
+
const imageName = `fastapi-frontend:latest`;
|
|
2229
|
+
shellExec(`sudo podman pull docker.io/library/node:20`);
|
|
2230
|
+
shellExec(`sudo podman pull docker.io/library/nginx:1`);
|
|
2231
|
+
shellExec(`sudo rm -rf ${path}/${imageName.replace(':', '_')}.tar`);
|
|
2232
|
+
const args = [
|
|
2233
|
+
`node bin dockerfile-image-build --path ${path}/frontend/`,
|
|
2234
|
+
`--image-name=${imageName} --image-path=${path}`,
|
|
2235
|
+
`--podman-save --${process.argv.includes('kubeadm') ? 'kubeadm' : 'kind'}-load --no-cache`,
|
|
2236
|
+
];
|
|
2237
|
+
shellExec(args.join(' '));
|
|
2238
|
+
}
|
|
2239
|
+
if (process.argv.includes('secret')) {
|
|
2240
|
+
{
|
|
2241
|
+
const secretSelector = `fastapi-postgres-credentials`;
|
|
2242
|
+
shellExec(`sudo kubectl delete secret ${secretSelector}`);
|
|
2243
|
+
shellExec(
|
|
2244
|
+
`sudo kubectl create secret generic ${secretSelector}` +
|
|
2245
|
+
` --from-literal=POSTGRES_DB=postgresdb` +
|
|
2246
|
+
` --from-literal=POSTGRES_USER=admin` +
|
|
2247
|
+
` --from-file=POSTGRES_PASSWORD=/home/dd/engine/engine-private/postgresql-password`,
|
|
2248
|
+
);
|
|
2249
|
+
}
|
|
2250
|
+
{
|
|
2251
|
+
const secretSelector = `fastapi-backend-config-secret`;
|
|
2252
|
+
shellExec(`sudo kubectl delete secret ${secretSelector}`);
|
|
2253
|
+
shellExec(
|
|
2254
|
+
`sudo kubectl create secret generic ${secretSelector}` +
|
|
2255
|
+
` --from-file=SECRET_KEY=/home/dd/engine/engine-private/postgresql-password` +
|
|
2256
|
+
` --from-literal=FIRST_SUPERUSER=development@underpost.net` +
|
|
2257
|
+
` --from-file=FIRST_SUPERUSER_PASSWORD=/home/dd/engine/engine-private/postgresql-password`,
|
|
2258
|
+
);
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
if (process.argv.includes('run-back')) {
|
|
2262
|
+
shellExec(`sudo kubectl apply -f ./manifests/deployment/fastapi/backend-deployment.yml`);
|
|
2263
|
+
shellExec(`sudo kubectl apply -f ./manifests/deployment/fastapi/backend-service.yml`);
|
|
2264
|
+
}
|
|
2265
|
+
if (process.argv.includes('run-front')) {
|
|
2266
|
+
shellExec(`sudo kubectl apply -f ./manifests/deployment/fastapi/frontend-deployment.yml`);
|
|
2267
|
+
shellExec(`sudo kubectl apply -f ./manifests/deployment/fastapi/frontend-service.yml`);
|
|
2268
|
+
}
|
|
2269
|
+
break;
|
|
2270
|
+
}
|
|
2271
|
+
|
|
2272
|
+
case 'conda': {
|
|
2273
|
+
// set -e
|
|
2274
|
+
// ENV_NAME="${1:-cuda_env}"
|
|
2275
|
+
// eval "$(conda shell.bash hook)"
|
|
2276
|
+
// conda activate "${ENV_NAME}"
|
|
2277
|
+
shellExec(
|
|
2278
|
+
`export PATH="/root/miniconda3/bin:$PATH" && conda init && conda config --set auto_activate_base false`,
|
|
2279
|
+
);
|
|
2280
|
+
shellExec(`conda env list`);
|
|
2281
|
+
break;
|
|
2282
|
+
}
|
|
2283
|
+
|
|
2284
|
+
case 'kafka': {
|
|
2285
|
+
// https://medium.com/@martin.hodges/deploying-kafka-on-a-kind-kubernetes-cluster-for-development-and-testing-purposes-ed7adefe03cb
|
|
2286
|
+
const imageName = `doughgle/kafka-kraft`;
|
|
2287
|
+
shellExec(`docker pull ${imageName}`);
|
|
2288
|
+
if (!process.argv.includes('kubeadm'))
|
|
2289
|
+
shellExec(
|
|
2290
|
+
`${process.argv.includes('kubeadm') ? `ctr -n k8s.io images import` : `kind load docker-image`} ${imageName}`,
|
|
2291
|
+
);
|
|
2292
|
+
shellExec(`kubectl create namespace kafka`);
|
|
2293
|
+
shellExec(`kubectl apply -f ./manifests/deployment/kafka/deployment.yaml`);
|
|
2294
|
+
// kubectl logs kafka-0 -n kafka | grep STARTED
|
|
2295
|
+
// kubectl logs kafka-1 -n kafka | grep STARTED
|
|
2296
|
+
// kubectl logs kafka-2 -n kafka | grep STARTED
|
|
2297
|
+
|
|
2298
|
+
// kafka-topics.sh --create --topic my-topic --bootstrap-server kafka-svc:9092
|
|
2299
|
+
// kafka-topics.sh --list --topic my-topic --bootstrap-server kafka-svc:9092
|
|
2300
|
+
// kafka-topics.sh --delete --topic my-topic --bootstrap-server kafka-svc:9092
|
|
2301
|
+
|
|
2302
|
+
// kafka-console-producer.sh --bootstrap-server kafka-svc:9092 --topic my-topic
|
|
2303
|
+
// kafka-console-consumer.sh --bootstrap-server kafka-svc:9092 --topic my-topic
|
|
2304
|
+
break;
|
|
2305
|
+
}
|
|
2306
|
+
|
|
2307
|
+
case 'nvidia-gpu-operator': {
|
|
2308
|
+
// https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html
|
|
2309
|
+
shellExec(`curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo | \
|
|
2310
|
+
sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo`);
|
|
2311
|
+
|
|
2312
|
+
const NVIDIA_CONTAINER_TOOLKIT_VERSION = '1.17.8-1';
|
|
2313
|
+
|
|
2314
|
+
shellExec(`sudo dnf install -y \
|
|
2315
|
+
nvidia-container-toolkit-${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
|
2316
|
+
nvidia-container-toolkit-base-${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
|
2317
|
+
libnvidia-container-tools-${NVIDIA_CONTAINER_TOOLKIT_VERSION} \
|
|
2318
|
+
libnvidia-container1-${NVIDIA_CONTAINER_TOOLKIT_VERSION}`);
|
|
2319
|
+
|
|
2320
|
+
// https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/latest/getting-started.html
|
|
2321
|
+
|
|
2322
|
+
shellExec(`kubectl create ns gpu-operator`);
|
|
2323
|
+
shellExec(`kubectl label --overwrite ns gpu-operator pod-security.kubernetes.io/enforce=privileged`);
|
|
2324
|
+
|
|
2325
|
+
shellExec(`helm repo add nvidia https://helm.ngc.nvidia.com/nvidia \
|
|
2326
|
+
&& helm repo update`);
|
|
2327
|
+
|
|
2328
|
+
// shellExec(`helm install --wait --generate-name \
|
|
2329
|
+
// -n gpu-operator --create-namespace \
|
|
2330
|
+
// nvidia/gpu-operator \
|
|
2331
|
+
// --version=v25.3.1 \
|
|
2332
|
+
// --set toolkit.version=v1.16.1-ubi8`);
|
|
2333
|
+
|
|
2334
|
+
shellExec(`helm install --wait --generate-name \
|
|
2335
|
+
-n gpu-operator --create-namespace \
|
|
2336
|
+
nvidia/gpu-operator \
|
|
2337
|
+
--version=v25.3.1 \
|
|
2338
|
+
--set driver.enabled=false \
|
|
2339
|
+
--set driver.repository=nvcr.io/nvidia \
|
|
2340
|
+
--set cdi.enabled=true \
|
|
2341
|
+
--set cdi.default=true \
|
|
2342
|
+
--set toolkit.env[0].name=CONTAINERD_CONFIG \
|
|
2343
|
+
--set toolkit.env[0].value=/etc/containerd/config.toml \
|
|
2344
|
+
--set toolkit.env[1].name=CONTAINERD_SOCKET \
|
|
2345
|
+
--set toolkit.env[1].value=/run/containerd/containerd.sock \
|
|
2346
|
+
--set toolkit.env[2].name=CONTAINERD_RUNTIME_CLASS \
|
|
2347
|
+
--set toolkit.env[2].value=nvidia \
|
|
2348
|
+
--set-string toolkit.env[3].name=CONTAINERD_SET_AS_DEFAULT \
|
|
2349
|
+
--set-string toolkit.env[3].value=true`);
|
|
2350
|
+
|
|
2351
|
+
// Check gpu drivers
|
|
2352
|
+
shellExec(
|
|
2353
|
+
`break;kubectl get nodes -o json | jq '.items[].metadata.labels | keys | any(startswith("feature.node.kubernetes.io"))'`,
|
|
2354
|
+
);
|
|
2355
|
+
break;
|
|
2356
|
+
}
|
|
2357
|
+
|
|
2358
|
+
case 'kubeflow-spark-operator': {
|
|
2359
|
+
// Use case:
|
|
2360
|
+
// Data Processing Pipelines: Used for ETL tasks where Spark can handle large data volumes efficiently.
|
|
2361
|
+
// Real-Time Analytics: Processing data from streaming sources (e.g., Kafka) for real-time analytics.
|
|
2362
|
+
// Machine Learning and Data Science: Training and deploying machine learning models at scale using Spark MLlib.
|
|
2363
|
+
|
|
2364
|
+
shellExec(`helm repo add spark-operator https://kubeflow.github.io/spark-operator`);
|
|
2365
|
+
shellExec(`helm install spark-operator spark-operator/spark-operator \
|
|
2366
|
+
--namespace spark-operator \
|
|
2367
|
+
--create-namespace \
|
|
2368
|
+
--wait`);
|
|
2369
|
+
|
|
2370
|
+
const image = `spark:3.5.3`;
|
|
2371
|
+
shellExec(`sudo docker pull ${image}`);
|
|
2372
|
+
if (!process.argv.includes('kubeadm'))
|
|
2373
|
+
shellExec(
|
|
2374
|
+
`sudo ${
|
|
2375
|
+
process.argv.includes('kubeadm') ? `ctr -n k8s.io images import` : `kind load docker-image`
|
|
2376
|
+
} ${image}`,
|
|
2377
|
+
);
|
|
2378
|
+
shellExec(`kubectl apply -f ./manifests/deployment/spark/spark-pi-py.yaml`);
|
|
2379
|
+
|
|
2380
|
+
// Check the status of the Spark job:
|
|
2381
|
+
// kubectl get sparkapplications.sparkoperator.k8s.io -n default
|
|
2382
|
+
// kubectl get sparkapplication
|
|
2383
|
+
|
|
2384
|
+
// Check case log:
|
|
2385
|
+
// kubectl logs -f spark-pi-python-driver
|
|
2386
|
+
// kubectl logs -f spark-pi-python-driver | grep Pi
|
|
2387
|
+
// kubectl describe sparkapplication spark-gpu-test
|
|
2388
|
+
|
|
2389
|
+
// Uninstall:
|
|
2390
|
+
// kubectl delete sparkapplications.sparkoperator.k8s.io spark-pi-python -n default
|
|
2391
|
+
// helm delete spark-operator -n spark-operator
|
|
2392
|
+
|
|
2393
|
+
// Gpu plugins:
|
|
2394
|
+
// https://github.com/NVIDIA/spark-rapids
|
|
2395
|
+
// RAPIDS Accelerator
|
|
2396
|
+
break;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
case 'sbt': {
|
|
2400
|
+
// https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Linux.html
|
|
2401
|
+
|
|
2402
|
+
// sudo rm -f /etc/yum.repos.d/bintray-rpm.repo
|
|
2403
|
+
// curl -L https://www.scala-sbt.org/sbt-rpm.repo > sbt-rpm.repo
|
|
2404
|
+
// sudo mv sbt-rpm.repo /etc/yum.repos.d/
|
|
2405
|
+
// sudo yum install sbt
|
|
2406
|
+
break;
|
|
2407
|
+
}
|
|
2127
2408
|
}
|
|
2128
2409
|
} catch (error) {
|
|
2129
2410
|
logger.error(error, error.stack);
|
package/cli.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
## underpost ci/cd cli v2.8.
|
|
1
|
+
## underpost ci/cd cli v2.8.75
|
|
2
2
|
|
|
3
3
|
### Usage: `underpost [options] [command]`
|
|
4
4
|
```
|
|
@@ -203,9 +203,11 @@ Options:
|
|
|
203
203
|
--valkey Init with valkey service
|
|
204
204
|
--contour Init with project contour base HTTPProxy and envoy
|
|
205
205
|
--cert-manager Init with letsencrypt-prod ClusterIssuer
|
|
206
|
+
--dedicated-gpu Init with dedicated gpu base resources env
|
|
206
207
|
--info Get all kinds objects deployed
|
|
207
208
|
--full Init with all statefulsets and services available
|
|
208
209
|
--ns-use <ns-name> Switches current context to namespace
|
|
210
|
+
--kubeadm Init with kubeadm controlplane management
|
|
209
211
|
--dev init with dev cluster
|
|
210
212
|
--list-pods Display list pods information
|
|
211
213
|
--info-capacity display current total machine capacity info
|
|
@@ -282,6 +284,7 @@ Options:
|
|
|
282
284
|
--dockerfile-name [dockerfile-name] set Dockerfile name
|
|
283
285
|
--podman-save Export tar file from podman
|
|
284
286
|
--kind-load Import tar image to Kind cluster
|
|
287
|
+
--kubeadm-load Import tar image to Kubeadm cluster
|
|
285
288
|
--secrets Dockerfile env secrets
|
|
286
289
|
--secrets-path [secrets-path] Dockerfile custom path env secrets
|
|
287
290
|
--no-cache Build without using cache
|
package/docker-compose.yml
CHANGED
|
@@ -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
|