Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Static Web App の使い方
Search
Hajime
December 30, 2023
Technology
2.8k
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Static Web App の使い方
Hajime
December 30, 2023
More Decks by Hajime
See All by Hajime
Azure API Management の使い方
hajimes
0
3.9k
Azure App Configuration と Key Vault の連携
hajimes
0
810
Azure Functions で SQL Database のデータを操作する API を作成する手順
hajimes
0
1k
Other Decks in Technology
See All in Technology
plamo-3-translateの開発
pfn
PRO
0
260
CloudWatchから始めるAWS監視
butadora
0
320
歴史から理解するクラウドインフラのしくみ
kizawa2020
1
200
20260608_Codexの可能性_ノンプログラマー向け_大城追記
doradora09
PRO
0
750
reFACToring
moznion
1
1.1k
システム監視入門
grimoh
5
810
AIQAのナレッジ構築について
qatonchan
1
150
[MIRU26] To What Extent Does MLLM-as-a-Judge Exhibit Cross-Model Preference Bias?
keio_smilab
PRO
0
200
コンポーネント名には何を含めるべきなのか? / what-should-be-included-in-component-names
airrnot1106
0
250
運用を犠牲にせずコストを制御し事業成長を支える B2B SaaS ID管理基盤におけるS3 Tableのログストレージ活用
kaminashi
1
160
サイバー捜査員研修(後半)
nomizone
1
500
検索技術知識0のエンジニアが広告検索システムを内製化して運用するまで
lycorptech_jp
PRO
0
210
Featured
See All Featured
Making Projects Easy
brettharned
120
6.7k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
790
The Cult of Friendly URLs
andyhume
79
7k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.3k
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
420
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
240
Speed Design
sergeychernyshev
33
2k
Discover your Explorer Soul
emna__ayadi
2
1.2k
Crafting Experiences
bethany
1
240
Transcript
Static Web Apps の使い⽅ (c) 2023 uraniwai
Static Web App とは • 2020 年 5 ⽉に発表された静的な Web
サイト向け App Service の ホスティング⽅法の⼀種 • Hugo や Jekyll, Hexo などの静的サイトのジェネレータだけでなく React や Vue, Angular といったシングル・ページ・アプリケーショ ン(SPA)のホスティングを想定 • Azure Functions を Static Web Apps 内部でマネージすることもで き、また、外部の API へルーティングすることもできる • デプロイ⽅法として CI/CD パイプラインが前提 (c) 2023 uraniwai App Service で使⽤できる Static Web Apps シングル ページ ホスティング オプションのプレビューの開始 https://azure.microsoft.com/ja-jp/updates/static-web-apps-single-page-hosting-option-available-in-app-service-now-in-preview/
Static Web Apps の主な機能 • コンテンツ配信 • GitHub Actions や
Azure Pipelines など CI/CD パイプライン からデプロイ • 単に静的サイトとしてホスティング するだけでなく App Service の EasyAuth などの機能が利⽤できる • リバースプロキシ • 特定のパス配下 (例えば /api) のリ クエストをバックエンドへ転送 • 静的サイトと同じ FQDN になるた め、 CORS の設定が不要 (c) 2023 uraniwai
Static Web Apps へのコンテンツのデプロイ⽅法 • Static Web Apps では GitHub
や Azure DevOps との接続が必須 • 現在、提供しているデプロイ⽅法は3種類 • Visual Studio Code の拡張機能でデプロイ • Azure ポータルでデプロイ • Azure CLI でデプロイ • デプロイ時に設定する内容 • リソースグループ • リソース名 • 課⾦レベル • リージョン (組み込み Functions) • リポジトリの情報 (c) 2023 uraniwai
Static Web Apps へのコンテンツのデプロイ⼿順 (c) 2023 uraniwai Azure ポータル Azure
CLI Visual Studio Code # 1. Azure にログイン $ az login # 2. リソースグループ作成 $ az group create --name my-swa-group --location ”japaneast” # 3. Static Web App 作成 $ az staticwebapp create --name my-first- static-web-app --resource-group my-swa- group --source “https://github.com/$GITHUB_USER_NAME/ my-first-static-web-app” --location “japaneast" --branch main --app-location "src" --login-with-github # 4. URL の取得 $ az staticwebapp show --name my-first- static-web-app --query "defaultHostname" 1. VSCode で「Azure Static Web Apps」拡張 機能をインストール 2. Azure メニューを選択してログイン 3. Static Web App を右クリックして「Create New Static Web App」を選択 4. 「The extension 'Azure Static Web Apps' wants to sign in using GitHub.」と表⽰され るので「allow」を選択 5. ブラウザが開きアクセス権を要求されるので 「Confirm」を選択 6. VSCode に戻って必要な項⽬を⼊⼒しt実⾏
GitHub Actions のパイプライン (React 向け) • Static Web Apps へ設置
• Azure/static-web-apps- deploy モジュールを利⽤ • フロントエンドや組み込み Function のパスを指定して 設置元を伝える • ビルド処理はパイプライン に記述せず package.json 内に記述 (c) 2023 uraniwai ・・・ jobs: build_and_deploy_job: steps: ・・・ - name: Build And Deploy id: builddeploy uses: Azure/static-web-apps-deploy@v1 with: azure_static_web_apps_api_token: ${{ secrets.STATIC_WEB_APPS_API_TOKEN }} repo_token: ${{ secrets.GITHUB_TOKEN }} action: 'upload’ app_location: '/’ api_location: ’’ output_location: 'build’ production_branch: 'master’ env: SKIP_DEPLOY_ON_MISSING_SECRETS: true ・・・ パラメータ名 役割 例 app_location リポジトリ内のフロントエンドアプリのパス “/” api_location リポジトリ内の組み込み Functions のパス “/api” output_location フロントエンドアプリのビルド出⼒パス “build” production_branch リポジトリの対象ブランチ “master”
その他 (c) 2023 uraniwai
プランと価格 (c) 2023 uraniwai Free Standard 料⾦ $0 $9/month (730h)
帯域幅 100GB / Subscription 100GB / Subscription 帯域幅の超過 不可 $0.20/GB/Subscription カスタムドメイン 2 / app 5 / app SSL 証明書 無料 無料 サービス定義認証 可能 可能 カスタム認証 不可 可能 ストレージ容量 (アプリ全体) 0.50GB 2.00GB ストレージ容量 (デプロイ単位) 0.25GB 0.50GB API ホスティング 組み込み Functions のみ 独⾃ Functions や 他の Azure サービスも可能 エンタープライズグレードエッジ 不可 $17.52/month/app データベース接続 無料※GA後に課⾦の可能性あり 無料※GA後に課⾦の可能性あり SLA 設定なし 99.95%
リファレンスアーキテクチャ (外部向け Web サイト) • アプリケーションの構成 • SPA で構築された Web
サイトは Static Web Apps に GitHub からデプロイ • API からデータやファイルを取得する際、 API Management を経由して Function にアクセス • ログ情報は Monitor で⼀元的に収集 (c) 2023 uraniwai サービス名 概要 Static Web Apps SPA (例: React) API Management API をホスティングするサービス Functions API の処理の実体 Cosmos DB NoSQL データベース Blob Storage ファイル Monitor ログの収集 GitHub ソースコード管理とデプロイの実⾏環境
(c) 2023 uraniwai