diff --git a/deployment/k8s/flights-ui.yaml b/deployment/k8s/flights-ui.yaml new file mode 100644 index 00000000..e31c21aa --- /dev/null +++ b/deployment/k8s/flights-ui.yaml @@ -0,0 +1,40 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: $AFL_PRJ_NAME +spec: + selector: + matchLabels: + name: $AFL_PRJ_NAME + template: + metadata: + labels: + name: $AFL_PRJ_NAME + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: $AFL_PRJ_NAME + image: $REGISTRY_SERVER/aeroflot.$K8NAMESPACE.$ENVIRONMENT/$AFL_PRJ_NAME:v$VERSION.$BUILD_NUMBER + ports: + - containerPort: 8080 + resources: + limits: + memory: "256Mi" + cpu: "1000m" + requests: + memory: "64Mi" + cpu: "100m" + env: + - name: NODE_ENV + value: production + - name: ENVIRONMENT + value: $ENVIRONMENT + # flights-ui.devwebzavod.ru has no /map/api/** ingress rule, so + # point Leaflet at the upstream tile service that the real + # Aeroflot ingress serves (flights.test.aeroflot.ru terminates + # /map/api/** correctly). Override per-cluster if a different + # tile source is required. + - name: MAP_TILE_URL + value: https://flights.test.aeroflot.ru/map/api/tile/{z}/{x}/{y}.jpeg +$IMAGE_PULL_SECRETS diff --git a/scripts/sync-to-flights-front.sh b/scripts/sync-to-flights-front.sh index 9781486f..dad4fb52 100755 --- a/scripts/sync-to-flights-front.sh +++ b/scripts/sync-to-flights-front.sh @@ -7,9 +7,18 @@ set -euo pipefail # ./scripts/sync-to-flights-front.sh [target-dir] # # Default target: /Users/gnezim/_projects/tims/flights-front/Aeroflot.Flights.Front +# +# The deploy repo has the shape: +# flights-front/ +# Aeroflot.Flights.Front/ ← app source (target of this sync) +# deployment/ ← k8s manifests, ci scripts, etc. +# Anything under this repo's top-level deployment/ is copied to the +# sibling deployment/ in the deploy repo so cluster config lives with +# the source that consumes its env vars. SRC_DIR="$(cd "$(dirname "$0")/.." && pwd)" TARGET_DIR="${1:-/Users/gnezim/_projects/tims/flights-front/Aeroflot.Flights.Front}" +DEPLOY_ROOT="$(cd "$TARGET_DIR/.." && pwd)" if [ ! -d "$TARGET_DIR" ]; then echo "Error: target directory does not exist: $TARGET_DIR" @@ -17,11 +26,12 @@ if [ ! -d "$TARGET_DIR" ]; then fi echo "Syncing: $SRC_DIR → $TARGET_DIR" +echo " $SRC_DIR/deployment → $DEPLOY_ROOT/deployment" echo "" # ── Step 1: Clean target (preserve node_modules, .git, .dockerignore) ──────── -echo "1/5 Cleaning target directory..." +echo "1/6 Cleaning target directory..." find "$TARGET_DIR" -mindepth 1 -maxdepth 1 \ ! -name "node_modules" \ ! -name ".dockerignore" \ @@ -29,7 +39,7 @@ find "$TARGET_DIR" -mindepth 1 -maxdepth 1 \ # ── Step 2: Copy source files ──────────────────────────────────────────────── -echo "2/5 Copying source files..." +echo "2/6 Copying source files..." # App source & config cp -r "$SRC_DIR/src" "$TARGET_DIR/src" @@ -54,9 +64,23 @@ cp "$SRC_DIR/AGENTS.md" "$TARGET_DIR/AGENTS.md" # Dockerfile — use the SSR-specific one cp "$SRC_DIR/Dockerfile.react" "$TARGET_DIR/Dockerfile" -# ── Step 3: Clean up artifacts that shouldn't be in the target ──────────────── +# ── Step 3: Copy deployment configs to the sibling deployment/ dir ────────── -echo "3/5 Cleaning up artifacts..." +echo "3/6 Copying deployment configs..." + +if [ -d "$SRC_DIR/deployment" ]; then + mkdir -p "$DEPLOY_ROOT/deployment" + # Mirror deployment/ without nuking unrelated files under the deploy + # repo's deployment dir — copy contents, don't wipe the target. + cp -R "$SRC_DIR/deployment/." "$DEPLOY_ROOT/deployment/" + echo " copied $(find "$SRC_DIR/deployment" -type f | wc -l | tr -d ' ') file(s) into $DEPLOY_ROOT/deployment" +else + echo " (no deployment/ dir in source repo — skipping)" +fi + +# ── Step 4: Clean up artifacts that shouldn't be in the target ──────────────── + +echo "4/6 Cleaning up artifacts..." # Remove debug screenshots find "$TARGET_DIR" -maxdepth 1 -name "*.png" -delete 2>/dev/null || true @@ -81,9 +105,9 @@ rm -f "$TARGET_DIR/playwright-angular.config.ts" 2>/dev/null || true rm -rf "$TARGET_DIR/tests/e2e-angular" 2>/dev/null || true rm -rf "$TARGET_DIR/tests/parity" 2>/dev/null || true -# ── Step 4: Ensure .dockerignore exists ────────────────────────────────────── +# ── Step 5: Ensure .dockerignore exists ────────────────────────────────────── -echo "4/5 Ensuring .dockerignore..." +echo "5/6 Ensuring .dockerignore..." if [ ! -f "$TARGET_DIR/.dockerignore" ]; then cat > "$TARGET_DIR/.dockerignore" << 'DOCKERIGNORE' @@ -101,15 +125,20 @@ playwright-report DOCKERIGNORE fi -# ── Step 5: Summary ───────────────────────────────────────────────────────── +# ── Step 6: Summary ───────────────────────────────────────────────────────── -echo "5/5 Done!" +echo "6/6 Done!" echo "" -echo "Synced files:" +echo "Synced app files:" ls -1 "$TARGET_DIR" | grep -v node_modules +if [ -d "$DEPLOY_ROOT/deployment" ]; then + echo "" + echo "Synced deployment files:" + (cd "$DEPLOY_ROOT" && find deployment -type f | sort) +fi echo "" echo "Next steps:" echo " cd $TARGET_DIR" echo " pnpm install # if lock file changed" echo " make check # typecheck + lint + test" -echo " git diff # review changes" +echo " cd $DEPLOY_ROOT && git diff # review changes"