optimized qs setup

This commit is contained in:
biersoeckli
2024-11-25 17:14:59 +00:00
parent f403988776
commit b715386659
3 changed files with 24 additions and 5 deletions
+2 -1
View File
@@ -74,6 +74,7 @@ async function initializeNextJs() {
if (process.env.NODE_ENV === 'production' && process.env.START_MODE === 'setup') {
setupQuickStack();
} else {
initializeNextJs();
setupQuickStack();
//initializeNextJs();
}
+20 -2
View File
@@ -4,6 +4,8 @@ import namespaceService from "./namespace.service";
import { StringUtils } from "../utils/string.utils";
import crypto from "crypto";
import { FancyConsoleUtils } from "../utils/fancy-console.utils";
import deploymentService from "./deployment.service";
import podService from "./pod.service";
class QuickStackService {
@@ -20,17 +22,33 @@ class QuickStackService {
await this.createOrUpdatePvc();
await this.createOrUpdateDeployment(undefined, nextAuthSecret);
await this.createOrUpdateService(true);
await this.waitUntilQuickstackIsRunning();
console.log('QuickStack successfully initialized');
console.log('');
console.log('------------------------------------------------');
FancyConsoleUtils.printQuickStack();
console.log('You can now access QuickStack UI on the following URL: http://SERVER-IP:30000');
console.log('')
console.log('Hint: Ensure that the port 30000 is open in your firewall.');
console.log('');
console.log('');
console.log('* Hint: Ensure that the port 30000 is open in your firewall.');
console.log('');
console.log('------------------------------------------------');
console.log('');
}
async waitUntilQuickstackIsRunning() {
console.log('Waiting for QuickStack to be running...');
await new Promise((resolve) => setTimeout(resolve, 5000));
const pods = await podService.getPodsForApp(this.QUICKSTACK_NAMESPACE, this.QUICKSTACK_DEPLOYMENT_NAME);
const quickStackPod = pods.find(p => p);
if (!quickStackPod) {
console.error('[ERROR] QuickStack pod was not found');
return;
}
await podService.waitUntilPodIsRunningFailedOrSucceded(this.QUICKSTACK_NAMESPACE, quickStackPod.podName);
console.log('QuickStack is now running');
}
async createOrUpdateIngress(hostname: string) {
const ingressName = StringUtils.getIngressName(this.QUICKSTACK_NAMESPACE);
const existingIngresses = await k3s.network.listNamespacedIngress(this.QUICKSTACK_NAMESPACE);
+2 -2
View File
@@ -2,8 +2,8 @@ import path from 'path';
export class PathUtils {
static internalDataRoot = process.env.NODE_ENV === 'production' ? '/app/storage' : '/workspace/internal';
static tempDataRoot = process.env.NODE_ENV === 'production' ? '/app/tmp-storage' : '/workspace/internal';
static internalDataRoot = process.env.NODE_ENV === 'production' ? '/app/storage' : '/workspace/storage/internal';
static tempDataRoot = process.env.NODE_ENV === 'production' ? '/app/tmp-storage' : '/workspace/storage/tmp';
static get gitRootPath() {
return path.join(this.tempDataRoot, 'git');