Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cf29d44ff8 | ||
|
|
c97498a2ae | ||
|
|
69bdaf0113 | ||
|
|
8eee3242bf | ||
|
|
4405097f56 |
No files matched your search
@@ -27,6 +27,13 @@ jobs:
|
|||||||
git -C "$TARGET" init
|
git -C "$TARGET" init
|
||||||
git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git"
|
git -C "$TARGET" remote add origin "http://127.0.0.1:8301/$REPO_NAME.git"
|
||||||
fi
|
fi
|
||||||
|
# Clear stale locks from interrupted shallow fetches (common after crash/timeout).
|
||||||
|
# This checkout is deploy-only; concurrency group already serializes jobs.
|
||||||
|
rm -f \
|
||||||
|
"$TARGET/.git/shallow.lock" \
|
||||||
|
"$TARGET/.git/index.lock" \
|
||||||
|
"$TARGET/.git/HEAD.lock" \
|
||||||
|
"$TARGET/.git/config.lock"
|
||||||
# Supply the job token only for fetch; never store it in .git/config.
|
# Supply the job token only for fetch; never store it in .git/config.
|
||||||
AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0)
|
AUTH=$(printf '%s:%s' "$REPO_ACTOR" "$REPO_TOKEN" | base64 -w0)
|
||||||
git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"
|
git -C "$TARGET" -c "http.extraHeader=Authorization: Basic $AUTH" fetch --depth=1 origin "$DEPLOY_SHA"
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
# syntax=docker/dockerfile:1
|
||||||
# ---- Dependencies ----
|
# ---- Dependencies ----
|
||||||
FROM node:22-alpine AS deps
|
FROM node:22-alpine AS deps
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json package-lock.json ./
|
COPY package.json package-lock.json ./
|
||||||
RUN npm ci
|
# Skip audit/fund in image builds (saves ~30–60s); keep npm cache across deploys.
|
||||||
|
RUN --mount=type=cache,target=/root/.npm \
|
||||||
|
npm ci --no-audit --no-fund
|
||||||
|
|
||||||
# ---- Builder ----
|
# ---- Builder ----
|
||||||
FROM node:22-alpine AS builder
|
FROM node:22-alpine AS builder
|
||||||
|
|||||||
@@ -74,16 +74,16 @@ async function main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const tables = await client.query(`
|
const tables = await client.query(`
|
||||||
SELECT table_name
|
SELECT count(*)::int AS n
|
||||||
FROM information_schema.tables
|
FROM information_schema.tables
|
||||||
WHERE table_schema = 'public' AND table_type = 'BASE TABLE'
|
WHERE table_schema = 'public' AND table_type = 'BASE TABLE'
|
||||||
ORDER BY table_name
|
|
||||||
`);
|
`);
|
||||||
|
|
||||||
console.log(`applied_count: ${appliedCount}`);
|
console.log(`applied_count: ${appliedCount}`);
|
||||||
console.log(`skipped (already applied): ${skipped.length ? skipped.join(", ") : "none"}`);
|
if (skipped.length) {
|
||||||
console.log(`tables_count: ${tables.rows.length}`);
|
console.log(`skipped_count: ${skipped.length}`);
|
||||||
console.log(JSON.stringify(tables.rows.map((r) => r.table_name)));
|
}
|
||||||
|
console.log(`tables_count: ${tables.rows[0].n}`);
|
||||||
} finally {
|
} finally {
|
||||||
await client.end().catch(() => {});
|
await client.end().catch(() => {});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,3 +39,16 @@
|
|||||||
- [x] 19. سرچ آیکونی؛ با انیمیشن جایگزین دسته/تگ (هدر بدون دسته)
|
- [x] 19. سرچ آیکونی؛ با انیمیشن جایگزین دسته/تگ (هدر بدون دسته)
|
||||||
- [x] 20. کل کارت دوره قابل کلیک
|
- [x] 20. کل کارت دوره قابل کلیک
|
||||||
- [x] 21. لیبل دسته/تگ روی کارت و جزئیات دوره کلیکپذیر (فیلتر)
|
- [x] 21. لیبل دسته/تگ روی کارت و جزئیات دوره کلیکپذیر (فیلتر)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## قفلکنندهٔ نسخههای بعدی (الان نکن)
|
||||||
|
|
||||||
|
منبع: لاگ دیپلوی پروداکشن `69bdaf0` (2026-10-16). وضعیت فعلی دیپلوی سالم است؛ اینها بدهی/بهروزرسانی اختیاریاند و نباید وسط فیچر جاری باز شوند.
|
||||||
|
|
||||||
|
- [ ] **V-LOCK npm audit** — در `npm ci` داخل Docker: ۱۲ vulnerability (۱۱ high + ۱ critical). در نسخهٔ بعدی: `npm audit` / `npm audit fix` (بدون `--force` مگر بعد از تست)، سپس بیلد+دیپلوی استیجینگ.
|
||||||
|
- [ ] **V-LOCK ESLint EOL** — هشدار `eslint@9.39.5` deprecated / version-support. در نسخهٔ بعدی: ارتقا به خط پشتیبانیشدهٔ ESLint و همتراز کردن config/پلاگینها.
|
||||||
|
- [ ] **V-LOCK npm toolchain** — notice: npm داخل ایمیج `10.9.9` → پیشنهاد `12.x`. در نسخهٔ بعدی: تصمیم pinned (packageManager / image tag) و تست `npm ci` روی همان نسخه.
|
||||||
|
- [ ] **V-LOCK deploy checkout noise** — git detach روی `/opt/prod/...` هشدار «leaving 1 commit behind» میدهد (طبیعی برای shallow+detach). در نسخهٔ بعدی: در ورکفلو `fetch --prune` / پاکسازی refهای یتیم یا ساکتکردن هشدار غیرضروری تا لاگ تمیزتر شود.
|
||||||
|
- [ ] **V-LOCK Docker build context size** — transfer context حدود ۵۵MB در بیلد. در نسخهٔ بعدی: بازبینی `.dockerignore` و داراییهای سنگین `public/` تا کش deps کمتر invalidate شود و بیلد سبکتر شود.
|
||||||
|
- [ ] **V-LOCK Docker build wall-time** — بیلد پروداکشن ~۱۵–۲۰ دقیقه (npm ci + copy node_modules + Next webpack/TS با ۱ worker). در نسخهٔ بعدی: کش لایه/registry، کاهش دارایی در context، و در صورت امکان افزایش CPU برای workerهای Next.
|
||||||
@@ -46,3 +46,5 @@ docker logs --tail 100 aut-management-faculty
|
|||||||
curl --resolve edu.mstaut.ir:443:127.0.0.1 https://edu.mstaut.ir/
|
curl --resolve edu.mstaut.ir:443:127.0.0.1 https://edu.mstaut.ir/
|
||||||
certbot renew --cert-name edu.mstaut.ir --dry-run
|
certbot renew --cert-name edu.mstaut.ir --dry-run
|
||||||
```
|
```
|
||||||
|
|
||||||
|
<!-- workflow probe: no runtime impact -->
|
||||||
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 1.8 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.9 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 2.2 MiB |
|
After Width: | Height: | Size: 2.6 MiB |
|
After Width: | Height: | Size: 2.3 MiB |
|
After Width: | Height: | Size: 2.0 MiB |
|
After Width: | Height: | Size: 1.5 MiB |
|
After Width: | Height: | Size: 2.7 MiB |
|
After Width: | Height: | Size: 2.5 MiB |
@@ -18,7 +18,9 @@ docker inspect insaight-postgres --format '{{json .NetworkSettings.Networks}}' |
|
|||||||
docker volume create "$UPLOAD_VOLUME" >/dev/null
|
docker volume create "$UPLOAD_VOLUME" >/dev/null
|
||||||
|
|
||||||
# Keep the current app running throughout the build.
|
# Keep the current app running throughout the build.
|
||||||
docker build --build-arg NEXT_PUBLIC_SITE_URL=https://edu.mstaut.ir -t "$IMAGE" .
|
DOCKER_BUILDKIT=1 docker build \
|
||||||
|
--build-arg NEXT_PUBLIC_SITE_URL=https://edu.mstaut.ir \
|
||||||
|
-t "$IMAGE" .
|
||||||
|
|
||||||
# Back up before applying the repository's transactional, versioned migrations.
|
# Back up before applying the repository's transactional, versioned migrations.
|
||||||
# Migrations are forward-only and idempotent (schema_migrations); dump is the safety net.
|
# Migrations are forward-only and idempotent (schema_migrations); dump is the safety net.
|
||||||
@@ -30,7 +32,7 @@ test -s "$BACKUP"
|
|||||||
docker run --rm --network "$NETWORK" --env-file "$ENV_FILE" \
|
docker run --rm --network "$NETWORK" --env-file "$ENV_FILE" \
|
||||||
-v "$PWD/db:/app/db:ro" --entrypoint node "$IMAGE" db/migrate.mjs
|
-v "$PWD/db:/app/db:ro" --entrypoint node "$IMAGE" db/migrate.mjs
|
||||||
|
|
||||||
# Check the database and rendered pages before switching the public upstream.
|
# Check the database and a minimal page set before switching the public upstream.
|
||||||
CANDIDATE="edu-candidate-${REVISION:0:12}"
|
CANDIDATE="edu-candidate-${REVISION:0:12}"
|
||||||
docker run -d --name "$CANDIDATE" --network "$NETWORK" --env-file "$ENV_FILE" \
|
docker run -d --name "$CANDIDATE" --network "$NETWORK" --env-file "$ENV_FILE" \
|
||||||
-e UPLOAD_DIR=/app/public/uploads \
|
-e UPLOAD_DIR=/app/public/uploads \
|
||||||
@@ -39,24 +41,34 @@ docker run -d --name "$CANDIDATE" --network "$NETWORK" --env-file "$ENV_FILE" \
|
|||||||
cleanup_candidate() { docker rm -f "$CANDIDATE" >/dev/null 2>&1 || true; }
|
cleanup_candidate() { docker rm -f "$CANDIDATE" >/dev/null 2>&1 || true; }
|
||||||
trap cleanup_candidate EXIT
|
trap cleanup_candidate EXIT
|
||||||
READY=false
|
READY=false
|
||||||
for attempt in $(seq 1 60); do
|
for attempt in $(seq 1 24); do
|
||||||
if docker exec "$CANDIDATE" node -e '
|
if docker exec "$CANDIDATE" node -e '
|
||||||
(async () => {
|
(async () => {
|
||||||
const { Pool } = require("pg");
|
const { Pool } = require("pg");
|
||||||
const pool = new Pool({connectionString: process.env.DATABASE_URL, connectionTimeoutMillis: 5000});
|
const pool = new Pool({
|
||||||
await pool.query("SELECT 1"); await pool.end();
|
connectionString: process.env.DATABASE_URL,
|
||||||
for (const route of ["/", "/programs", "/professional", "/admin/login"]) {
|
connectionTimeoutMillis: 3000,
|
||||||
|
});
|
||||||
|
await pool.query("SELECT 1");
|
||||||
|
await pool.end();
|
||||||
|
|
||||||
|
// Minimal smoke: home + admin login (path moved from /admin).
|
||||||
|
for (const route of ["/", "/mstcontroller/login"]) {
|
||||||
const response = await fetch("http://127.0.0.1:3000" + route);
|
const response = await fetch("http://127.0.0.1:3000" + route);
|
||||||
if (!response.ok) throw new Error(route + ": " + response.status);
|
if (!response.ok) throw new Error(route + ": " + response.status);
|
||||||
}
|
}
|
||||||
for (const resource of ["courses", "programs", "events", "articles"]) {
|
|
||||||
const response = await fetch("http://127.0.0.1:3000/api/" + resource);
|
const api = await fetch("http://127.0.0.1:3000/api/courses");
|
||||||
const body = await response.json();
|
const body = await api.json();
|
||||||
if (!response.ok || !Array.isArray(body.data)) throw new Error("API check failed: " + resource);
|
if (!api.ok || !Array.isArray(body.data)) {
|
||||||
|
throw new Error("API check failed: courses");
|
||||||
}
|
}
|
||||||
})().catch(error => { console.error(error.message); process.exit(1); });
|
})().catch((error) => {
|
||||||
|
console.error(error.message || error);
|
||||||
|
process.exit(1);
|
||||||
|
});
|
||||||
'; then READY=true; break; fi
|
'; then READY=true; break; fi
|
||||||
sleep 2
|
sleep 1
|
||||||
done
|
done
|
||||||
if [ "$READY" != true ]; then docker logs --tail 50 "$CANDIDATE"; exit 1; fi
|
if [ "$READY" != true ]; then docker logs --tail 50 "$CANDIDATE"; exit 1; fi
|
||||||
cleanup_candidate
|
cleanup_candidate
|
||||||
@@ -84,11 +96,11 @@ docker run -d --name "$CONTAINER" --restart unless-stopped \
|
|||||||
-v "$UPLOAD_VOLUME:/app/public/uploads" \
|
-v "$UPLOAD_VOLUME:/app/public/uploads" \
|
||||||
-p 127.0.0.1:3000:3000 "$IMAGE"
|
-p 127.0.0.1:3000:3000 "$IMAGE"
|
||||||
READY=false
|
READY=false
|
||||||
for attempt in $(seq 1 30); do
|
for attempt in $(seq 1 20); do
|
||||||
if curl -fsS --max-time 5 --resolve edu.mstaut.ir:443:127.0.0.1 https://edu.mstaut.ir/ >/dev/null; then
|
if curl -fsS --max-time 5 --resolve edu.mstaut.ir:443:127.0.0.1 https://edu.mstaut.ir/ >/dev/null; then
|
||||||
READY=true; break
|
READY=true; break
|
||||||
fi
|
fi
|
||||||
sleep 2
|
sleep 1
|
||||||
done
|
done
|
||||||
test "$READY" = true
|
test "$READY" = true
|
||||||
trap - ERR
|
trap - ERR
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import { cn } from "@/lib/utils";
|
|||||||
|
|
||||||
/** Faculty seal mark (transparent). Source: MST icon with side text removed. */
|
/** Faculty seal mark (transparent). Source: MST icon with side text removed. */
|
||||||
const MARK_SRC = "/brand/mst-faculty.png";
|
const MARK_SRC = "/brand/mst-faculty.png";
|
||||||
/** Horizontal wordmark with faculty + university name baked in. */
|
|
||||||
const HORIZONTAL_SRC = "/MstAutIcon_horizontal.png";
|
|
||||||
|
|
||||||
type BrandLogoProps = {
|
type BrandLogoProps = {
|
||||||
href?: string;
|
href?: string;
|
||||||
@@ -14,14 +12,9 @@ type BrandLogoProps = {
|
|||||||
onDark?: boolean;
|
onDark?: boolean;
|
||||||
className?: string;
|
className?: string;
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
/**
|
|
||||||
* Header wordmark: uses the horizontal logo (text is in the image).
|
|
||||||
* Title/subtitle are not rendered — only used for aria-label.
|
|
||||||
*/
|
|
||||||
horizontal?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** AUT brand mark / horizontal wordmark. */
|
/** AUT seal — mark + title/subtitle text (agreed header size). */
|
||||||
export function BrandLogo({
|
export function BrandLogo({
|
||||||
href = "/",
|
href = "/",
|
||||||
title,
|
title,
|
||||||
@@ -29,40 +22,7 @@ export function BrandLogo({
|
|||||||
onDark = false,
|
onDark = false,
|
||||||
className,
|
className,
|
||||||
compact = false,
|
compact = false,
|
||||||
horizontal = false,
|
|
||||||
}: BrandLogoProps) {
|
}: BrandLogoProps) {
|
||||||
const ariaLabel = [title, subtitle].filter(Boolean).join(" — ");
|
|
||||||
|
|
||||||
if (horizontal) {
|
|
||||||
return (
|
|
||||||
<Link
|
|
||||||
href={href}
|
|
||||||
className={cn(
|
|
||||||
// Clip 2× logo inside the header slot so it never bleeds into page content.
|
|
||||||
"group inline-flex min-w-0 items-center overflow-hidden",
|
|
||||||
compact ? "h-16" : "h-full",
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
aria-label={ariaLabel}
|
|
||||||
>
|
|
||||||
<Image
|
|
||||||
src={HORIZONTAL_SRC}
|
|
||||||
alt={ariaLabel}
|
|
||||||
width={1888}
|
|
||||||
height={607}
|
|
||||||
priority
|
|
||||||
sizes="(max-width:640px) 28rem, 36rem"
|
|
||||||
className={cn(
|
|
||||||
// ~2.35× slot height; overflow clipped by the link (and header).
|
|
||||||
"h-[235%] w-auto max-w-none object-contain object-right",
|
|
||||||
// Asset is white-on-black; blend so the plate disappears into the header.
|
|
||||||
onDark ? "mix-blend-screen" : "invert mix-blend-multiply",
|
|
||||||
)}
|
|
||||||
/>
|
|
||||||
</Link>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Link
|
<Link
|
||||||
href={href}
|
href={href}
|
||||||
@@ -70,7 +30,7 @@ export function BrandLogo({
|
|||||||
"group flex min-w-0 items-center gap-2.5 sm:gap-3",
|
"group flex min-w-0 items-center gap-2.5 sm:gap-3",
|
||||||
className,
|
className,
|
||||||
)}
|
)}
|
||||||
aria-label={ariaLabel}
|
aria-label={[title, subtitle].filter(Boolean).join(" — ")}
|
||||||
>
|
>
|
||||||
<span
|
<span
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|||||||
@@ -126,8 +126,7 @@ export function SiteHeader({
|
|||||||
title={brandTitle}
|
title={brandTitle}
|
||||||
subtitle={brandSubtitle}
|
subtitle={brandSubtitle}
|
||||||
onDark={isDark}
|
onDark={isDark}
|
||||||
horizontal
|
className="shrink-0"
|
||||||
className="h-full shrink-0"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<nav
|
<nav
|
||||||
@@ -214,7 +213,6 @@ export function SiteHeader({
|
|||||||
title={brandTitle}
|
title={brandTitle}
|
||||||
subtitle={brandSubtitle}
|
subtitle={brandSubtitle}
|
||||||
onDark
|
onDark
|
||||||
horizontal
|
|
||||||
compact
|
compact
|
||||||
className="shrink-0"
|
className="shrink-0"
|
||||||
/>
|
/>
|
||||||
|
|||||||