# NYCU CS 丁組先備知識 1. 資工碩丁組同學預設成為 [SA](https://nasa.cs.nctu.edu.tw/sa/2020/) 與 [NA](https://nasa.cs.nctu.edu.tw/na/2021/) 課程助教,為使課程準備順利進行,請未來助教先行了解內容。 2. 請在 7 / 7 例行會議前完成以下四大項的任務。 3. 有問題歡迎在 Telegram 群組提問。 --- [TOC] --- # 熟悉 SA NA 作業與先備知識 目的是為了讓各位助教可以在暑假開始前就具備 SA 與 NA 的基本知識,開學後可以快速上手。所以我們整合了去年 SA 的作業成一個大型服務、新增 NA 課程的 LDAP service (servers & clients) 並微調一些設定要求。總共需要大家練習建置四台機器。 * 請使用 **FreeBSD 12.2** 或 **CentOS 7 以上** 完成作業 * 不須使用 Online Judge 評測作業。 * 不須建置 WireGuard 相關環境。 * 友善提醒:ZFS 系列會消耗比較多系統資源,如果硬體資源比較吃緊的朋朋可以先做其它部分,等到來 CC (系計中) 之後有我們提供的資源之後再補上。或是可以找 [wxchang](mailto:wxchang@cs.nctu.edu.tw) (TG: @da21510) 學長請求硬體資源 / 支援。 * <mark>黃色底</mark> 作業內容請見課程連結。另外,<mark>[HW5](https://nasa.cs.nctu.edu.tw/sa/2020/slides/HW5v2.pdf)</mark> <font color=red>**不用做 NIS 的部分**</font>。 * <font color=red>**請盡量完成全部內容**</font> > 課程連結: > - [SA: Computer System Administration](https://nasa.cs.nctu.edu.tw/sa/2020/) > - [NA: Computer Network Administration (05/13 only)](https://nasa.cs.nctu.edu.tw/na/2021/) ## 架構圖 ![](https://i.imgur.com/NOCvPSI.png) ## Preparation <center> | Name | 王志嘉 | 王璽禎 | 林秉徽 | 林熙哲 | 洪睿澤 | 張世澤 | | - | - | - | - | - | - | - | | ID | 1 | 2 | 3 | 4 | 5 | 6 | </center> Each machine should have: - <mark>[HW2](https://nasa.cs.nctu.edu.tw/sa/2020/slides/HW2.pdf)</mark> One liner script & System Info Panel (no need to complete git part) > Allow users to check system information - <mark>[HW5](https://nasa.cs.nctu.edu.tw/sa/2020/slides/HW5v2.pdf)</mark> NFS client > With a mount point: (rw, root_squash) > | Server folder | Client folder | Description | > | - | - | - | > | /vol/home/ | /data/home/ | LDAP user home directories | - <mark>[HW4 (NA)](https://nasa.cs.nctu.edu.tw/na/2021/slides/HW4.pdf)</mark> LDAP client > Allow every user to login every machine ## Machine 1: FTP & NFS server <mark>[HW3](https://nasa.cs.nctu.edu.tw/sa/2020/slides/HW3.pdf) & [HW5](https://nasa.cs.nctu.edu.tw/sa/2020/slides/HW5v2.pdf)</mark> ``` IP: 10.113.0.1 Hostname: nfs.{ID}.nctu.cs ``` - Mount one more point: (rw, root_squash) > | Server folder | Client folder | Description | > | - | - | - | > | /vol/web_hosting/ | /data/web_hosting/ | Web hosting | - No need to share /home directory - Note the difference between /data/home and /home in HW3 ## Machine 2: Web server <mark>[HW4](https://nasa.cs.nctu.edu.tw/sa/2020/slides/HW4.pdf)</mark> ``` IP: 10.113.0.2 Hostname: www.{ID}.nctu.cs ``` - Mount one more point: (rw, root_squash) > | Server folder | Client folder | Description | > | - | - | - | > | /vol/web_hosting/ | /data/web_hosting/ | Web hosting | - Web Server with all web hosting files in /data/web_hosting ## Machine 3: LDAP Provider (Master) <mark>[HW4 (NA)](https://nasa.cs.nctu.edu.tw/na/2021/slides/HW4.pdf)</mark> ``` IP: 10.113.0.3 Hostname: ldapprovider.{ID}.nctu.cs ``` - Base DN: dc={ID},dc=nctu,dc=cs - **no_root_squash on /data/home** - Create two LDAP users: - `uid=TA` user with home directory /data/home/TA - `uid={custom_user}` user with home directory /data/home/{custom_user} ## Machine 4: LDAP Consumer (Slave) <mark>[HW4 (NA)](https://nasa.cs.nctu.edu.tw/na/2021/slides/HW4.pdf)</mark> ``` IP: 10.113.0.4 Hostname: ldapconsumer.{ID}.nctu.cs ``` - Base DN: dc={ID},dc=nctu,dc=cs - Synchronize LDAP data from LDAP provider # Git 的基礎使用與操作 ## 基礎 git 指令 需要能活用這些指令 :::spoiler Git Command List * git rebase * git add * git pull * git fetch * git commit * git diff * git config * git push * git clone * git log * git remote * git branch * git checkout ::: ## Git 學習連結推薦 * [git-rebase.io](https://git-rebase.io/ ) * [learngitbranching.js.org](https://learngitbranching.js.org/?locale=zh_TW) # CI/CD 基本認知 * 什麼是 CI/CD? * 為甚麼要使用? * 帶來甚麼好處? ## Gitlab CI/CD gitlab runner 需基本認知,並如何在 gitlab ci/cd 去使用。 簡易撰寫與嘗試 gitlab ci/cd 的 yaml,並在線上 runner 試著跑跑看。 建立一個 ci yaml 跑多個 stage 多個 job 的嘗試。 # Docker 以下標題為主題,分項為建議了解事項,請同學們在可負擔的情況下盡量理解 ## Docker 相關知識 - [Docker Networking](https://docs.docker.com/network/) - 可解釋這些網路模型差異 - [Dockerfile](https://docs.docker.com/engine/reference/builder/) - 能讀懂,有能力依照情況撰寫 - [Docker Compose](https://docs.docker.com/compose/) - [Compose file](https://docs.docker.com/compose/compose-file/) ## 反思時間 - 今天我要怎麼解釋給一個沒用過 Docker 的人 Docker 是什麼呢?Docker 可以解決哪些問題? - 以前沒有 Docker 的時候大家都怎麼部署應用程式呢? --- 以下項目為進階知識,可以在掌握基本知識又有餘力時了解。 ## Advance Docker Networking - 如何自行設定 bridge 網路並且設定固定 IP - 在 Containers 之間設定路由讓封包可以從 Container1 → Container2 → Host - 在 Containers 之間設定路由讓封包可以從 Container1 → Container2 → Host(不使用 Docker Compose) references: - [Linux Bridge](https://man7.org/linux/man-pages/man8/bridge.8.html) - [Linux veth](https://man7.org/linux/man-pages/man4/veth.4.html) ## Kubernetes - [Kubernetes Pod](https://kubernetes.io/docs/concepts/workloads/pods/) - [Kubernetes Deployment](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) - [Kubernetes Service](https://kubernetes.io/docs/concepts/services-networking/service/) <style> span.hidden-xs:after { content: ' - CSCC' } </style>