Files
2026-11-10 18:41:53 +03:30

1063 lines
45 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html>
<html lang="fa" dir="rtl">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>راهنمای جامع اجرای برنامه HTML/CSS/JavaScript در Azure | رایان پرداز کاوش Azure</title>
<style>
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
:root {
--primary: #1a365d;
--primary-light: #2c5282;
--accent: #c9a961;
--accent-dark: #a8893f;
--bg: #faf9f6;
--card-bg: #ffffff;
--text: #1a202c;
--text-muted: #4a5568;
--border: #e2e8f0;
--success: #38a169;
--danger: #e53e3e;
--warning: #dd6b20;
--shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(26,54,93,0.08);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
font-family: 'Vazirmatn', Tahoma, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.9;
font-size: 15px;
padding: 30px 15px;
}
.document-container {
max-width: 950px;
margin: 0 auto;
background: var(--card-bg);
box-shadow: var(--shadow);
border-radius: 12px;
overflow: hidden;
}
.document-header {
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
color: white;
padding: 50px 40px 40px;
position: relative;
border-bottom: 4px solid var(--accent);
}
.document-header::before {
content: '';
position: absolute;
top: 0; right: 0;
width: 200px; height: 200px;
background: radial-gradient(circle, rgba(201,169,97,0.15) 0%, transparent 70%);
border-radius: 50%;
transform: translate(50%, -50%);
}
.header-top {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
position: relative;
z-index: 1;
}
.company-badge {
display: flex;
align-items: center;
gap: 12px;
}
.company-logo {
width: 60px; height: 60px;
background: var(--accent);
border-radius: 12px;
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.doc-meta {
text-align: left;
font-size: 12px;
opacity: 0.9;
}
.doc-meta div { margin-bottom: 3px; }
.document-title {
text-align: center;
position: relative;
z-index: 1;
padding: 20px 0;
}
.document-title .label {
display: inline-block;
background: rgba(201,169,97,0.2);
color: var(--accent);
padding: 4px 16px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
margin-bottom: 15px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-title h1 {
font-size: 28px;
font-weight: 800;
margin-bottom: 10px;
letter-spacing: -0.5px;
}
.document-title h2 {
font-size: 16px;
font-weight: 400;
opacity: 0.9;
}
.document-body {
padding: 40px;
}
.intro-text {
background: linear-gradient(to left, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin-bottom: 35px;
font-size: 14px;
color: var(--text-muted);
}
.section {
margin-bottom: 40px;
page-break-inside: avoid;
}
.section-header {
display: flex;
align-items: center;
gap: 15px;
padding-bottom: 12px;
border-bottom: 2px solid var(--border);
margin-bottom: 20px;
}
.section-number {
width: 50px; height: 50px;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 800;
font-size: 20px;
flex-shrink: 0;
box-shadow: 0 4px 10px rgba(26,54,93,0.2);
}
.section-title { flex: 1; }
.section-title h3 {
font-size: 19px;
font-weight: 700;
color: var(--primary);
margin-bottom: 2px;
}
.section-title .subtitle {
font-size: 12px;
color: var(--text-muted);
}
.section-content {
padding-right: 10px;
}
.section-content p {
margin-bottom: 12px;
text-align: justify;
text-indent: 20px;
}
.section-content p.no-indent { text-indent: 0; }
.highlight-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #f6e05e;
border-right: 4px solid var(--accent);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.highlight-box strong {
color: var(--accent-dark);
}
.info-box {
background: linear-gradient(to left, #ebf8ff, #e6f6ff);
border: 1px solid #90cdf4;
border-right: 4px solid var(--primary-light);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.success-box {
background: linear-gradient(to left, #f0fff4, #e6fffa);
border: 1px solid #9ae6b4;
border-right: 4px solid var(--success);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.warning-box {
background: linear-gradient(to left, #fffaf0, #fef5e7);
border: 1px solid #fbd38d;
border-right: 4px solid var(--warning);
padding: 18px 22px;
border-radius: 8px;
margin: 20px 0;
font-size: 14px;
}
.styled-table {
width: 100%;
border-collapse: collapse;
margin: 20px 0;
background: white;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.styled-table thead {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
}
.styled-table th {
padding: 14px 16px;
text-align: right;
font-weight: 600;
font-size: 13px;
}
.styled-table td {
padding: 13px 16px;
border-bottom: 1px solid var(--border);
font-size: 13px;
}
.styled-table tbody tr:last-child td { border-bottom: none; }
.styled-table tbody tr:nth-child(even) { background: #f8fafc; }
.styled-table .highlight-row {
background: #fffaf0 !important;
font-weight: 600;
}
.comparison-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 20px;
margin: 25px 0;
}
.comparison-card {
background: #f8fafc;
border: 2px solid var(--border);
border-radius: 10px;
padding: 20px;
position: relative;
}
.comparison-card.recommended {
border-color: var(--success);
background: linear-gradient(to left, #f0fff4, #e6fffa);
}
.comparison-card .card-badge {
position: absolute;
top: -10px;
right: 20px;
background: var(--success);
color: white;
padding: 3px 12px;
border-radius: 15px;
font-size: 11px;
font-weight: 600;
}
.comparison-card h4 {
font-size: 16px;
font-weight: 700;
color: var(--primary);
margin-bottom: 15px;
padding-bottom: 10px;
border-bottom: 2px solid var(--border);
}
.comparison-card.recommended h4 {
border-bottom-color: var(--success);
}
.comparison-card ul {
list-style: none;
padding: 0;
}
.comparison-card ul li {
padding: 8px 0;
border-bottom: 1px solid var(--border);
font-size: 13px;
display: flex;
justify-content: space-between;
}
.comparison-card ul li:last-child { border-bottom: none; }
.comparison-card ul li .value {
font-weight: 600;
color: var(--primary);
}
.quote-box {
background: linear-gradient(135deg, #f7fafc, #edf2f7);
border-right: 4px solid var(--accent);
padding: 20px 25px;
border-radius: 8px;
margin: 20px 0;
position: relative;
}
.quote-box::before {
content: '"';
position: absolute;
top: -10px;
right: 15px;
font-size: 60px;
color: var(--accent);
opacity: 0.3;
font-family: Georgia, serif;
}
.quote-box p {
font-style: italic;
color: var(--text-muted);
margin-bottom: 10px;
text-indent: 0 !important;
}
.quote-box .source {
font-size: 12px;
color: var(--text-muted);
text-align: left;
font-style: normal;
}
.stats-grid {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 15px;
margin: 25px 0;
}
.stat-card {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 20px;
border-radius: 10px;
text-align: center;
box-shadow: 0 4px 12px rgba(26,54,93,0.2);
}
.stat-card .stat-value {
font-size: 24px;
font-weight: 800;
margin-bottom: 5px;
color: var(--accent);
line-height: 1.3;
}
.stat-card .stat-label {
font-size: 12px;
opacity: 0.9;
}
.timeline {
position: relative;
padding: 20px 0;
margin: 25px 0;
}
.timeline::before {
content: '';
position: absolute;
right: 50%;
top: 0;
bottom: 0;
width: 3px;
background: var(--border);
transform: translateX(50%);
}
.timeline-item {
display: flex;
margin-bottom: 20px;
position: relative;
}
.timeline-item:nth-child(odd) {
flex-direction: row-reverse;
}
.timeline-content {
width: 45%;
background: #f8fafc;
border: 1px solid var(--border);
border-radius: 8px;
padding: 15px;
position: relative;
}
.timeline-item:nth-child(odd) .timeline-content {
margin-left: 5%;
}
.timeline-item:nth-child(even) .timeline-content {
margin-right: 5%;
}
.timeline-dot {
position: absolute;
right: 50%;
top: 20px;
width: 16px;
height: 16px;
background: var(--accent);
border: 3px solid white;
border-radius: 50%;
transform: translateX(50%);
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
z-index: 1;
}
.timeline-content h5 {
font-size: 14px;
font-weight: 700;
color: var(--primary);
margin-bottom: 8px;
}
.timeline-content p {
font-size: 12px;
color: var(--text-muted);
text-indent: 0 !important;
margin-bottom: 0 !important;
}
.reference-list {
list-style: none;
padding: 0;
margin: 20px 0;
}
.reference-list li {
background: #f8fafc;
border-right: 3px solid var(--primary-light);
padding: 15px 20px;
margin-bottom: 10px;
border-radius: 6px;
font-size: 13px;
}
.reference-list li strong {
color: var(--primary);
display: block;
margin-bottom: 5px;
}
.reference-list li .ref-source {
font-size: 11px;
color: var(--text-muted);
margin-top: 5px;
}
.conclusion-box {
background: linear-gradient(135deg, var(--primary), var(--primary-light));
color: white;
padding: 30px;
border-radius: 12px;
margin: 30px 0;
text-align: center;
box-shadow: 0 8px 20px rgba(26,54,93,0.3);
}
.conclusion-box h3 {
font-size: 22px;
font-weight: 800;
margin-bottom: 15px;
color: var(--accent);
}
.conclusion-box p {
font-size: 14px;
line-height: 1.8;
text-indent: 0 !important;
margin-bottom: 15px;
}
.conclusion-box .highlight {
background: rgba(201,169,97,0.2);
padding: 15px 20px;
border-radius: 8px;
margin-top: 20px;
border: 1px solid rgba(201,169,97,0.4);
}
.document-footer {
background: var(--primary);
color: white;
padding: 25px 40px;
text-align: center;
font-size: 12px;
margin-top: 40px;
}
.document-footer .footer-brand {
font-weight: 700;
color: var(--accent);
margin-bottom: 5px;
font-size: 14px;
}
.footer-divider {
width: 60px;
height: 2px;
background: var(--accent);
margin: 10px auto;
}
.page-info {
text-align: center;
padding: 15px;
font-size: 11px;
color: var(--text-muted);
border-top: 1px solid var(--border);
margin-top: 30px;
}
@media print {
body { background: white; padding: 0; }
.document-container { box-shadow: none; border-radius: 0; }
.section { page-break-inside: avoid; }
}
@media (max-width: 768px) {
.document-body { padding: 25px 20px; }
.document-header { padding: 30px 20px; }
.comparison-grid { grid-template-columns: 1fr; }
.stats-grid { grid-template-columns: 1fr; }
.header-top { flex-direction: column; gap: 15px; }
.doc-meta { text-align: center; }
}
</style>
</head>
<body>
<div class="document-container">
<header class="document-header">
<div class="header-top">
<div class="company-badge">
<div class="company-logo"></div>
</div>
<div class="doc-meta">
<div>شماره مستند: AZ-WEB-1405-002</div>
<div>نسخه: ۱.۰</div>
<div>تاریخ تهیه: آبان ۱۴۰۵</div>
<div>طبقه‌بندی: محرمانه</div>
</div>
</div>
<div class="document-title">
<span class="label">TECHNICAL GUIDE & STEP-BY-STEP</span>
<h1>راهنمای جامع اجرای برنامه HTML/CSS/JavaScript در Azure</h1>
<h2>از توسعه محلی تا استقرار در فضای ابری — گام‌به‌گام</h2>
</div>
</header>
<div class="document-body">
<div class="intro-text">
<strong>همکار محترم،</strong><br>
این مستند با هدف ارائه راهنمای عملی و گام‌به‌گام برای توسعه‌دهندگان شرکت <strong>رایان پرداز کاوش Azure</strong> تدوین شده است تا بتوانند برنامه‌های مبتنی بر HTML، CSS و JavaScript خود را در محیط Azure اجرا کنند. با توجه به اینکه سیستم مدیریت منابع و پروژه‌های شرکت بر بستر Azure است، تسلط بر روش‌های میزبانی برنامه‌های وب استاتیک و پویا، امکان ساخت داشبوردها، پورتال‌های داخلی و ابزارهای سفارشی را فراهم می‌آورد. این راهنما سه روش اصلی استقرار (Static Web Apps، App Service و Blob Storage) را به همراه روش افزودن API با Azure Functions به صورت کامل تشریح می‌کند.
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۱</div>
<div class="section-title">
<h3>خلاصه اجرایی</h3>
<div class="subtitle">Executive Summary</div>
</div>
</div>
<div class="section-content">
<p>Azure چندین سرویس مختلف برای میزبانی برنامه‌های وب ارائه می‌دهد که هر کدام برای سناریوهای خاصی بهینه شده‌اند. انتخاب سرویس مناسب، مستقیماً بر هزینه، عملکرد، امنیت و سهولت نگهداری تأثیر می‌گذارد. برای یک برنامه ساده HTML/CSS/JavaScript که نیازی به پردازش سمت سرور ندارد، <strong>Azure Static Web Apps</strong> معمولاً بهترین انتخاب است: کاملاً رایگان (در طرح Free)، دارای CDN جهانی، گواهی SSL خودکار و CI/CD یکپارچه با GitHub. اگر برنامه نیاز به منطق سمت سرور، WebSocket یا پردازش مداوم دارد، <strong>Azure App Service</strong> گزینه صحیح است. <strong>Azure Blob Storage</strong> نیز یک راه اقتصادی برای میزبانی محتوای استاتیک فراهم می‌کند، اما فاقد احراز هویت و پیکربندی هدر است.</p>
<div class="stats-grid">
<div class="stat-card">
<div class="stat-value">۳ روش</div>
<div class="stat-label">استقرار برنامه وب در Azure</div>
</div>
<div class="stat-card">
<div class="stat-value">رایگان</div>
<div class="stat-label">طرح Free در Static Web Apps</div>
</div>
<div class="stat-card">
<div class="stat-value">گام‌به‌گام</div>
<div class="stat-label">از کدنویسی تا آدرس نهایی</div>
</div>
</div>
<div class="highlight-box">
<strong>نتیجه کلیدی:</strong> برای اکثر برنامه‌های داخلی شرکت که صرفاً رابط کاربری هستند، <strong>Azure Static Web Apps</strong> سریع‌ترین، ارزان‌ترین و ساده‌ترین مسیر است. با افزودن <strong>Azure Functions</strong> می‌توانید بدون ترک پلتفرم، قابلیت‌های پویا نیز به همان برنامه اضافه کنید.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۲</div>
<div class="section-title">
<h3>مقایسه روش‌های میزبانی</h3>
<div class="subtitle">Hosting Options Comparison</div>
</div>
</div>
<div class="section-content">
<p>پیش از انتخاب روش استقرار، باید نیازمندی‌های برنامه را مشخص کنید: آیا فقط محتوای استاتیک دارید یا به API نیاز دارید؟ آیا احراز هویت می‌خواهید؟ آیا به هدرهای سفارشی نیاز دارید؟ جدول زیر تفاوت‌های کلیدی را نشان می‌دهد.</p>
<table class="styled-table">
<thead>
<tr>
<th>معیار</th>
<th>Static Web Apps</th>
<th>App Service</th>
<th>Blob Storage</th>
</tr>
</thead>
<tbody>
<tr>
<td>نوع محتوا</td>
<td>استاتیک + API سرورلس</td>
<td>استاتیک + کد سمت سرور</td>
<td>فقط استاتیک</td>
</tr>
<tr>
<td>هزینه (طرح پایه)</td>
<td style="color: var(--success); font-weight: 600;">رایگان</td>
<td>رایگان/پرداختی</td>
<td>فقط هزینه ذخیره‌سازی</td>
</tr>
<tr>
<td>CDN جهانی</td>
<td style="color: var(--success); font-weight: 600;">✅ داخلی</td>
<td>❌ نیاز به Front Door</td>
<td>❌ نیاز به CDN جداگانه</td>
</tr>
<tr>
<td>احراز هویت</td>
<td style="color: var(--success); font-weight: 600;">✅ داخلی</td>
<td>✅ قابل پیکربندی</td>
<td>❌ ندارد</td>
</tr>
<tr>
<td>هدرهای سفارشی</td>
<td style="color: var(--success); font-weight: 600;">✅ از طریق config</td>
<td>✅ از طریق web.config</td>
<td>❌ فقط با CDN</td>
</tr>
<tr>
<td>CI/CD یکپارچه</td>
<td style="color: var(--success); font-weight: 600;">✅ GitHub Actions خودکار</td>
<td>✅ قابل اتصال</td>
<td>❌ ندارد</td>
</tr>
<tr class="highlight-row">
<td><strong>مناسب برای</strong></td>
<td><strong>SPA، داشبورد، پورتال</strong></td>
<td><strong>API سنگین، WebSocket</strong></td>
<td><strong>سایت‌های بسیار ساده</strong></td>
</tr>
</tbody>
</table>
<div class="info-box">
<strong>💡 نکته:</strong> اگر برنامه شما فقط HTML/CSS/JS است و به API نیاز دارید، Static Web Apps با Azure Functions داخلی بهترین ترکیب را ارائه می‌دهد. اگر برنامه شما به پردازش طولانی، WebSocket یا سرور اختصاصی نیاز دارد، App Service انتخاب کنید[reference:0].
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۳</div>
<div class="section-title">
<h3>روش اول: Azure Static Web Apps (پیشنهادی)</h3>
<div class="subtitle">Static Web Apps — Step-by-Step</div>
</div>
</div>
<div class="section-content">
<p>Azure Static Web Apps یک سرویس مدیریت‌شده است که محتوای استاتیک را از CDN جهانی توزیع می‌کند و در صورت نیاز، APIهای سرورلس را از طریق Azure Functions یکپارچه می‌کند. این سرویس برای برنامه‌های ساخته‌شده با HTML، CSS، JavaScript و فریم‌ورک‌هایی مانند React، Vue و Angular ایده‌آل است[reference:1].</p>
<h4 style="margin-top: 20px; color: var(--primary); font-size: 16px;">پیش‌نیازها:</h4>
<ul style="padding-right: 20px; margin-top: 10px;">
<li style="margin-bottom: 6px;">حساب Azure با اشتراک فعال</li>
<li style="margin-bottom: 6px;">حساب GitHub (برای اتصال مخزن و CI/CD خودکار)</li>
<li style="margin-bottom: 6px;">Visual Studio Code (توصیه‌شده) یا هر ویرایشگر کد</li>
<li style="margin-bottom: 6px;">افزونه <strong>Azure Static Web Apps</strong> در VS Code (اختیاری)</li>
</ul>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۱: آماده‌سازی کد محلی</h4>
<p>یک پوشه برای پروژه ایجاد کنید و فایل <code style="direction: ltr; display: inline-block;">index.html</code> را به همراه فایل‌های CSS و JavaScript خود در آن قرار دهید. اگر از هیچ فریم‌ورکی استفاده نمی‌کنید، یک فایل HTML ساده کافی است. اطمینان حاصل کنید که برنامه به صورت محلی در مرورگر به درستی کار می‌کند.</p>
<div class="highlight-box" style="direction: ltr; text-align: left; font-family: monospace; font-size: 13px;">
my-static-app/<br>
├── index.html<br>
├── styles.css<br>
└── app.js
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۲: ایجاد مخزن GitHub</h4>
<p>یک مخزن جدید در GitHub ایجاد کنید (می‌تواند خصوصی یا عمومی باشد). کد پروژه را به این مخزن push کنید. Azure Static Web Apps به طور خودکار از این مخزن برای استقرار و به‌روزرسانی‌های بعدی استفاده می‌کند[reference:2].</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۳: ایجاد منبع Static Web App در پورتال Azure</h4>
<p>به <a href="https://portal.azure.com" style="color: var(--primary-light);">پورتال Azure</a> بروید، روی <strong>Create a Resource</strong> کلیک کنید و <strong>Static Web Apps</strong> را جستجو کنید. سپس <strong>Create</strong> را انتخاب کنید. در بخش Basics، تنظیمات زیر را وارد کنید:</p>
<table class="styled-table">
<thead>
<tr>
<th>تنظیم</th>
<th>مقدار پیشنهادی</th>
</tr>
</thead>
<tbody>
<tr>
<td>Subscription</td>
<td>اشتراک Azure خود را انتخاب کنید</td>
</tr>
<tr>
<td>Resource Group</td>
<td>یک گروه منابع جدید یا موجود انتخاب کنید</td>
</tr>
<tr>
<td>Name</td>
<td>نام یکتای برنامه (مثلاً <code style="direction: ltr; display: inline-block;">kavosh-portal</code>)</td>
</tr>
<tr>
<td>Plan type</td>
<td><strong>Free</strong> (برای شروع و پروژه‌های داخلی کافی است)</td>
</tr>
<tr>
<td>Source</td>
<td><strong>GitHub</strong> را انتخاب و به GitHub وارد شوید</td>
</tr>
<tr>
<td>Organization / Repository / Branch</td>
<td>مخزن و شاخه‌ای که کد در آن قرار دارد را انتخاب کنید</td>
</tr>
<tr>
<td>Build Presets</td>
<td><strong>Custom</strong> (اگر از فریم‌ورک استفاده نمی‌کنید)</td>
</tr>
<tr>
<td>App location</td>
<td><code style="direction: ltr; display: inline-block;">/</code> (ریشه مخزن) یا مسیر پوشه برنامه</td>
</tr>
<tr>
<td>Api location</td>
<td>خالی بگذارید (مگر اینکه API اضافه کنید)</td>
</tr>
<tr>
<td>Output location</td>
<td>خالی بگذارید (برای HTML ساده نیازی نیست)</td>
</tr>
</tbody>
</table>
<div class="info-box">
<strong>💡 نکته:</strong> اگر از فریم‌ورکی مانند React یا Vue استفاده می‌کنید، Build Presets را مطابق فریم‌ورک انتخاب کنید و Output location را مثلاً <code style="direction: ltr; display: inline-block;">dist</code> یا <code style="direction: ltr; display: inline-block;">build</code> تنظیم کنید.
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۴: تکمیل ایجاد و انتظار برای استقرار</h4>
<p>روی <strong>Review + Create</strong> و سپس <strong>Create</strong> کلیک کنید. Azure به طور خودکار یک فایل workflow در مخزن GitHub شما ایجاد می‌کند (در مسیر <code style="direction: ltr; display: inline-block;">.github/workflows</code>) که فرآیند build و deploy را مدیریت می‌کند. پس از چند دقیقه، برنامه شما در آدرسی مانند <code style="direction: ltr; display: inline-block;">https://&lt;random-name&gt;.azurestaticapps.net</code> در دسترس خواهد بود.</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۵: به‌روزرسانی خودکار</h4>
<p>از این پس، هر بار که کد خود را به شاخه متصل (مثلاً <code style="direction: ltr; display: inline-block;">main</code>) push کنید، GitHub Actions به طور خودکار برنامه را rebuild و دوباره مستقر می‌کند. نیازی به هیچ اقدام دستی دیگری نیست.</p>
<div class="success-box">
<strong>✓ مزیت کلیدی:</strong> در طرح Free، Static Web Apps گواهی SSL خودکار، دامنه اختصاصی و تا ۱۰۰ گیگابایت پهنای باند در ماه را بدون هزینه فراهم می‌کند[reference:4]. این گزینه برای اکثر برنامه‌های داخلی شرکت کاملاً کافی است.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۴</div>
<div class="section-title">
<h3>روش دوم: Azure App Service</h3>
<div class="subtitle">App Service — Step-by-Step</div>
</div>
</div>
<div class="section-content">
<p>Azure App Service یک پلتفرم مدیریت‌شده (PaaS) برای میزبانی برنامه‌های وب است که از زبان‌ها و فریم‌ورک‌های مختلف از جمله .NET، Node.js، Python، Java و همچنین محتوای استاتیک HTML/CSS/JS پشتیبانی می‌کند[reference:5]. اگر برنامه شما به قابلیت‌هایی مانند WebSocket، پردازش پس‌زمینه یا سرور اختصاصی نیاز دارد، App Service انتخاب صحیح است.</p>
<h4 style="margin-top: 20px; color: var(--primary); font-size: 16px;">گام ۱: آماده‌سازی کد</h4>
<p>فایل‌های HTML، CSS، JavaScript و منابع خود را در یک پوشه آماده کنید. برای استقرار در App Service، معمولاً کد در پوشه <code style="direction: ltr; display: inline-block;">wwwroot</code> قرار می‌گیرد.</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۲: ایجاد App Service در پورتال Azure</h4>
<p>در پورتال Azure، <strong>App Services</strong> را جستجو کرده و <strong>Create</strong> را انتخاب کنید. تنظیمات اصلی را وارد کنید:</p>
<table class="styled-table">
<thead>
<tr>
<th>تنظیم</th>
<th>مقدار</th>
</tr>
</thead>
<tbody>
<tr>
<td>Subscription / Resource Group</td>
<td>مطابق نیاز خود انتخاب کنید</td>
</tr>
<tr>
<td>Name</td>
<td>نام یکتا برای برنامه (مثلاً <code style="direction: ltr; display: inline-block;">kavosh-app</code>)</td>
</tr>
<tr>
<td>Runtime stack</td>
<td>برای HTML استاتیک، <strong>Node.js</strong> یا <strong>.NET</strong> را انتخاب کنید (یا <strong>HTML</strong> در CLI)</td>
</tr>
<tr>
<td>Operating System</td>
<td>Linux یا Windows (بر اساس نیاز)</td>
</tr>
<tr>
<td>App Service Plan</td>
<td>طرح <strong>Free</strong> یا <strong>Basic</strong> برای شروع</td>
</tr>
</tbody>
</table>
<p>پس از تکمیل، <strong>Review + Create</strong> و سپس <strong>Create</strong> را کلیک کنید. چند دقیقه صبر کنید تا منبع ایجاد شود[reference:6].</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۳: استقرار کد (روش ساده با Kudu)</h4>
<p>یکی از ساده‌ترین راه‌ها برای استقرار اولیه، استفاده از کنسول <strong>Kudu</strong> است. در منوی App Service، <strong>Advanced Tools</strong> را جستجو کرده و روی <strong>Go</strong> کلیک کنید. سپس <strong>Debug Console → PowerShell</strong> را باز کنید، به مسیر <code style="direction: ltr; display: inline-block;">site\wwwroot</code> بروید و فایل <code style="direction: ltr; display: inline-block;">hostingstart.html</code> را با محتوای HTML خود جایگزین کنید[reference:7].</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۴: استقرار خودکار با GitHub Actions (روش توصیه‌شده)</h4>
<p>در بخش <strong>Deployment Center</strong> سرویس App Service، گزینه <strong>GitHub</strong> را انتخاب کنید، مخزن و شاخه را مشخص کنید. Azure به طور خودکار یک workflow GitHub Actions ایجاد می‌کند که با هر push، کد را در App Service مستقر می‌کند. این روش برای نگهداری بلندمدت توصیه می‌شود.</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۵: بررسی برنامه</h4>
<p>به بخش <strong>Overview</strong> بروید و روی <strong>Default domain</strong> کلیک کنید. برنامه شما باید در آدرس <code style="direction: ltr; display: inline-block;">https://&lt;app-name&gt;.azurewebsites.net</code> در دسترس باشد[reference:8].</p>
<div class="warning-box">
<strong>⚠️ توجه:</strong> در طرح Free، App Service ممکن است پس از مدتی بدون ترافیک، سرد (cold) شود. اگر برنامه شما باید همیشه در دسترس باشد، طرح Basic یا بالاتر را انتخاب کنید.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۵</div>
<div class="section-title">
<h3>روش سوم: Azure Blob Storage (میزبانی استاتیک)</h3>
<div class="subtitle">Blob Storage Static Hosting — Step-by-Step</div>
</div>
</div>
<div class="section-content">
<p>Azure Blob Storage می‌تواند محتوای استاتیک شامل HTML، CSS، JavaScript و فایل‌های تصویری را مستقیماً از یک کانتینر سرویس‌دهی کند. این روش برای سایت‌های بسیار ساده و بدون نیاز به احراز هویت یا هدرهای سفارشی مناسب است[reference:9].</p>
<h4 style="margin-top: 20px; color: var(--primary); font-size: 16px;">گام ۱: ایجاد حساب ذخیره‌سازی</h4>
<p>در پورتال Azure یک <strong>Storage Account</strong> از نوع <strong>General-purpose v2</strong> یا <strong>BlockBlobStorage</strong> ایجاد کنید.</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۲: فعال‌سازی میزبانی استاتیک</h4>
<p>در حساب ذخیره‌سازی، از منوی سمت چپ زیر <strong>Data management</strong> گزینه <strong>Static website</strong> را انتخاب کنید و <strong>Enabled</strong> را بزنید. نام فایل index (مثلاً <code style="direction: ltr; display: inline-block;">index.html</code>) را وارد کنید. به صورت اختیاری می‌توانید مسیر صفحه 404 سفارشی را نیز مشخص کنید. سپس <strong>Save</strong> را بزنید[reference:10].</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۳: آپلود فایل‌ها</h4>
<p>پس از فعال‌سازی، یک کانتینر به نام <code style="direction: ltr; display: inline-block;">$web</code> به طور خودکار ایجاد می‌شود. فایل‌های برنامه خود را در این کانتینر آپلود کنید (از طریق پورتال، Azure CLI یا Storage Explorer)[reference:11].</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۴: دسترسی به سایت</h4>
<p>آدرس سایت از طریق <strong>Static website</strong> در پورتال قابل مشاهده است (معمولاً <code style="direction: ltr; display: inline-block;">https://&lt;account&gt;.z22.web.core.windows.net</code>). این آدرس را باز کنید تا برنامه خود را ببینید[reference:12].</p>
<div class="warning-box">
<strong>⚠️ محدودیت‌ها:</strong> Blob Storage از احراز هویت (AuthN/AuthZ) پشتیبانی نمی‌کند و برای پیکربندی هدرها باید از Azure CDN استفاده کنید[reference:13]. اگر به این قابلیت‌ها نیاز دارید، Static Web Apps انتخاب بهتری است.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۶</div>
<div class="section-title">
<h3>افزودن قابلیت پویا با Azure Functions</h3>
<div class="subtitle">Adding Serverless API to Static Web Apps</div>
</div>
</div>
<div class="section-content">
<p>اگر برنامه HTML/CSS/JS شما نیاز به منطق سمت سرور دارد (مثلاً خواندن از دیتابیس، احراز هویت یا پردازش داده)، می‌توانید یک API سرورلس با Azure Functions به Static Web Apps اضافه کنید. این کار بدون نیاز به سرور جداگانه انجام می‌شود[reference:14].</p>
<h4 style="margin-top: 20px; color: var(--primary); font-size: 16px;">گام ۱: افزودن API از VS Code</h4>
<p>در VS Code، در ریشه مخزن پروژه، <strong>Command Palette</strong> را باز کنید (F1) و دستور <strong>Azure Static Web Apps: Create HTTP Function</strong> را اجرا کنید. زبان <strong>JavaScript</strong> و مدل برنامه‌نویسی <strong>V4</strong> را انتخاب کنید. یک پوشه <code style="direction: ltr; display: inline-block;">api</code> به همراه تابع نمونه ایجاد می‌شود[reference:15].</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۲: نوشتن منطق API</h4>
<p>فایل تابع (مثلاً <code style="direction: ltr; display: inline-block;">api/message/index.js</code>) را ویرایش کنید و منطق مورد نظر خود را پیاده‌سازی کنید. به عنوان مثال، یک پاسخ JSON ساده برگردانید:</p>
<div class="highlight-box" style="direction: ltr; text-align: left; font-family: monospace; font-size: 13px;">
module.exports = async function (context, req) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;context.res = {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;body: { message: "Hello from Azure Functions!" }<br>
&nbsp;&nbsp;&nbsp;&nbsp;};<br>
};
</div>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۳: فراخوانی API از فرانت‌اند</h4>
<p>در کد JavaScript خود، API را از مسیر <code style="direction: ltr; display: inline-block;">/api/message</code> فراخوانی کنید. Static Web Apps به طور خودکار درخواست‌های <code style="direction: ltr; display: inline-block;">/api/*</code> را به توابع هدایت می‌کند.</p>
<h4 style="margin-top: 25px; color: var(--primary); font-size: 16px;">گام ۴: استقرار</h4>
<p>تغییرات را به GitHub push کنید. GitHub Actions به طور خودکار هم برنامه استاتیک و هم API را مستقر می‌کند. پس از اتمام، API از همان دامنه برنامه در دسترس خواهد بود.</p>
<div class="success-box">
<strong>✓ نتیجه:</strong> با این روش، یک برنامه کامل شامل رابط کاربری HTML/CSS/JS و بک‌اند سرورلس دارید که همه روی Azure Static Web Apps (طرح Free) اجرا می‌شود.
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۷</div>
<div class="section-title">
<h3>جمع‌بندی و پیشنهاد نهایی</h3>
<div class="subtitle">Final Summary & Recommendation</div>
</div>
</div>
<div class="section-content">
<p>سه روش اصلی برای اجرای برنامه HTML/CSS/JavaScript در Azure وجود دارد که هر کدام مزایا و محدودیت‌های خاص خود را دارند. جدول زیر جمع‌بندی نهایی را ارائه می‌دهد:</p>
<table class="styled-table">
<thead>
<tr>
<th>سناریو</th>
<th>روش پیشنهادی</th>
<th>دلیل</th>
</tr>
</thead>
<tbody>
<tr>
<td>داشبورد داخلی، پورتال ساده، SPA</td>
<td style="color: var(--success); font-weight: 600;">Static Web Apps</td>
<td>رایگان، CDN، CI/CD خودکار، احراز هویت داخلی</td>
</tr>
<tr>
<td>برنامه با API سنگین یا WebSocket</td>
<td style="color: var(--success); font-weight: 600;">App Service</td>
<td>پردازش سمت سرور، پشتیبانی از WebSocket، کنترل کامل</td>
</tr>
<tr>
<td>سایت بسیار ساده بدون نیاز به امنیت</td>
<td>Blob Storage</td>
<td>هزینه بسیار کم، راه‌اندازی سریع</td>
</tr>
<tr class="highlight-row">
<td><strong>ترکیب رابط کاربری + منطق سبک</strong></td>
<td style="color: var(--success); font-weight: 700;">Static Web Apps + Functions</td>
<td><strong>همه‌کاره، مقرون‌به‌صرفه، بدون مدیریت سرور</strong></td>
</tr>
</tbody>
</table>
<div class="conclusion-box">
<h3>🎯 پیشنهاد برای شرکت رایان پرداز کاوش Azure</h3>
<p>با توجه به اینکه سیستم مدیریت منابع و پروژه‌های شرکت بر بستر Azure است و تیم فنی قصد ساخت ابزارهای داخلی و داشبوردهای سفارشی را دارد، <strong>Azure Static Web Apps</strong> به عنوان انتخاب اول پیشنهاد می‌شود.</p>
<p>این سرویس نه تنها هزینه‌ای برای شرکت ایجاد نمی‌کند (طرح Free)، بلکه با CI/CD خودکار، امنیت داخلی و امکان افزودن API با Azure Functions، یک پلتفرم کامل و آینده‌نگرانه برای توسعه برنامه‌های وب فراهم می‌آورد.</p>
<div class="highlight">
<strong>💎 مسیر پیشنهادی:</strong><br>
توسعه محلی HTML/CSS/JS ← ایجاد مخزن GitHub ← اتصال به Static Web Apps ← افزودن Azure Functions در صورت نیاز ← استقرار خودکار با هر push
</div>
</div>
</div>
</div>
<div class="section">
<div class="section-header">
<div class="section-number">۸</div>
<div class="section-title">
<h3>منابع و مستندات رسمی</h3>
<div class="subtitle">Official References</div>
</div>
</div>
<div class="section-content">
<ul class="reference-list">
<li>
<strong>Microsoft Learn — Azure Static Web Apps Documentation</strong>
مستندات رسمی شامل شروع سریع، پیکربندی، احراز هویت و API.
<div class="ref-source">https://learn.microsoft.com/azure/static-web-apps/</div>
</li>
<li>
<strong>Microsoft Learn — Deploy your web app to Azure Static Web Apps</strong>
راهنمای گام‌به‌گام استقرار برنامه‌های وب در Static Web Apps.
<div class="ref-source">https://learn.microsoft.com/azure/static-web-apps/deploy-web-framework</div>
</li>
<li>
<strong>Microsoft Learn — Azure App Service Documentation</strong>
مستندات کامل App Service شامل استقرار، مقیاس‌پذیری و پیکربندی.
<div class="ref-source">https://learn.microsoft.com/azure/app-service/</div>
</li>
<li>
<strong>Microsoft Learn — Static website hosting in Azure Storage</strong>
راهنمای میزبانی سایت استاتیک در Blob Storage.
<div class="ref-source">https://learn.microsoft.com/azure/storage/blobs/storage-blob-static-website</div>
</li>
<li>
<strong>Microsoft Learn — Add an API to Azure Static Web Apps with Azure Functions</strong>
راهنمای افزودن API سرورلس به Static Web Apps.
<div class="ref-source">https://learn.microsoft.com/azure/static-web-apps/add-api</div>
</li>
<li>
<strong>Technetmagazine — Azure Static Web Apps vs App Service</strong>
مقایسه جامع دو سرویس از نظر معماری، قیمت و سناریوهای استفاده.
<div class="ref-source">https://www.technetmagazine.com/azure-static-web-apps/</div>
</li>
</ul>
</div>
</div>
<div class="page-info">
این مستند محرمانه بوده و صرفاً جهت استفاده داخلی تیم فنی شرکت رایان پرداز کاوش Azure تهیه شده است.
</div>
</div>
<footer class="document-footer">
<div class="footer-brand">تدوین: تیم فنی رایان پرداز کاوش Azure</div>
<div class="footer-divider"></div>
<div>تاریخ تهیه: آبان ۱۴۰۵ &nbsp;|&nbsp; نسخه: ۱.۰ &nbsp;|&nbsp; طبقه‌بندی: محرمانه</div>
</footer>
</div>
</body>
</html>