fix: login microsoft
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 2s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 14m32s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 1m33s
BCards Deployment Pipeline / Deploy to Test (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
All checks were successful
BCards Deployment Pipeline / Run Tests (push) Successful in 2s
BCards Deployment Pipeline / PR Validation (push) Has been skipped
BCards Deployment Pipeline / Build and Push Image (push) Successful in 14m32s
BCards Deployment Pipeline / Deploy to Production (ARM - OCI) (push) Successful in 1m33s
BCards Deployment Pipeline / Deploy to Test (x86 - Local) (push) Has been skipped
BCards Deployment Pipeline / Cleanup Old Resources (push) Has been skipped
BCards Deployment Pipeline / Deployment Summary (push) Successful in 0s
This commit is contained in:
parent
6c1c6cb543
commit
3f4fed08d5
52
deploy/docker-stack.yml
Normal file
52
deploy/docker-stack.yml
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
configs:
|
||||||
|
bcards-appsettings:
|
||||||
|
external: true
|
||||||
|
|
||||||
|
services:
|
||||||
|
bcards-app:
|
||||||
|
image: registry.redecarneir.us/bcards:latest
|
||||||
|
networks:
|
||||||
|
- bcards-net
|
||||||
|
deploy:
|
||||||
|
replicas: 4
|
||||||
|
placement:
|
||||||
|
max_replicas_per_node: 2
|
||||||
|
update_config:
|
||||||
|
parallelism: 1
|
||||||
|
order: start-first
|
||||||
|
delay: 10s
|
||||||
|
monitor: 60s
|
||||||
|
failure_action: rollback
|
||||||
|
rollback_config:
|
||||||
|
parallelism: 0
|
||||||
|
delay: 5s
|
||||||
|
configs:
|
||||||
|
- source: bcards-appsettings
|
||||||
|
target: /app/appsettings.Production.json
|
||||||
|
mode: 0444
|
||||||
|
environment:
|
||||||
|
ASPNETCORE_ENVIRONMENT: Production
|
||||||
|
ASPNETCORE_URLS: http://+:8080
|
||||||
|
ASPNETCORE_FORWARDEDHEADERS_ENABLED: "true"
|
||||||
|
MongoDb__ConnectionString: mongodb://admin:c4rn31r0@129.146.116.218:27017,141.148.162.114:27017/BCardsDB?replicaSet=rs0&authSource=admin
|
||||||
|
MongoDb__DatabaseName: BCardsDB
|
||||||
|
Serilog__OpenSearchUrl: http://141.148.162.114:19201
|
||||||
|
Serilog__OpenSearchFallback: http://129.146.116.218:19202
|
||||||
|
Logging__LogLevel__Default: Information
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 10s
|
||||||
|
retries: 3
|
||||||
|
start_period: 40s
|
||||||
|
ports:
|
||||||
|
- published: 8080
|
||||||
|
target: 8080
|
||||||
|
protocol: tcp
|
||||||
|
mode: ingress
|
||||||
|
|
||||||
|
networks:
|
||||||
|
bcards-net:
|
||||||
|
external: true
|
||||||
84
scripts/swarm_deploy.sh
Normal file
84
scripts/swarm_deploy.sh
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if [[ $# -lt 4 ]]; then
|
||||||
|
echo "Usage: $0 <stack-name> <service-name> <stack-file> <health-url> [expected-replicas]" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
STACK_NAME="$1"
|
||||||
|
SERVICE_NAME="$2"
|
||||||
|
STACK_FILE="$3"
|
||||||
|
HEALTH_URL="$4"
|
||||||
|
EXPECTED_REPLICAS="${5:-4}"
|
||||||
|
|
||||||
|
SERVICE_FQDN="${STACK_NAME}_${SERVICE_NAME}"
|
||||||
|
LOG_PREFIX="[swarm-deploy]"
|
||||||
|
|
||||||
|
log() {
|
||||||
|
printf '%s %s %s\n' "$(date --iso-8601=seconds)" "$LOG_PREFIX" "$*"
|
||||||
|
}
|
||||||
|
|
||||||
|
retry() {
|
||||||
|
local attempts=$1; shift
|
||||||
|
local delay=$1; shift
|
||||||
|
local n=1
|
||||||
|
while true; do
|
||||||
|
if "$@"; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
if (( n == attempts )); then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
((n++))
|
||||||
|
sleep "$delay"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
log "Deploying stack '${STACK_NAME}' using ${STACK_FILE}"
|
||||||
|
docker stack deploy --compose-file "$STACK_FILE" "$STACK_NAME"
|
||||||
|
|
||||||
|
log "Waiting for service ${SERVICE_FQDN} to reach ${EXPECTED_REPLICAS} replicas"
|
||||||
|
retries=24
|
||||||
|
while (( retries > 0 )); do
|
||||||
|
replicas_raw=$(docker service ls --filter "name=${SERVICE_FQDN}" --format '{{.Replicas}}' || true)
|
||||||
|
if [[ -z "$replicas_raw" ]]; then
|
||||||
|
log "Service ${SERVICE_FQDN} not found yet; retrying"
|
||||||
|
sleep 5
|
||||||
|
((retries--))
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
replicas_clean=${replicas_raw%% (*}
|
||||||
|
running=${replicas_clean%%/*}
|
||||||
|
desired=${replicas_clean##*/}
|
||||||
|
if [[ "$running" == "$desired" && "$running" == "$EXPECTED_REPLICAS" ]]; then
|
||||||
|
log "Service reached desired replica count: ${running}/${desired}"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
log "Current replicas ${running}/${desired}; waiting..."
|
||||||
|
sleep 5
|
||||||
|
((retries--))
|
||||||
|
done
|
||||||
|
|
||||||
|
if (( retries == 0 )); then
|
||||||
|
log "Timed out waiting for replicas"
|
||||||
|
docker service ps "$SERVICE_FQDN"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Checking task states"
|
||||||
|
if ! docker service ps "$SERVICE_FQDN" --no-trunc --filter 'desired-state=Running' --format '{{.CurrentState}}' | grep -q '^Running '; then
|
||||||
|
log "Some tasks are not running"
|
||||||
|
docker service ps "$SERVICE_FQDN"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Running health check against ${HEALTH_URL}"
|
||||||
|
if ! retry 3 5 curl -fsS "$HEALTH_URL"; then
|
||||||
|
log "Health check failed; rolling back service"
|
||||||
|
docker service update --rollback "$SERVICE_FQDN" || true
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
log "Health check succeeded"
|
||||||
|
log "Deployment finished successfully"
|
||||||
@ -399,6 +399,12 @@ authBuilder.AddGoogle(options =>
|
|||||||
redirectUri += "&prompt=login";
|
redirectUri += "&prompt=login";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!redirectUri.Contains("options="))
|
||||||
|
{
|
||||||
|
redirectUri += "&options=disable_passkey";
|
||||||
|
logger.LogWarning($"ADDED options=disable_passkey - Modified RedirectUri: {redirectUri}");
|
||||||
|
}
|
||||||
|
|
||||||
logger.LogWarning($"Final RedirectUri: {redirectUri}");
|
logger.LogWarning($"Final RedirectUri: {redirectUri}");
|
||||||
context.Response.Redirect(redirectUri);
|
context.Response.Redirect(redirectUri);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user