fix: improve password reset script

This commit is contained in:
biersoeckli
2025-02-02 11:44:30 +00:00
parent 865cb822e9
commit 6ee9dce300
3 changed files with 26 additions and 12 deletions

View File

@@ -1,4 +1,6 @@
#!/bin/bash
#!/bin/sh
# curl -sfL https://get.quickstack.dev/reset-password.sh | sh -
DEPLOYMENT="quickstack"
NAMESPACE="quickstack"
@@ -25,17 +27,16 @@ kubectl patch deployment "$DEPLOYMENT" -n "$NAMESPACE" --type='json' -p='[
echo "Initialized password change successfully, please wait..."
# Wait for a new pod to be created
sleep 2
echo "Waiting for the new pod to be in Running status..."
kubectl wait --for=condition=Ready pod -l app="$DEPLOYMENT" -n "$NAMESPACE" --timeout=300s
# Retreive the new pod name
NEW_POD=""
while [[ -z "$NEW_POD" || "$NEW_POD" == "$OLD_POD" ]]; do
while [ -z "$NEW_POD" ] || [ "$NEW_POD" = "$OLD_POD" ]; do
sleep 2
NEW_POD=$(kubectl get pods -n "$NAMESPACE" -l app="$DEPLOYMENT" -o jsonpath="{.items[-1].metadata.name}")
done
echo "New pod detected: $NEW_POD"
# Wait until the new pod is in Running state
echo "Waiting for pod $NEW_POD to be in Running state..."
kubectl wait --for=condition=ready pod "$NEW_POD" -n "$NAMESPACE" --timeout=60s
kubectl logs -f "$NEW_POD" -n "$NAMESPACE"

View File

@@ -93,7 +93,11 @@ class AppLogsService {
async writeLogsToDiskForAllRunningApps(date?: Date) {
const apps = await dataAccess.client.app.findMany();
for (const app of apps) {
await this.writeAppLogsToDiskForApp(app.id, date);
try {
await this.writeAppLogsToDiskForApp(app.id, date);
} catch (error) {
console.error(`Error writing logs to disk for app ${app.id}`, error);
}
}
}

View File

@@ -30,13 +30,22 @@ class PasswordChangeService {
}
});
console.log(' ******* Password change *******');
console.log(``);
console.log(``);
console.log('*******************************');
console.log('******* Password change *******');
console.log('*******************************');
console.log(``);
console.log(`New password for user ${firstCreatedUser.email} is: ${generatedPassword}`);
console.log(``);
console.log(' *******************************');
console.log('*******************************');
console.log('*******************************');
console.log('*******************************');
console.log(``);
console.log(``);
console.log(`Restarting QuickStack, please wait...`);
console.log(``);
console.log(``);
const existingDeployment = await quickStackService.getExistingDeployment();
await quickStackService.createOrUpdateDeployment(existingDeployment.nextAuthSecret, existingDeployment.isCanaryDeployment ? 'canary' : 'latest');