「10/30 在 Azure 雲平台上架設企業網站」的課程筆記 === 本課程將透過四種方面:網路、計算、存儲及安全讓學員習得 Azure 的核心服務及彈性服務管理服務,如 Virtual Network、Virtual Machines、managed disks、Blob storage、Database 以及 Active Directory、Role Based Access Control、Load Balancer 及 Virtual Machine Scale Sets 等服務。利用這些服務打造架構完整且具可擴展之高彈性的企業網站環境,在節省成本及人員的前提下,解決流量龐大時造成網站無法瀏覽而造成企業損失的問題。 #### 課程內容: * 章節 01: Azure 核心服務-1 * 章節 02: Azure 核心服務-2 * 章節 03: Azure 彈性管理服務 * 章節 04: Azure 架構設計原則 * 章節 05: 實踐彈性架構 (實驗室時間) [:floppy_disk: 課程 PDF 講義下載點](https://drive.google.com/file/d/1LYMqMm0vImp1SBlpV6Z9ujvsmSMNoQ3W/view?usp=sharing) [:floppy_disk: 課程資源下載點](https://drive.google.com/file/d/1YLBltKkRkuwiIpfoDCz_0yUwefnR7ZGr/view?usp=sharing) 可以在講師的 GitHub 下載到 : https://github.com/JamesHsu333 ## Build Static Website with Azure blob storage 建立 static website (不需開啟 VM 或 Container) ### Create Storage account * Azure 登入網頁:https://portal.azure.com/#home * 搜尋 Storage accounts 並新增  * 按下 Review+create 略過設定 ### Create Static website hosting through Storage account settings 點擊 Settings 下的 Static website 選項 Enable 此功能 填入預設開啟的網頁檔案為 index.html  最後記得存檔按下 Save 按鈕 ### Upload files to blob 點擊 $web 進入上傳頁面 並上傳課程資源內的 index.html 檔案  ### View blob static website hosting 點擊 Settings 下的 Static website 選項 複製 Primary Endpoint 欄位內的 URL  把上面的 URL 貼在瀏覽器上,就可以看到 index.html 的網頁內容  ## Build LAMP Structure in Azure Virtual Machine 使用 VM 建立 LAMP 並使用 Azure SQL Database * 解釋 LAMP ``` OS:Linux Server:Apache DB:MySQL Web:PHP ``` ### Create Virtual Machine 搜尋 Virtual Machine 並選擇 Static website  點擊 Add  這邊使用 Ubuntu Server 18.04 LTS 的 Image  Authentication type 因為是課程訓練,所以登入方式我選 password Select inbound ports 我選 HTTP (80), HTTPS (443), SSH (22)  選擇 Advanced 頁纖  Cloud init 內貼上 VM 所需要安裝的套件腳本 ``` #cloud-config runcmd: - 'sudo wget https://raw.githubusercontent.com/JamesHsu333/ScaleSet/master/2.Build_LAMP_Structure_in_Azure_VM/runscript.sh' - 'sudo chmod +x runscript.sh' ``` 按下 Review + create  等一會後,按下 Go to Resource  * 紀錄 VM 登入帳密,等等會用到 ### Connect to Virtual Machine  * 使用 cmd 進行 ssh 連線到 Ubuntu  * 找出 Public IP address 貼 URL 在瀏覽器就能找到程式執行畫面  ``` 輸入指令: ssh 帳號@IP ssh ubuntu@23.96.2.58 ```  切換權限為 root 輸入 sudo su 執行一下 / runscript.sh  ## Create SQL database 搜尋一下 SQL database  點擊 Add 按鈕  Server 欄位點擊 Create new 按鈕 輸入 Server name, Server admin login & Password  Using existing data 欄位選擇 Sample  點擊 Review + create 按鈕  紀錄 DB 登入帳密,等等會用到 發佈完後,點擊 Go to Resource 按鈕  ### Set SQL database 選擇 Query editor 這裡可以測試一下 DB 登入是否正常  輸入剛剛的帳密  無法登入時,點擊 Set server firewall 進行防火牆設定  開設定 On 並複製 Client IP address 到 Start IP & End IP 並存檔 Save  就能正常登入 DB 了 ### Connect to SQL database 開啟網頁,並輸入 DB 資訊,就能看到畫面上有資料出現了  ## Scale Set 依據 VM 上面的 CPU 負載率,進行開啟或關閉新 VM ### Create Virtual Network 搜尋 virtual network  點擊 Create 按鈕  點擊 Create 按鈕  發佈完後,點擊 Go to resource  選擇 Address space  選擇 Subnets  ### Create Virtual Machine Scale Set 搜尋 virtual machine scale set  點擊 Virtual machine scale set  點擊 Create 按鈕     發佈後 Go to resource  選擇 Instances 裡面已經有 VM 開啟了  選擇 Scaling 設定 VM 開啟上限數量與開啟關閉的條件   紀錄 Scale Set 的 VM 登入帳密,等等會用到 ### Connect to Linux Virtual Machine 點擊 Instances 內的 VM 選項  選擇 Overview 的 Connect  安裝增加 CPU 的工具並執行 ``` sudo apt-get update sudo apt-get install stress stress --version stress -c 4 ```  由於 CPU 增加,便會開啟新的 VM ## Cost Management 這個功能可以知道目前資源的使用費用 ###### tags: `課程筆記`
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up