Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/app/settings/server/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,12 @@ export const updateIngressSettings = async (prevState: any, inputData: QsIngress
value: validatedData.disableNodePortAccess + ''
});

const currentReleaseChannel = await paramService.getString(ParamService.USE_CANARY_CHANNEL, 'false');

await quickStackService.createOrUpdateService(!validatedData.disableNodePortAccess);
await quickStackService.createOrUpdateIngress(validatedData.serverUrl);
setTimeout(() => quickStackService.createOrUpdateDeployment(undefined, currentReleaseChannel === 'true' ? 'canary' : 'latest'), 2000); // delay is needed to ensure that the response is sent before the backend restarts, otherwise an error is shown in the UI.

});


Expand Down
2 changes: 1 addition & 1 deletion src/server/services/param.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CryptoUtils } from "../utils/crypto.utils";

export class ParamService {

static readonly QS_SERVER_HOSTNAME = 'qsServerHostname';
static readonly QS_SERVER_HOSTNAME = Constants.QS_PARAM_SERVER_HOSTNAME;
static readonly DISABLE_NODEPORT_ACCESS = 'disableNodePortAccess';
static readonly LETS_ENCRYPT_MAIL = 'letsEncryptMail';
static readonly USE_CANARY_CHANNEL = 'useCanaryChannel';
Expand Down
11 changes: 11 additions & 0 deletions src/server/services/qs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import crypto from "crypto";
import { FancyConsoleUtils } from "../../shared/utils/fancy-console.utils";
import standalonePodService from "./standalone-services/standalone-pod.service";
import ingressSetupService from "./setup-services/ingress-setup.service";
import dataAccess from "../adapter/db.client";
import { Constants } from "@/shared/utils/constants";

class QuickStackService {

Expand Down Expand Up @@ -259,6 +261,11 @@ class QuickStackService {
async createOrUpdateDeployment(inputNextAuthSecret?: string, imageTag = 'latest') {
const generatedNextAuthSecret = crypto.randomBytes(32).toString('base64');
const existingDeployment = await this.getExistingDeployment();
const hostnameParam = await dataAccess.client.parameter.findUnique({
where: { name: Constants.QS_PARAM_SERVER_HOSTNAME },
select: { value: true },
});
const nextAuthUrl = hostnameParam?.value ? `https://${hostnameParam.value}` : undefined;
const body: V1Deployment = {
metadata: {
name: this.QUICKSTACK_DEPLOYMENT_NAME,
Expand Down Expand Up @@ -299,6 +306,10 @@ class QuickStackService {
name: 'NEXTAUTH_SECRET',
value: inputNextAuthSecret || existingDeployment.nextAuthSecret || generatedNextAuthSecret
},
...nextAuthUrl ? [{
name: 'NEXTAUTH_URL',
value: nextAuthUrl,
}] : [],
...process.env.K3S_JOIN_TOKEN ? [{
name: 'K3S_JOIN_TOKEN',
value: process.env.K3S_JOIN_TOKEN
Expand Down
1 change: 1 addition & 0 deletions src/shared/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ export class Constants {
static readonly QS_AUTH_PROXY_IMAGE = 'quickstack/auth-proxy:canary';
static readonly QS_AGENT_CLAIM_COOKIE = 'qs-agent-claim';
static readonly QS_AGENT_ACCESS_COOKIE = 'qs-agent-access';
static readonly QS_PARAM_SERVER_HOSTNAME = 'qsServerHostname';

}
Loading