---
# System prepended metadata

title: 盤點系統佈署 SOP
tags: [盤點系統]

---

# 盤點系統佈署 SOP
## **一. 盤點系統架構說明**
:::info
:::

## **二. 盤點系統數據庫建置**
> 安裝 MariaDB

[MariaDB數據庫安裝](https://hackmd.io/vGoc_faVQbWeX6D4qRwUnQ)

> 建立數據庫帳戶
```bash=
create user 'ewill'@'%' identifiey by 'ewill1qaz@WSX';
```
> 初使化盤點系統數據庫
```bash=
mysql -u ewill -p < EwillAssets.sql
mysql -u ewill -p < Inventory_2.sql
```

## **三. 盤點系統 API 佈署**
> 安裝 dotnet

```bash=
sudo dnf install dotnet-sdk-5.0
```

> 編譯盤點系統 API
```bash=
cp -rp assetsapi_all_package /build; cd /build
dotnet publish -c Release -r linux-x64 /p:PublishSingleFile=true
cp -rp ./bin/Release/netcoreapp3.1/linux-x64/publish /opt/Assets
```
> 初使化盤點系統 API 相關參數
```bash=
sed -i -e 's/192.168.50.47/10.10.0.209/' -e 's/sa/ewill/' -e 's/!QAZ2wsx/ewill1qaz@WSX/' -e 's/8030/5011/' /opt/Assets/appsettings.json
```

> 服務設定
```bash=
vi /etc/systemd/system/assetsapi.service
```
```
[Unit]
Description=Ewill AssetsAPI
Wants=network.target
After=network.target

[Service]
User=root
Restart=on-failure
WorkingDirectory=/opt/Assets
ExecStart=/opt/Assets/AssetsAPI

[Install]
WantedBy=multi-user.target
```

> 服務啟動及管理
```bash=
systemctl daemon-reload
systemctl enaable assetsapi
systemctl start assetsapi 
systemctl status assetsapi
```

## **四. 盤點系統入口網頁**
> 安裝 Nginx

[Nginx 安裝](https://hackmd.io/qhWPedn6S5Slq-2VbyU2-w?view#1-Nginx-%E5%AE%89%E8%A3%9D)

> 建立盤點系統 web server
```bash=
cp -rp inventory_all_package /opt/Inventory
vi /etc/nginx/conf.d/inventory.conf
```

```
server {
    listen 80;
    server_name 10.10.0.201;
    root          /opt/Inventory;
    index       Login.html;
}

```
> 初使化盤點系統相關參數
```bash=
sed -i -e 's/192.168.50.47/10.10.0.209/' /opt/Inventory/js/pages/ip.js
```
> 服務啟動及管理
```bash=
systemctl restart nginx
systemctl status nginx
```




###### tags: `盤點系統` 

