mirror of
https://github.com/biersoeckli/QuickStack.git
synced 2026-01-08 20:49:31 -06:00
fix server.ts and asynclocalstorage
This commit is contained in:
@@ -4,11 +4,14 @@ import next from 'next'
|
||||
import socketIoServer from './socket-io.server'
|
||||
import quickStackService from './server/services/qs.service'
|
||||
import { CommandExecutorUtils } from './server/utils/command-executor.utils'
|
||||
import { ParamService } from './server/services/param.service'
|
||||
import dataAccess from './server/adapter/db.client'
|
||||
import { FancyConsoleUtils } from './server/utils/fancy-console.utils'
|
||||
import { Constants } from './server/utils/constants'
|
||||
|
||||
// Source: https://nextjs.org/docs/app/building-your-application/configuring/custom-server
|
||||
|
||||
FancyConsoleUtils.printQuickStack();
|
||||
|
||||
const port = parseInt(process.env.PORT || '3000', 10)
|
||||
const dev = process.env.NODE_ENV !== 'production'
|
||||
|
||||
@@ -34,10 +37,10 @@ async function initializeNextJs() {
|
||||
console.log('Saving K3S_JOIN_TOKEN to database...');
|
||||
await dataAccess.client.parameter.upsert({
|
||||
where: {
|
||||
name: ParamService.K3S_JOIN_TOKEN
|
||||
name: Constants.K3S_JOIN_TOKEN
|
||||
},
|
||||
create: {
|
||||
name: ParamService.K3S_JOIN_TOKEN,
|
||||
name: Constants.K3S_JOIN_TOKEN,
|
||||
value: process.env.K3S_JOIN_TOKEN
|
||||
},
|
||||
update: {
|
||||
|
||||
@@ -2,13 +2,14 @@ import { revalidateTag, unstable_cache } from "next/cache";
|
||||
import dataAccess from "../adapter/db.client";
|
||||
import { Tags } from "../utils/cache-tag-generator.utils";
|
||||
import { Parameter, Prisma } from "@prisma/client";
|
||||
import { Constants } from "../utils/constants";
|
||||
|
||||
export class ParamService {
|
||||
|
||||
static readonly QS_SERVER_HOSTNAME = 'qsServerHostname';
|
||||
static readonly DISABLE_NODEPORT_ACCESS = 'disableNodePortAccess';
|
||||
static readonly LETS_ENCRYPT_MAIL = 'letsEncryptMail';
|
||||
static readonly K3S_JOIN_TOKEN = 'k3sJoinToken';
|
||||
static readonly K3S_JOIN_TOKEN = Constants.K3S_JOIN_TOKEN;
|
||||
|
||||
async get(name: string) {
|
||||
return await unstable_cache(async (name: string) => await dataAccess.client.parameter.findFirstOrThrow({
|
||||
|
||||
@@ -3,6 +3,7 @@ import { V1Deployment, V1Ingress, V1Service } from "@kubernetes/client-node";
|
||||
import namespaceService from "./namespace.service";
|
||||
import { StringUtils } from "../utils/string.utils";
|
||||
import crypto from "crypto";
|
||||
import { FancyConsoleUtils } from "../utils/fancy-console.utils";
|
||||
|
||||
class QuickStackService {
|
||||
|
||||
@@ -22,7 +23,9 @@ class QuickStackService {
|
||||
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('');
|
||||
|
||||
@@ -3,4 +3,5 @@ export class Constants {
|
||||
static readonly QS_ANNOTATION_PROJECT_ID = 'qs-project-id';
|
||||
static readonly QS_ANNOTATION_DEPLOYMENT_ID = 'qs-deplyoment-id';
|
||||
static readonly QS_ANNOTATION_GIT_COMMIT = 'qs-git-commit';
|
||||
static readonly K3S_JOIN_TOKEN = 'k3sJoinToken';;
|
||||
}
|
||||
11
src/server/utils/fancy-console.utils.ts
Normal file
11
src/server/utils/fancy-console.utils.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export class FancyConsoleUtils {
|
||||
public static printQuickStack() {
|
||||
console.log('');
|
||||
console.log(' ___ _ _ ____ _ _ ');
|
||||
console.log(' / _ \\ _ _(_) ___| | __/ ___|| |_ __ _ ___| | __');
|
||||
console.log('| | | | | | | |/ __| |/ /\\___ \\| __/ _` |/ __| |/ /');
|
||||
console.log('| |_| | |_| | | (__| < ___) | || (_| | (__| < ');
|
||||
console.log(' \\__\\_\\\\__,_|_|\\___|_|\\_\\|____/ \\__\\__,_|\\___|_|\\_\\');
|
||||
console.log('');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user