Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
38b48ad
0
sariszoom Jun 19, 2024
9b6571c
add How to install Docker
Thanabodin19 Jun 19, 2024
90f57c9
update How to install Docker bash
Thanabodin19 Jun 19, 2024
8905eaa
update How to Uninstall Docker Engine
Thanabodin19 Jun 19, 2024
333542d
update How to install Server
Thanabodin19 Jun 19, 2024
60ff14f
จัดย่อหน้า install-server docker
Thanabodin19 Jun 19, 2024
1fa6273
Merge pull request #1 from Thanabodin19/main
gunnvrs Jun 20, 2024
caac14b
1.01
sariszoom Jun 20, 2024
8e278c9
01
sariszoom Jun 20, 2024
9d3f8a6
first commint
gunnvrs Jun 20, 2024
ef8e1ee
Merge pull request #1 from gunnvrs/main
Thanabodin19 Jun 20, 2024
8d479bd
delete file 00,01
sariszoom Jun 20, 2024
315a8fa
Merge branch 'main' into main
sariszoom Jun 20, 2024
a2472c9
Merge pull request #1 from gunnvrs/main
sariszoom Jun 20, 2024
e24024f
add some data for as04
gunnvrs Jul 15, 2024
c278c51
delete $ bash
Thanabodin19 Jul 16, 2024
245c3e2
update link github
Thanabodin19 Jul 16, 2024
ce7a5fd
add more info as4
gunnvrs Jul 19, 2024
50df4e7
update make iot sensor 2
Thanabodin19 Aug 5, 2024
95b48bc
add mqtt information on ingest.md
gunnvrs Aug 11, 2024
098baa2
add more detail for iot-sensor
gunnvrs Aug 11, 2024
b6caab6
update only code to current version
gunnvrs Aug 26, 2024
9f70e14
visualization 1
sariszoom Aug 26, 2024
7386121
Install Ubuntu 24.04 (LTS) on server
Thanabodin19 Aug 31, 2024
d3bf792
delete rundocker
Thanabodin19 Aug 31, 2024
9dc0c65
Docker as a non-root user
Thanabodin19 Aug 31, 2024
10e86db
update as04
gunnvrs Sep 11, 2024
d6aedd8
add new 3 and fix payload of as4
gunnvrs Sep 11, 2024
43e6b9f
change picture
gunnvrs Sep 11, 2024
ec20197
add iot processor and iot sensor for as0
gunnvrs Sep 11, 2024
14e5389
add al data as03
gunnvrs Sep 11, 2024
4ef4079
update Architecture 00
Thanabodin19 Sep 11, 2024
1d81dc1
done Store data Analyze and make aggregations
Thanabodin19 Sep 11, 2024
de921ca
add note
Thanabodin19 Sep 11, 2024
fa5bfc0
Assignment 7
sariszoom Sep 12, 2024
aeb9c5f
add note service
Thanabodin19 Sep 17, 2024
bd4db9a
final merge
gunnvrs Sep 17, 2024
e97a1c9
final merge
Thanabodin19 Sep 17, 2024
c333dcb
sync together
sariszoom Sep 17, 2024
c66ecae
final merge 2
gunnvrs Sep 17, 2024
9fedf6e
final2
Thanabodin19 Sep 17, 2024
dbf4230
Merge branch 'saris' into main
sariszoom Sep 17, 2024
6cf35b1
Merge pull request #2 from Thanabodin19/main
sariszoom Sep 17, 2024
f78ef63
Merge pull request #2 from sariszoom/saris
Thanabodin19 Sep 17, 2024
07e77a5
Merge branch 'gunn' into main
gunnvrs Sep 17, 2024
847adf5
Merge pull request #2 from Thanabodin19/main
gunnvrs Sep 17, 2024
f804e1d
add new flowchart image
gunnvrs Sep 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions GROUP.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Group Members
1. Name (https://github.com/name/iotclass67)
1. Name (https://github.com/name/iotclass67)
1. Name (https://github.com/name/iotclass67)
1. 6410301026 (https://github.com/Thanabodin19/iotclass67.git)
2. 6410301029 (https://github.com/gunnvrs/iotclass67.git)
3. 6410301031 (https://github.com/sariszoom/iotclass67.git)

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ Iot Event Streaming Architecture.[^1]
GitHub format syntax[^2].

[^1]: https://sanchezsanchezsergio418.medium.com/iot-event-streaming-architecture-fb790c634c2f
[^2]: Visit https://docs.github.com/en/get-started/writing-on-github
[^2]: Visit https://docs.github.com/en/get-started/writing-on-github
55 changes: 50 additions & 5 deletions assignment00/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,77 @@

## Eclipse Mosquitto


**Eclipse Mosquitto** เป็นซอฟต์แวร์โอเพ่นซอร์สที่ทำหน้าที่เป็น MQTT broker ซึ่งเป็นโปรโตคอลที่ใช้ในการสื่อสารระหว่างอุปกรณ์ IoT ด้วยการออกแบบที่มีประสิทธิภาพและใช้ทรัพยากรน้อย ทำให้ Eclipse Mosquitto เหมาะสำหรับงานที่เกี่ยวกับ IoT โดยมีคุณสมบัติหลักดังนี้
- **โอเพ่นซอร์ส** ดาวน์โหลดและใช้งานได้ฟรี รวมถึงแก้ไขซอฟต์แวร์ได้ตามต้องการ
- **รองรับ MQTT** ทำหน้าที่เป็นตัวกลางในการส่งและรับข้อความระหว่างอุปกรณ์
- **ติดตั้งง่าย** รองรับหลายระบบปฏิบัติการ เช่น Windows, macOS, และ Linux
- **ความปลอดภัย** รองรับการเข้ารหัส SSL/TLS และการตรวจสอบสิทธิ์ของผู้ใช้

## Apache ZooKeeper

**Apache Zookeeper** เป็นระบบจัดการและประสานงานแบบกระจาย (distributed coordination service) โดยใช้ในระบบที่มีความซับซ้อนและต้องการความเสถียรสูง เช่น Apache Kafka, Hadoop, และ Hbase

หน้าที่และคุณสมบัติสำคัญของ ZooKeeper ได้แก่
- จัดการ brokers และบันทึกสถานะของ brokers แต่ละตัว
- บันทึกข้อมูลเกี่ยวกับ topics และ partitions
- เลือก leader/replica ของ partitions
- แจ้งเตือน Kafka เมื่อมีการเปลี่ยนแปลง เช่น broker ใหม่หรือตาย
- บันทึกการเขียน/อ่านข้อมูลของ producers และ consumers
- เก็บข้อมูล Authorization สำหรับการสร้าง topics
- ติดตาม offset ของ consumer groups

## Apache Kafka


**Apache Kafka** คือระบบจัดคิวข้อความแบบกระจาย (distributed message queue) ที่สามารถรับส่งข้อมูลในปริมาณมากได้อย่างมีประสิทธิภาพ Kafka เหมาะสำหรับระบบที่ต้องการความสามารถในการส่งข้อมูลระหว่างแอปพลิเคชันหลายตัวในรูปแบบที่เสถียรและปรับขนาดได้

## Apache Kafka Connect


**Kafka Connect** เป็นเครื่องมือที่ทำหน้าที่เชื่อมต่อและแปลงข้อมูลระหว่างระบบต้นทาง (source systems) และระบบปลายทาง (target systems) โดยไม่ต้องสร้าง producer และ consumer ขึ้นมาเอง Kafka Connect ช่วยลดความซับซ้อนในการทำงานกับข้อมูลจำนวนมากที่อยู่ใน Kafka

## Apache Kafka Streams

**Kafka Streams** เป็นไลบรารีที่ใช้สำหรับการประมวลผลข้อมูลใน Kafka โดยสามารถทำการคำนวณและแปลงข้อมูลแบบสตรีมได้อย่างมีประสิทธิภาพ

## Apache Kafka Rest Proxy

**Kafka REST Proxy** เป็นเครื่องมือหรืออินเทอร์เฟซที่ช่วยให้ผู้ใช้สามารถสื่อสารกับ Kafka brokers ผ่าน HTTP API แทนที่จะใช้ Kafka client โดยตรง ซึ่งทำให้การเชื่อมต่อกับ Kafka ง่ายขึ้นสำหรับแอปพลิเคชันหรือบริการที่ไม่รองรับ Kafka client libraries หรือไม่ได้เขียนด้วยภาษาที่ Kafka รองรับโดยตรง
## Prometheus


**Prometheus** เป็นระบบมอนิเตอร์ริ่งและเตือนภัยแบบโอเพ่นซอร์สที่ออกแบบมาเพื่อรวบรวมและจัดเก็บข้อมูลเมตริกในรูปแบบ time series data เหมาะสำหรับการมอนิเตอร์ระบบและแอปพลิเคชันต่าง ๆ โดยมีการทำงานแบบกระจายและมีความยืดหยุ่นสูง Prometheus สามารถทำงานร่วมกับ Grafana เพื่อสร้างกราฟแสดงข้อมูลแบบเรียลไทม์

## MongoDB


**MongoDB** เป็นฐานข้อมูล NoSQL ที่ได้รับความนิยมซึ่งออกแบบมาให้จัดเก็บข้อมูลในรูปแบบที่ยืดหยุ่น MongoDB เหมาะสำหรับการจัดการข้อมูลปริมาณมาก โดยนักพัฒนาสามารถปรับแต่งการทำงานของระบบเพื่อสร้างแอปพลิเคชันที่ทันสมัยและขับเคลื่อนด้วยข้อมูลได้อย่างง่ายดาย

## Grafana

**Grafana** เป็นเครื่องมือสร้างแดชบอร์ดที่สามารถแสดงข้อมูลจากเมตริกต่าง ๆ ในรูปแบบกราฟแบบเรียลไทม์ Grafana รองรับการดึงข้อมูลจากแหล่งข้อมูลยอดนิยม เช่น Prometheus, InfluxDB, Elasticsearch, AWS CloudWatch เป็นต้น

จุดเด่นของ Grafana คือ
- **การมอนิเตอร์เมตริกแบบเรียลไทม์** สามารถดู CPU, Memory และเมตริกอื่น ๆ ได้ทันที
- **การแจ้งเตือน** รองรับการแจ้งเตือนผ่าน Email, Slack, Line และช่องทางอื่น ๆ
- **ความยืดหยุ่นสูง** มีตัวเลือกในการปรับแต่งกราฟและแผงควบคุม (panels) อย่างหลากหลาย
- **รองรับหลาย Data Sources** สามารถใช้งานกับแหล่งข้อมูลหลายประเภทพร้อมกันได้

## IoT Processor

**IoT Processor** เป็นการประมวลผลข้อมูลที่ได้จากเซ็นเซอร์ ข้อมูลที่เก็บมาอาจจะถูกส่งไปยังระบบประมวลผลหรือเซิร์ฟเวอร์กลาง การประมวลผลอาจรวมถึง

- การคำนวณ: เช่นการคำนวณค่าเฉลี่ย หรือค่าความผันแปรของข้อมูล
- การแปลงข้อมูล: เช่น การแปลงหน่วยข้อมูลที่ได้จากเซ็นเซอร์
- การจัดส่งข้อมูล: ส่งข้อมูลไปยัง MQTT broker เพื่อนำไปแสดงผลบน Grafana หรือเก็บในฐานข้อมูล
## IoT Sensor
ในโปรเจคนี้เรามี IoT Sensor 2 รูปแบบคือ
* ข้อมูล IoT Sensor จาก hardware (Cucumber)
* ข้อมูล IoT Sensor จาก ไมโครเซอร์วิส ที่จำลองจาก Container
### Cucumber
IoT Sensor เป็นโมดูลเซ็นเซอร์หรือฟังก์ชันที่เกี่ยวกับการรวบรวมข้อมูลจากเซ็นเซอร์ต่างๆบนอุปกรณ์ hardware รวมถึงการอ่านค่าในระบบ IoT ตัวอย่างเช่น

- อุณหภูมิ: การรวบรวมอุณหภูมิจากเซ็นเซอร์อุณหภูมิ เช่น DHT11, BMP280
- ความชื้น: การเก็บค่าความชื้นในอากาศ
- แสง: การเก็บข้อมูลความเข้มของแสงจาก LDR ที่ทำการต่อเพิ่ม(cucumberไม่มีbuilt-in)
- ความกดอากาศ: atm

### IoT Sensor container
IoT Sensor เป็น sensor ที่ถูกจําลองด้วยไมโครเซอร์วิสที่ใช้ใน Spring Boot (ผ่านไลบรารี Eclipse Paho MQTT) ที่ถูกติดตั้งอยู่บนเซิฟเวอร์ โดยจะส่งข้อมูล telemetry ไปยังโบรกเกอร์ Eclipse Mosquitto ข้อมูลที่ถูกจำลองนี้ generate ค่า ทุกอย่างภายใน payload มาจาก Callable โดยจะถูกสร้างขึ้นทุกวินาทีและ มี payload ในรูปแบบที่สร้างขึ้นให้ตรงกัน

167 changes: 165 additions & 2 deletions assignment01/01-install-server.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,177 @@
# Install Server and Docker

## How to install Server 🖥️
### Install Ubuntu 24.04 (LTS) on server

## How to install Server
#### 1. Select Your Language
Choose your preferred language.
- Example: `[ English ]`

#### 2. Installer Update Available
Skip the update for now.
- Select: `[ Continue without updating ]`

#### 3. Keyboard Configuration
If the default keyboard layout is correct, proceed.
- Select: `[ Done ]`

#### 4. Choose the Type of Installation
Choose the minimized Ubuntu Server installation.
- Option: `(X) Ubuntu Server (minimized)`
- Select: `[ Done ]`

#### 5. Network Configuration
Accept the default network configuration.
- Select: `[ Done ]`

## How to install Docker
#### 6. Proxy Configuration
If you don't use a proxy, leave this blank.
- Select: `[ Done ]`

#### 7. Ubuntu Archive Mirror Configuration
Accept the default mirror settings.
- Select: `[ Done ]`

#### 8. Guided Storage Configuration
Choose to create a custom storage layout.
- Option: `(X) Custom storage layout`
- Select: `[ Done ]`

#### 9. Storage Configuration
Configure your partitions as follows:

1. **Mount Boot Partition:**
- Use free space to create a new GPT partition.
- Size: `2G`
- Format: `[ ext4 ]`
- Mount: `[ /boot ]`
- Select: `[ Create ]`

2. **Mount Swap Partition:**
- Use free space to create a new GPT partition.
- Size: `2G`
- Format: `[ swap ]`
- Select: `[ Create ]`

3. **Mount Root Partition:**
- Use the remaining free space to create a new GPT partition.
- Size: `MAX`
- Format: `[ ext4 ]`
- Mount: `[ / ]`
- Select: `[ Create ]`

#### **File System Summary:**

| MOUNT POINT | SIZE | TYPE | DEVICE TYPE |
|-------------|-------|------|------------------------|
| / | MAX | ext4 | partition of localdis |
| /boot | 2.0 G | ext4 | partition of localdis |
| /SWAP | 2.0 G | swap | partition of localdis |

- Select: `[ Done ]`
- Confirm the destructive action.
- Select: `[ Continue ]`

#### 10. Profile Configuration
Fill in the following fields to set up your server profile:

- **Your name:** Enter your full name.
- **Your server name:** Choose a name for your server.
- **Pick a username:** Choose a username for your account.
- **Choose a password:** Create a secure password.
- **Confirm your password:** Re-enter your password to confirm.
- Select: `[ Done ]`

#### 11. Upgrad to Ubunto Pro
If prompted, select the option for upgrading to Ubuntu Pro.
- Option: `(X) Custom storage layout`
- Select: `[ Continue ]`

#### 12. SSH Configuration
Install the OpenSSH server to enable remote access.
- Option: `(X) Install OpenSSH server`
- Select: `[ Done ]`

#### 13. Featured server snaps
Skip the installation of featured snaps.
- Select: `[ Continue ]`

#### 14. Installation Complete!
Once the installation is finished, your server is ready to use.
- Select: `[ Reboot Now ]`

---



### Setup Basic tools and Clone Project
``` bash
# install wireless-tools, net-tools, git, vim
sudo apt install wireless-tools net-tools git vim

# git clone project
git clone https://github.com/sergio11/iot_event_streaming_architecture.git

# into project
cd iot_event_streaming_architecture

```

## How to install Docker 🐳

``` bash
# Add Docker's official GPG key:
sudo apt-get update
sudo apt-get install ca-certificates curl
sudo install -m 0755 -d /etc/apt/keyrings
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
sudo chmod a+r /etc/apt/keyrings/docker.asc

# Add the repository to Apt sources:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt-get update

# Install the Docker packages:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
```
### Manage Docker as a non-root user
To create the `docker` group and add your user:
1. Create the `docker` group.
``` bash
sudo groupadd docker
```
2. Add your user to the `docker` group.
```bash
sudo usermod -aG docker $USER
```
3. Log out and log back in so that your group membership is re-evaluated.
```bash
newgrp docker
```

### Set up DNS Docker and Docker login
``` bash
# use vim edit file
sudo vim /etc/docker/daemon.json

# Put this text in the file.
{
"dns": ["8.8.8.8", "8.8.4.4"]
}

# restart service docker
sudo systemctl restart docker

# docker login
sudo docker login
```

## How to Uninstall Docker Engine
``` bash
# Uninstall the Docker Engine, CLI, containerd, and Docker Compose packages:
sudo apt-get purge docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-ce-rootless-extras

# Images, containers, volumes, or custom configuration files on your host aren't automatically removed. To delete all images, containers, and volumes:
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd
```
Loading