vault backup: 2025-03-04 11:17:00
This commit is contained in:
108
21.01. Linux/架站/Apache.md
Normal file
108
21.01. Linux/架站/Apache.md
Normal file
@@ -0,0 +1,108 @@
|
||||
## Install
|
||||
```
|
||||
sudo apt update && sudo apt install apache2
|
||||
```
|
||||
|
||||
## 測試Apache
|
||||
```
|
||||
sudo service apache2 status
|
||||
```
|
||||
|
||||
## 設置虛擬主機(Virtual Hosts)
|
||||
假設要建立2個網站*test1.ui-code.com*與*test2.ui-code.com*
|
||||
|
||||
### 建立目錄並設置權限(Permissions)
|
||||
```
|
||||
sudo mkdir -p /var/www/test1.ui-code.com/public_html
|
||||
sudo mkdir -p /var/www/test2.ui-code.com/public_html
|
||||
sudo chmod -R 755 /var/www
|
||||
```
|
||||
|
||||
### 建立測試頁面
|
||||
#### 建立test1.ui-code.com的測試頁面
|
||||
```
|
||||
sudo nano /var/www/test1.ui-code.com/public_html/index.html
|
||||
```
|
||||
填入以下內容:
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome to test1.ui-code.com</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to test1.ui-code.com</h2>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
#### 建立test2.ui-code.com的測試頁面
|
||||
```
|
||||
sudo nano /var/www/test2.ui-code.com/public_html/index.html
|
||||
```
|
||||
填入以下內容:
|
||||
```html
|
||||
<html>
|
||||
<head>
|
||||
<title>Welcome to test2.ui-code.com</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Welcome to test2.ui-code.com</h2>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
### 建立虛擬主機文件(Virtual Host Files)
|
||||
虛擬主機文件位於 /etc/apache2/sites-available/ 中,其用於告訴 Apache 網頁伺服器如何響應(Respond )各種網域請求(Request)。
|
||||
讓我們為test1.ui-code.com 網域創建一個新的虛擬主機文件。
|
||||
```
|
||||
sudo nano /etc/apache2/sites-available/test1.ui-code.com.conf
|
||||
```
|
||||
|
||||
將以下內容貼上:
|
||||
```
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@test1.ui-code.com
|
||||
ServerName test1.ui-code.com
|
||||
ServerAlias www.test1.ui-code.com
|
||||
DocumentRoot /var/www/test1.ui-code.com/public_html
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
再來為test2.ui-code.com 網域創建一個新的虛擬主機文件。
|
||||
```
|
||||
sudo nano /etc/apache2/sites-available/test2.ui-code.com.conf
|
||||
```
|
||||
|
||||
將以下內容貼上:
|
||||
```
|
||||
<VirtualHost *:80>
|
||||
ServerAdmin webmaster@test2.ui-code.com
|
||||
ServerName test2.ui-code.com
|
||||
ServerAlias www.test2.ui-code.com
|
||||
DocumentRoot /var/www/test2.ui-code.com/public_html
|
||||
ErrorLog ${APACHE_LOG_DIR}/error.log
|
||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||
</VirtualHost>
|
||||
```
|
||||
|
||||
### 啟用新的虛擬主機文件(Virtual Host Files)
|
||||
現在我們有兩個虛擬主機文件,我們需要使用 a2ensite 工具來啟用它們。
|
||||
```
|
||||
sudo a2ensite test1.ui-code.com
|
||||
sudo a2ensite test2.ui-code.com
|
||||
```
|
||||
|
||||
測試配置語法是否有錯誤。
|
||||
```
|
||||
apachectl configtest
|
||||
```
|
||||
|
||||
如果「Syntax OK」,重啟 Apache。
|
||||
```
|
||||
sudo systemctl reload apache2
|
||||
```
|
||||
|
||||
## 參考
|
||||
- [[教學][Ubuntu 架站] 在 Ubuntu 20.04 安裝 Apache 網頁伺服器,並架設多個網站(多網域) | 優程式](https://ui-code.com/archives/271)
|
||||
30
21.01. Linux/架站/Gitea.md
Normal file
30
21.01. Linux/架站/Gitea.md
Normal file
@@ -0,0 +1,30 @@
|
||||
## docker-compose.yml
|
||||
```yaml
|
||||
version: "3"
|
||||
|
||||
networks:
|
||||
gitea:
|
||||
external: false
|
||||
|
||||
services:
|
||||
server:
|
||||
image: gitea/gitea:latest
|
||||
container_name: gitea
|
||||
environment:
|
||||
- USER_UID=1000
|
||||
- USER_GID=1000
|
||||
restart: always
|
||||
networks:
|
||||
- gitea
|
||||
volumes:
|
||||
- ./data:/data
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
ports:
|
||||
- "8020:3000"
|
||||
- "2244:22"
|
||||
```
|
||||
|
||||
## 文件
|
||||
- [Gitea Docs: Config Cheat Sheet](https://docs.gitea.io/zh-tw/config-cheat-sheet/)
|
||||
- [How to Install Gitea on Ubuntu Using Docker](https://www.digitalocean.com/community/tutorials/how-to-install-gitea-on-ubuntu-using-docker)
|
||||
97
21.01. Linux/架站/Grafana-prometheus.md
Normal file
97
21.01. Linux/架站/Grafana-prometheus.md
Normal file
@@ -0,0 +1,97 @@
|
||||
# 要準備的檔案
|
||||
```
|
||||
├── data
|
||||
│ ├── grafana
|
||||
│ │ └── provisioning
|
||||
│ │ └── datasources
|
||||
│ │ └── datasources.yaml
|
||||
│ └── prometheus
|
||||
│ └── prometheus.yml
|
||||
├── docker-compose.yml
|
||||
```
|
||||
|
||||
- `docker-compose.yml`
|
||||
- `data/grafana/provisioning/datasources/datasources.yaml`
|
||||
- `data/prometheus/prometheus.yml`
|
||||
|
||||
# `docker-compose.yml`
|
||||
|
||||
```yaml hl:5
|
||||
services:
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
restart: always
|
||||
user: "1000"
|
||||
ports:
|
||||
- "8082:3000"
|
||||
volumes:
|
||||
- ./data/grafana/data:/var/lib/grafana # data path
|
||||
- ./data/grafana/grafana.ini:/etc/grafana/grafana.ini
|
||||
- ./data/grafana/provisioning/dashboards:/etc/grafana/provisioning/dashboards
|
||||
- ./data/grafana/provisioning/datasources:/etc/grafana/provisioning/datasources
|
||||
environment:
|
||||
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:latest
|
||||
container_name: grafana-prometheus-1
|
||||
restart: always
|
||||
command:
|
||||
- --storage.tsdb.retention.time=7d
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
ports:
|
||||
- "8083:9090"
|
||||
volumes:
|
||||
- ./data/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
|
||||
node_exporter:
|
||||
image: prom/node-exporter:latest
|
||||
restart: always
|
||||
ports:
|
||||
- "8084:9100"
|
||||
```
|
||||
|
||||
要注意 `user: "1000"` 這一行,這一行是你的 user ID,有可能會變,請用 `id -u` 確認一下。
|
||||
|
||||
# `datasources.yaml`
|
||||
|
||||
```yaml hl:6
|
||||
# datasources.yaml
|
||||
apiVersion: 1
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
type: prometheus
|
||||
url: http://192.168.1.24:8083
|
||||
access: proxy
|
||||
```
|
||||
|
||||
要注意 `url: http://192.168.1.24:8083` 這一行,要更新 IP 位置。
|
||||
|
||||
# `prometheus.yml`
|
||||
|
||||
```yaml hl:11
|
||||
# prometheus.yml
|
||||
global:
|
||||
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
|
||||
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
|
||||
# scrape_timeout is set to the global default (10s).
|
||||
|
||||
scrape_configs:
|
||||
- job_name: 'node-exporter-local'
|
||||
scrape_interval: 5s
|
||||
static_configs:
|
||||
- targets: ['192.168.1.24:8084']
|
||||
```
|
||||
|
||||
要注意 `- targets: ['192.168.1.24:8084']` 這一行,要更新 IP 位置。
|
||||
|
||||
# Grafana template
|
||||
|
||||
template ID: `1860`
|
||||
|
||||
# 參考
|
||||
- [Docker Compose 部署监控系统 Prometheus + Grafana + Node Exporter + Cadvisor-腾讯云开发者社区-腾讯云](https://cloud.tencent.com/developer/article/2016801)
|
||||
- [基于docker-compose快速搭建Prometheus+Grafana监控系统 - 掘金](https://juejin.cn/post/7320525843737460771)
|
||||
- [Deep Dive into Using Docker Compose for Monitoring with Prometheus, Grafana, and node_exporter | by mefengl | Medium](https://medium.com/@mefengl/unknown-title-95cb5a15ce83)
|
||||
- [使用docker-compose快速部署Prometheus+grafana环境_docker-compose安装grafana-CSDN博客](https://blog.csdn.net/weixin_45070882/article/details/132104496)
|
||||
- [Dashboards | Grafana Labs](https://grafana.com/grafana/dashboards/?collector=nodeexporter&dataSource=prometheus)
|
||||
91
21.01. Linux/架站/Grafana.md
Normal file
91
21.01. Linux/架站/Grafana.md
Normal file
@@ -0,0 +1,91 @@
|
||||
|
||||
# 設定
|
||||
`docker-compose.yml` 如下:
|
||||
```yaml
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
grafana:
|
||||
image: grafana/grafana:latest
|
||||
container_name: grafana
|
||||
restart: always
|
||||
user: "1000" # needs to be `id -u` // alternatively chown the grafana/data dir to 472:472
|
||||
ports:
|
||||
- "8081:3000" # expose for localhost
|
||||
links:
|
||||
- influxdb
|
||||
volumes:
|
||||
- ./data/grafana/data:/var/lib/grafana # data path
|
||||
- ./data/grafana/provisioning:/etc/grafana/provisioning
|
||||
- ./data/grafana/grafana.ini:/etc/grafana/grafana.ini
|
||||
environment:
|
||||
- GF_INSTALL_PLUGINS=grafana-clock-panel,grafana-simple-json-datasource
|
||||
|
||||
influxdb:
|
||||
image: influxdb
|
||||
ports:
|
||||
- "8082:8086"
|
||||
volumes:
|
||||
- ./data/influxdb/data:/var/lib/influxdb2
|
||||
|
||||
telegraf:
|
||||
image: telegraf
|
||||
user: telegraf:992 # Get 992 by `stat -c '%g' /var/run/docker.sock`, depend on system
|
||||
depends_on:
|
||||
- influxdb
|
||||
links:
|
||||
- influxdb
|
||||
volumes:
|
||||
- /var/run/docker.sock:/var/run/docker.sock:ro
|
||||
- ./data/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
|
||||
environment:
|
||||
- HOST_PROC=/proc
|
||||
- HOST_SYS=/sys
|
||||
- HOST_ETC=/etc
|
||||
```
|
||||
|
||||
檔案結構如下:
|
||||
```
|
||||
data\
|
||||
grafana\
|
||||
grafana.ini
|
||||
telegraf\
|
||||
telegraf.conf
|
||||
docker-compose.yml
|
||||
```
|
||||
|
||||
`data/grafana/grafana.ini` 與 `data/telegraf/telegraf.conf` 都是需要事先準備好的檔案。
|
||||
|
||||
## 設定 InfluxDB
|
||||
|
||||
先把 docker 建立起來,然後打開 influxdb([http://awinpi4:8082](http://awinpi4:8082/)),建立帳號、密碼、資料庫名稱。如下:
|
||||
![[20240217_212138_chrome_setup_influxdb.png]]
|
||||
|
||||
之後會出現一串Token,如下,這個要記起來。
|
||||
![[20240217_212319_chrome_1894x1254_influxdb_token.png]]
|
||||
|
||||
## 設定 telegraf
|
||||
然後打開 `./data/telegraf/telegraf.conf` ,找到 `[[outputs.influxdb_v2]]` 這個區塊,把 `urls`、`organization`、`bucket`、`token` 的值改為剛剛建立與複製的那一串。如圖:
|
||||
![[20240217_213900_Code_setup_telegraf_ini.png]]
|
||||
然後重啟 docker compose。
|
||||
|
||||
# 設定 InfluxDB 的 dashboard
|
||||
|
||||
到 [https://github.com/influxdata/community-templates#templates](https://github.com/influxdata/community-templates#templates) 挑一個 template,例如 [Raspberry Pi System Template](https://github.com/influxdata/community-templates/tree/master/raspberry-pi),找到他的網址,如下:
|
||||
![[20240217_213108_chrome_1864x1044_raspberrypi_template_on_github.png]]
|
||||
|
||||
複製這一行,然後到 InfluxDB 的 template 去把它 import 進來。如下:
|
||||
![[20240217_213237_chrome_2753x1254_setup_influxdb.png]]
|
||||
|
||||
![[20240217_213311_chrome_2753x1254_influxdb_install_template.png]]
|
||||
|
||||
接著 Dashboards 就會出現一個 Raspberry Pi System 的 dashboard 了。
|
||||
![[20240217_213343_chrome_1624x1120_influxdb_dashboard.png]]
|
||||
|
||||
點下去之後大概是長這樣:
|
||||
![[20240217_214001_chrome_2604x1716_influxdb_dashboard.png]]
|
||||
|
||||
# 參考
|
||||
- [建構 Grafana + Influxdb v2.0 + Telegraf 監控系統(docker版) - DSA Learning](https://dsalearning.github.io/grafana/influxdb-telegraf-docker/)
|
||||
- [Raspberry Pi, InfluxDB, Grafana, Docker | by Anton Karazeev | Medium](https://medium.com/@antonkarazeev/raspberry-pi-influxdb-grafana-docker-a526575d6e6f#id_token=eyJhbGciOiJSUzI1NiIsImtpZCI6ImVkODA2ZjE4NDJiNTg4MDU0YjE4YjY2OWRkMWEwOWE0ZjM2N2FmYzQiLCJ0eXAiOiJKV1QifQ.eyJpc3MiOiJodHRwczovL2FjY291bnRzLmdvb2dsZS5jb20iLCJhenAiOiIyMTYyOTYwMzU4MzQtazFrNnFlMDYwczJ0cDJhMmphbTRsamRjbXMwMHN0dGcuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhdWQiOiIyMTYyOTYwMzU4MzQtazFrNnFlMDYwczJ0cDJhMmphbTRsamRjbXMwMHN0dGcuYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJzdWIiOiIxMDM4MDc4MzIzNTMyNTIzMDc3NDYiLCJlbWFpbCI6ImF3aW5odWFuZ0BnbWFpbC5jb20iLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwibmJmIjoxNzA4MTQ1MjU3LCJuYW1lIjoiQXdpbiBIdWFuZyIsInBpY3R1cmUiOiJodHRwczovL2xoMy5nb29nbGV1c2VyY29udGVudC5jb20vYS9BQ2c4b2NJZjNQY0d3WjZIcDdYM204b3BjczRlNGVlZnBHQ1pGeVdMamExcjNTVVNKd1ZnPXM5Ni1jIiwiZ2l2ZW5fbmFtZSI6IkF3aW4iLCJmYW1pbHlfbmFtZSI6Ikh1YW5nIiwibG9jYWxlIjoiemgtVFciLCJpYXQiOjE3MDgxNDU1NTcsImV4cCI6MTcwODE0OTE1NywianRpIjoiNzBmNjI3NDFiNzhiYmVlMTYwNjBiZWRlOTY2YmFjYTAyZTY0ZTZkOSJ9.SXAVZ3SXny4YjIc9Cg6fNFHlXKe0jrm-4uwJ7KH41Tmo_vRAQGlbUn7MmVHXWexpKdpMCSVECC8C1VuUielC-vm8AoHMs1PLJCyhdg02hUyTqEMA08ydscfjguGP6kuI3LoMVsxkAl51C06lQi8llYZ4XGkdHxhCWP12fXQStdGPfv-64KNCkPTIfI7Teo7sfJGyjSQsDMRa4v9GWS9qmbCqut06fhpLyj0lEVfntratbuTN8ThekVfuJyJyG29U6xclm1O0NgBp-BnXML_YtBxTBV2Td_DRYY0dfcVivDKxzH135FfY5xpp_2ZIewkjJG5-pTHpin1R_XLVmIhXuA)
|
||||
- [Raspberry Pi 4 使用 Grafana 监控_influxdb and grafana on raspberrypi-CSDN博客](https://blog.csdn.net/u013360850/article/details/115568985)
|
||||
143
21.01. Linux/架站/Nextcloud.md
Normal file
143
21.01. Linux/架站/Nextcloud.md
Normal file
@@ -0,0 +1,143 @@
|
||||
## docker-compose.yml
|
||||
```yaml
|
||||
version: '3'
|
||||
|
||||
services:
|
||||
app:
|
||||
image: nextcloud
|
||||
ports:
|
||||
- 8080:80
|
||||
volumes:
|
||||
- ./data:/var/www/html
|
||||
restart: always
|
||||
```
|
||||
|
||||
## config.php
|
||||
Nextcloud 的 config 檔放在`/var/www/html/config/config.php`,對應到本機就是 `./data/config/config.php`,在安裝完成之後,需要修改 `trusted_domains`、`overwriteprotocol`、`overwrite.cli.url` 這幾個參數,如下:
|
||||
```php
|
||||
<?php
|
||||
$CONFIG = array (
|
||||
'htaccess.RewriteBase' => '/',
|
||||
'memcache.local' => '\\OC\\Memcache\\APCu',
|
||||
'apps_paths' =>
|
||||
array (
|
||||
0 =>
|
||||
array (
|
||||
'path' => '/var/www/html/apps',
|
||||
'url' => '/apps',
|
||||
'writable' => false,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'path' => '/var/www/html/custom_apps',
|
||||
'url' => '/custom_apps',
|
||||
'writable' => true,
|
||||
),
|
||||
),
|
||||
'memcache.distributed' => '\\OC\\Memcache\\Redis',
|
||||
'memcache.locking' => '\\OC\\Memcache\\Redis',
|
||||
'redis' =>
|
||||
array (
|
||||
'host' => 'redis',
|
||||
'password' => '',
|
||||
'port' => 6379,
|
||||
),
|
||||
'upgrade.disable-web' => true,
|
||||
'instanceid' => 'och3g4qo42hq',
|
||||
'passwordsalt' => 'kASfV5cf4Rh+EcvGNKQkmK01HD2UbI',
|
||||
'secret' => 'Vze6ZS+qgeOmacEn3ctbtV3uZaEpzeJDufjkkm4A9lgmUYpF',
|
||||
'trusted_domains' =>
|
||||
array (
|
||||
0 => 'nc.awin.one',
|
||||
),
|
||||
'datadirectory' => '/var/www/html/data',
|
||||
'dbtype' => 'mysql',
|
||||
'version' => '28.0.3.2',
|
||||
'dbname' => 'nextcloud',
|
||||
'dbhost' => 'db',
|
||||
'dbport' => '',
|
||||
'dbtableprefix' => 'oc_',
|
||||
'mysql.utf8mb4' => true,
|
||||
'dbuser' => 'nextcloud',
|
||||
'dbpassword' => 'F5vy&46Fzbn:hFnlHji.sWfS*SP~wC',
|
||||
'overwriteprotocol' => 'https',
|
||||
'overwrite.cli.url' => 'https://nc.awin.one',
|
||||
'maintenance_window_start' => 1,
|
||||
'default_phone_region' => 'TWN',
|
||||
'installed' => true,
|
||||
'mail_smtpmode' => 'smtp',
|
||||
'mail_sendmailmode' => 'smtp',
|
||||
'mail_from_address' => 'awinhuang',
|
||||
'mail_domain' => 'gmail.com',
|
||||
'mail_smtphost' => 'smtp.gmail.com',
|
||||
'mail_smtpport' => '587',
|
||||
'mail_smtpauth' => 1,
|
||||
'mail_smtpname' => 'awinhuang@gmail.com',
|
||||
'mail_smtppassword' => 'stcg ozpc ypsl enbp',
|
||||
'maintenance' => false,
|
||||
'loglevel' => 2,
|
||||
);
|
||||
```
|
||||
|
||||
## 遇到的問題
|
||||
1. 你經由安全的連線存取系統,但系統卻生成了不安全的 URL。這很有可能是因為你使用了反向代理伺服器,但反向代理伺服器的改寫規則並未正常工作,請閱讀關於此問題的文件頁面 ↗。
|
||||
1. 在 `config/config/php` 新增
|
||||
```
|
||||
'overwriteprotocol' => 'https',
|
||||
'overwrite.cli.url' => 'https://nc.awin.one',
|
||||
```
|
||||
這兩行
|
||||
|
||||
2. 增加 cron: `nextcloud_clean.sh` 在 crontab
|
||||
1. `*/5 * * * * /home/awin/script/nextcloud_clean.sh`
|
||||
|
||||
3. 伺服器未設定維護時段的開始時間。這代表了每天耗費大量資源的背景作業也會在您主要使用的時間內執行。我們建議將其設定為低使用率的時間,以減少使用者受到這些繁重任務帶來的負載影響。
|
||||
1. 在 `config/config/php` 增加 `'maintenance_window_start' => 1,`
|
||||
|
||||
4. 您並未設定手機國際冠碼。設定後使用者在個人檔案設定手機號碼時不必再輸入國際冠碼。若要這樣做,請新增「default_phone_region」至設定檔,允許的國家及地區請參閱 ISO 3166-1 code 清單。
|
||||
1. 在 `config/config/php` 增加 `'default_phone_region' => 'TWN',`
|
||||
|
||||
5. 您尚未為 WOPI 請求設定允許清單。若無此設定,使用者可以透過 WOPI 請求將受限制的檔案下載至 Nextcloud 伺服器
|
||||
|
||||
6. 此站台缺少一些建議的 PHP 模組。為了改善效能與相容性,強烈建立您安裝這些模組:bz2
|
||||
|
||||
7. How to know if redis is being used
|
||||
```
|
||||
docker exec -it redis /bin/sh
|
||||
cd
|
||||
redis-cli monitor
|
||||
ctrl+c
|
||||
```
|
||||
|
||||
8. gmail app password for nextcloud: `stcg ozpc ypsl enbp`
|
||||
|
||||
9. 大檔案無法上傳
|
||||
1. 改善傳輸的效率: `sudo docker exec -u 33 e84abbefd5ed php occ config:app:set files max_chunk_size --value 0`
|
||||
2. `docker-compose.yml` 要增加 3 個 environment:
|
||||
```yaml
|
||||
- PHP_MEMORY_LIMIT=10240M
|
||||
- PHP_UPLOAD_LIMIT=10240M
|
||||
- POST_MAX_SIZE=10240
|
||||
```
|
||||
3. ReverseProxy 要增加:
|
||||
|
||||
### 大檔案無法上傳
|
||||
1. 改善傳輸的效率: `sudo docker exec -u 33 e84abbefd5ed php occ config:app:set files max_chunk_size --value 0`
|
||||
2. `docker-compose.yml` 要增加 3 個 environment:
|
||||
```yaml
|
||||
- PHP_MEMORY_LIMIT=10240M
|
||||
- PHP_UPLOAD_LIMIT=10240M
|
||||
- POST_MAX_SIZE=10240
|
||||
```
|
||||
3. ReverseProxy 要增加:
|
||||
```yaml
|
||||
client_max_body_size 0;
|
||||
fastcgi_read_timeout 600;
|
||||
fastcgi_send_timeout 600;
|
||||
fastcgi_connect_timeout 600;
|
||||
proxy_connect_timeout 600;
|
||||
proxy_send_timeout 600;
|
||||
proxy_read_timeout 600;
|
||||
send_timeout 600;
|
||||
```````
|
||||
4. 上傳檔案時遇到 "server repliedL Not Found": `sudo docker exec -u 33 e84abbefd5ed php occ files:scan --all`
|
||||
26
21.01. Linux/架站/Pelican blog.md
Normal file
26
21.01. Linux/架站/Pelican blog.md
Normal file
@@ -0,0 +1,26 @@
|
||||
## Create a site
|
||||
Use `pelican-quickstart` to create a new site.
|
||||
|
||||
## Plugin
|
||||
```bash
|
||||
git clone --recursive https://github.com/getpelican/pelican-plugins.git
|
||||
```
|
||||
|
||||
## Theme
|
||||
先把所有佈景主題都clone下來:
|
||||
```bash
|
||||
git clone --recursive https://github.com/getpelican/pelican-themes.git
|
||||
```
|
||||
|
||||
把`pelicanconf.py`裡面的`THEME`指向theme的目錄就可以換佈景主題了。例如要用[[blue-penguin](https://github.com/jody-frankowski/blue-penguin)]這一個主題。把`pelicanconf.py`裡面加入`THEME = 'pelican-themes/blue-penguin'`就可以了。
|
||||
|
||||
## 預覽
|
||||
```
|
||||
make html
|
||||
make serve
|
||||
```
|
||||
|
||||
參考:
|
||||
- [koko's Note – Python - 安裝 Pelican Theme 來改變你的靜態網站主題](https://note.koko.guru/install-pelican-theme.html)
|
||||
- [nest theme](https://github.com/molivier/nest)
|
||||
- [Flex theme](https://github.com/alexandrevicenzi/Flex/wiki/Custom-Settings)
|
||||
260
21.01. Linux/架站/Proxmox VE.md
Normal file
260
21.01. Linux/架站/Proxmox VE.md
Normal file
@@ -0,0 +1,260 @@
|
||||
# 安裝
|
||||
## 下載ISO
|
||||
- [Get the free Proxmox VE ISO installer](https://www.proxmox.com/en/downloads/category/iso-images-pve)
|
||||
|
||||
## 準備USB disk
|
||||
- 用[Rufus](https://rufus.ie/)的話
|
||||
1. 在遇到詢問是否要下載 Grub 時,請選擇「否」
|
||||
2. 必須使用DD mode來建立開機碟。(參考:[Prepare Installation Media - Proxmox VE](https://pve.proxmox.com/wiki/Prepare_Installation_Media#_instructions_for_windows))
|
||||
![[Pasted image 20210128212917.png]]
|
||||
|
||||
# 設定
|
||||
## 關閉「闔上螢幕後休眠」
|
||||
打開`/etc/systemd/logind.conf`:
|
||||
```
|
||||
nano /etc/systemd/logind.conf
|
||||
```
|
||||
找到下面兩行,把值改成ignore:
|
||||
```
|
||||
HandleLidSwitch=ignore
|
||||
HandleLidSwitchDocked=ignore
|
||||
```
|
||||
然後重開機:
|
||||
```
|
||||
systemctl restart systemd-logind.service
|
||||
```
|
||||
圖示:
|
||||
![[Pasted image 20210129194144.png]]
|
||||
|
||||
## 增加硬碟
|
||||
先用`lsblk`列出所有硬碟,這裡假設`sda`是我們的開機磁碟,我要要新增`sdb`:
|
||||
```
|
||||
root@pve:~# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:0 0 931.5G 0 disk <-- 目前在用的
|
||||
├─sda1 8:1 0 1007K 0 part
|
||||
├─sda2 8:2 0 512M 0 part
|
||||
└─sda3 8:3 0 931G 0 part
|
||||
sdb 8:16 0 111.8G 0 disk <-- 要新增的
|
||||
├─sdb1 8:17 0 100M 0 part
|
||||
├─sdb2 8:18 0 16M 0 part
|
||||
├─sdb3 8:19 0 111.1G 0 part
|
||||
└─sdb4 8:20 0 563M 0 part
|
||||
```
|
||||
|
||||
然後安裝`parted`,我們要用它來分割硬碟:
|
||||
```
|
||||
apt install parted
|
||||
```
|
||||
|
||||
開始分割:
|
||||
```
|
||||
parted /dev/sdb mklabel gpt
|
||||
```
|
||||
|
||||
建立primary partition,格式為`ext4`:
|
||||
```
|
||||
parted -a opt /dev/sdb mkpart primary ext4 0% 100%
|
||||
```
|
||||
|
||||
再來將分割好的硬碟格式化為`ext4`,label命名為`data2`:
|
||||
```
|
||||
mkfs.ext4 -L data2 /dev/sdb1
|
||||
```
|
||||
|
||||
再用`lsblk`看一次,會發現sdb已經重新分割成1個partition了:
|
||||
```
|
||||
root@pve:~# lsblk
|
||||
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
|
||||
sda 8:0 0 931.5G 0 disk
|
||||
├─sda1 8:1 0 1007K 0 part
|
||||
├─sda2 8:2 0 512M 0 part
|
||||
└─sda3 8:3 0 931G 0 part
|
||||
sdb 8:16 0 111.8G 0 disk
|
||||
└─sdb1 8:17 0 111.8G 0 part
|
||||
```
|
||||
|
||||
用`lsblk -fs`可以看到每一個硬碟的檔案系統格式:
|
||||
```
|
||||
root@pve:~# lsblk -fs
|
||||
NAME FSTYPE LABEL UUID FSAVAIL FSUSE% MOUNTPOINT
|
||||
sda1 zfs_member rpool 11775123664036754029
|
||||
└─sda zfs_member rpool 11775123664036754029
|
||||
sda2 vfat rpool 32D0-3449
|
||||
└─sda zfs_member rpool 11775123664036754029
|
||||
sda3 zfs_member rpool 11775123664036754029
|
||||
└─sda zfs_member rpool 11775123664036754029
|
||||
sdb1 ext4 data2 bc6d2c41-a3ca-4b0f-a5de-51ee28ae9cec <-- 剛剛分割的
|
||||
└─sdb
|
||||
```
|
||||
|
||||
接下來,將新硬碟掛載到檔案目錄上,先建立一個新目錄來掛載新硬碟:
|
||||
```shell
|
||||
mkdir -p /mnt/data
|
||||
```
|
||||
|
||||
接下來編輯`/etc/fstab`,將新硬碟寫進來,這樣開機之後才會自動把它掛載起來:
|
||||
```
|
||||
nano /etc/fstab
|
||||
```
|
||||
加入這一行(注意:**data2**要改成你自己的label):
|
||||
```
|
||||
LABEL=data2 /mnt/data ext4 defaults 0 2
|
||||
```
|
||||
|
||||
剛新硬碟掛起來:
|
||||
```
|
||||
mount -a
|
||||
```
|
||||
|
||||
用`df`就可以看到新硬碟了:
|
||||
```
|
||||
root@pve:~# df
|
||||
Filesystem 1K-blocks Used Available Use% Mounted on
|
||||
udev 16288892 0 16288892 0% /dev
|
||||
tmpfs 3262688 9324 3253364 1% /run
|
||||
rpool/ROOT/pve-1 942667136 1267584 941399552 1% /
|
||||
tmpfs 16313440 43680 16269760 1% /dev/shm
|
||||
tmpfs 5120 0 5120 0% /run/lock
|
||||
tmpfs 16313440 0 16313440 0% /sys/fs/cgroup
|
||||
rpool 941399680 128 941399552 1% /rpool
|
||||
rpool/data 941399680 128 941399552 1% /rpool/data
|
||||
rpool/ROOT 941399680 128 941399552 1% /rpool/ROOT
|
||||
/dev/fuse 30720 16 30704 1% /etc/pve
|
||||
tmpfs 3262688 0 3262688 0% /run/user/0
|
||||
/dev/sdb1 114854020 61464 108915208 1% /mnt/data <-- 新硬碟在這裡
|
||||
```
|
||||
|
||||
參考:
|
||||
- [How to add storage to Proxmox](https://nubcakes.net/index.php/2019/03/05/how-to-add-storage-to-proxmox/)
|
||||
|
||||
## 增加iSCSI磁碟
|
||||
### 增加需要CHAP認證的iSCSI磁碟
|
||||
1. 先確認找的到iSCSI磁碟
|
||||
```
|
||||
iscsiadm -m discovery -t st -p 192.168.1.11:3260
|
||||
```
|
||||
如果有找到的話會回傳一串IQN值,像是:
|
||||
```
|
||||
root@pve:~# iscsiadm -m discovery -t st -p 192.168.1.11:3260
|
||||
192.168.1.11:3260,1 iqn.2000-01.com.synology:DiskStation.Target-1.3e589efea3
|
||||
[fe80::211:32ff:fe20:eadd]:3260,1 iqn.2000-01.com.synology:DiskStation.Target-1.3e589efea3
|
||||
```
|
||||
2. 有IQN就可以用下列的命令連線與掛載:
|
||||
```
|
||||
iscsiadm -m node -T iqn.2000-01.com.synology:DiskStation.Target-1.3e589efea3 --op update --name node.session.auth.username --value=名字
|
||||
iscsiadm -m node -T iqn.2000-01.com.synology:DiskStation.Target-1.3e589efea3 --op update --name node.session.auth.password --value=密碼
|
||||
iscsiadm -m node -T iqn.2000-01.com.synology:DiskStation.Target-1.3e589efea3 -l #連線
|
||||
iscsiadm -m node -o update -n node.startup -v automatic #設定開機自動掛載
|
||||
```
|
||||
|
||||
## 增加NFS磁碟
|
||||
1. 先在Synology上開一個NFS disk,設定如下:
|
||||
![[Pasted image 20220506091522.png]]
|
||||
2. 再到Proxmox的 Datacenter->Storage->Add 來增加一個 *NFS*,設定如下
|
||||
![[Pasted image 20220506091624.png]]
|
||||
|
||||
### 更改NFS mount為soft
|
||||
1. 編輯`/etc/pve/storage.cfg`
|
||||
2. 做如下修改
|
||||
![[Pasted image 20220506095531.png]]
|
||||
|
||||
### 參考
|
||||
- [[經驗分享]Proxmox VE 採用 NFS 連接儲存的重點事項](http://blog.jason.tools/2019/02/pve-nfs-mount.html)
|
||||
|
||||
## 設定VM備份目錄
|
||||
如果將VM或LXC備份到某個目錄,先建立要備份的目錄:
|
||||
```shell
|
||||
mkdir -p /mnt/data/backup/
|
||||
```
|
||||
|
||||
再來用WEB UI,操作如下:
|
||||
![[Pasted image 20210129202041.png]]
|
||||
![[Pasted image 20210129202047.png]]
|
||||
|
||||
最後再到 Datacenter->Backups,建立一個scheule來備份就可以了:
|
||||
![[Pasted image 20210129202231.png]]
|
||||
|
||||
## 將資料備份到NAS
|
||||
1. 先在NAS開一個share folder跟一個帳號。
|
||||
![[Pasted image 20210202190402.png]]
|
||||
![[Pasted image 20210202190537.png]]
|
||||
2. Proxmox:到裡將剛剛新開的folder給掛載起來。
|
||||
![[Pasted image 20210202190640.png]]
|
||||
會跳出一個視窗,如下圖來填,記得**content**那一欄有4個要選。
|
||||
![[Pasted image 20210202190709.png]]
|
||||
3. Proxmox:到 Datacenter->Backup 新增一個排程。
|
||||
![[Pasted image 20210202190903.png]]
|
||||
一樣會跳出一個視窗,依需求來填,要注意的是**Storage**必須是前一步驟的**ID**,**Selection Mode**可以選擇**All**。
|
||||
![[Pasted image 20210202191150.png]]
|
||||
|
||||
參考:
|
||||
- [HASS + Proxmox: Automatic Backups to Synology NAS](https://kleypot.com/automatic-offline-backups/)
|
||||
|
||||
## 設定 UPS
|
||||
因為 UPS 的 USB 是連接在 NAS 上,所以Proxmox這邊必須要去monitor NAS那邊所回報的狀態,請確定NAS端有打開「啟用網路不斷電系統伺服器」。
|
||||
1. 安裝 nut:`apt-get install nut`
|
||||
2. 修改 `/etc/nut/nut.conf`,設定 `MODE=netclient`
|
||||
3. 修改 `/etc/nut/upsmon.conf`,加入一行:`MONITOR ups@<NAS_IP> 1 <NAS_Username> <NAS_UserPassword> slave`
|
||||
4. 開始 upsmon:`upsmon start`
|
||||
5. 用 `ps -ef | grep upsmon` 確認 upsmon是否執行:
|
||||
![[Pasted image 20220811145852.png|600]]
|
||||
6. 若正常,可以取回UPS的一些硬體資料,`upsc ups@<NAS_IP>`
|
||||
![[Pasted image 20220811150034.png|360]]
|
||||
|
||||
### 參考
|
||||
- [UPSMON(8)](https://networkupstools.org/docs/man/upsmon.html)
|
||||
- [不斷電系統 | DSM - Synology 知識中心](https://kb.synology.com/zh-tw/DSM/help/DSM/AdminCenter/system_hardware_ups?version=6)
|
||||
- [設定 Proxmox VE連動Synology的不斷電系統](https://cychien.tw/wordpress/2022/02/02/%E8%A8%AD%E5%AE%9A-proxmox-ve%E9%80%A3%E5%8B%95synology%E7%9A%84%E4%B8%8D%E6%96%B7%E9%9B%BB%E7%B3%BB%E7%B5%B1/)
|
||||
|
||||
## 更新
|
||||
### 加入更新來源
|
||||
編輯`/etc/apt/sources.list`,加入:
|
||||
```
|
||||
deb http://ftp.debian.org/debian bullseye main contrib
|
||||
deb http://ftp.debian.org/debian bullseye-updates main contrib
|
||||
|
||||
# PVE pve-no-subscription repository provided by proxmox.com,
|
||||
# NOT recommended for production use
|
||||
deb http://download.proxmox.com/debian/pve bullseye pve-no-subscription
|
||||
|
||||
# security updates
|
||||
deb http://security.debian.org/debian-security bullseye-security main contrib
|
||||
```
|
||||
|
||||
### 取消訂閱服務
|
||||
編輯`/etc/apt/sources.list.d/pve-enterprise.list`,把下面這行注釋掉:
|
||||
```
|
||||
deb https://enterprise.proxmox.com/debian/pve buster pve-enterprise
|
||||
```
|
||||
也就是變成:
|
||||
```
|
||||
#deb https://enterprise.proxmox.com/debian/pve buster pve-enterprise
|
||||
```
|
||||
|
||||
使用`apt update`來更新套件。
|
||||
使用`apt dist-upgrade`來升級系統版本。
|
||||
|
||||
## 重灌後要做的事情
|
||||
1. 建立ZFS pool。
|
||||
2. 確認S.M.A.R.T. 是否啟用,預設是啟用的。
|
||||
`smartctl -a /dev/<SDA_N>`
|
||||
1. 打開IOMMU
|
||||
2. 打開vm aware
|
||||
3. 增加NFS共享磁碟
|
||||
4. 排程備份
|
||||
5. 上傳安裝Windows需要的驅動ISO
|
||||
1. [Windows VirtIO Drivers](https://pve.proxmox.com/wiki/Windows_VirtIO_Drivers)
|
||||
6. 把常用的VM轉為template
|
||||
7. 安裝[Cockpit-Linux Server](https://pvecli.xuan2host.com/cockpit/), 讓您的PVE有更棒的圖形管理介面。
|
||||
|
||||
## 參考
|
||||
- [套件功能的更新(Proxmox update)](https://wiki.freedomstu.com/books/proxmox-ve-%E8%99%9B%E6%93%AC%E7%B3%BB%E7%B5%B1%E8%A8%98%E9%8C%84/page/%E5%A5%97%E4%BB%B6%E5%8A%9F%E8%83%BD%E7%9A%84%E6%9B%B4%E6%96%B0%EF%BC%88proxmox-update%EF%BC%89)
|
||||
- [裝完PVE後的11件必作清單 (中文翻譯)](https://www.youtube.com/watch?v=pY4Lm2Hoqik)
|
||||
- [Before I do anything on Proxmox, I do this first...](https://www.youtube.com/watch?v=GoZaMgEgrHw&t=0s)
|
||||
|
||||
# Trouble shooting
|
||||
- *Emergency mode*,表示開機失敗,請檢查`/etc/fstab`是不是有無法掛載的disk。
|
||||
|
||||
## 參考
|
||||
- [[Fix] Getting out of emergency mode : Proxmox](https://www.reddit.com/r/Proxmox/comments/hai75k/fix_getting_out_of_emergency_mode/)
|
||||
120
21.01. Linux/架站/Storj.md
Normal file
120
21.01. Linux/架站/Storj.md
Normal file
@@ -0,0 +1,120 @@
|
||||
# 步驟摘要
|
||||
1. 到[https://www.storj.io/host-a-node](https://www.storj.io/host-a-node)申請一個auth token。
|
||||
2. 用identify產生key。
|
||||
3. 認證 key。
|
||||
4. 備份 key
|
||||
5. Setup storj docker。
|
||||
6. Run storj docker。
|
||||
7. 更新
|
||||
|
||||
# 1. 申請一個auth token
|
||||
到[https://www.storj.io/host-a-node](https://www.storj.io/host-a-node),填入email,會產生一個伴隨email的隨機碼。
|
||||
![[Pasted image 20240114200907.png]]
|
||||
|
||||
這一串要記下來。
|
||||
|
||||
# 用identify產生key
|
||||
## 下載
|
||||
### Windows
|
||||
下載 `https://github.com/storj/storj/releases/latest/download/identity_windows_amd64.zip`
|
||||
|
||||
### Linux
|
||||
#### X86
|
||||
```bash
|
||||
curl -L https://github.com/storj/storj/releases/latest/download/identity_linux_amd64.zip -o identity_linux_amd64.zip
|
||||
unzip -o identity_linux_amd64.zip
|
||||
chmod +x identity
|
||||
sudo mv identity /usr/local/bin/identity
|
||||
```
|
||||
|
||||
#### ARM
|
||||
```bash
|
||||
curl -L https://github.com/storj/storj/releases/latest/download/identity_linux_arm.zip -o identity_linux_arm.zip
|
||||
unzip -o identity_linux_arm.zip
|
||||
chmod +x identity
|
||||
sudo mv identity /usr/local/bin/identity
|
||||
```
|
||||
|
||||
## 產生 identity
|
||||
這一步會跑很久,建議用CPU比較強的來跑,在樹莓派上面會跑很久。
|
||||
|
||||
### Windows
|
||||
`./identity.exe create storagenode`
|
||||
|
||||
### Linux
|
||||
`identity create storagenode`
|
||||
|
||||
# 認證 Key
|
||||
## 認證
|
||||
等一下的 `<email:characterstring>` 就是第1步說要記起來的那一串
|
||||
|
||||
### Windows
|
||||
`./identity.exe authorize storagenode <email:characterstring>`
|
||||
|
||||
### Linux
|
||||
`identity authorize storagenode <email:characterstring>`
|
||||
|
||||
## 確認
|
||||
### Windows
|
||||
`(sls BEGIN "$env:AppData\Storj\Identity\storagenode\ca.cert").count` 應該要return 2
|
||||
`(sls BEGIN "$env:AppData\Storj\Identity\storagenode\identity.cert").count` 應該要return 3
|
||||
|
||||
### Linux
|
||||
`grep -c BEGIN ~/.local/share/storj/identity/storagenode/ca.cert` 應該要return 2
|
||||
`grep -c BEGIN ~/.local/share/storj/identity/storagenode/identity.cert` 應該要return 3
|
||||
|
||||
# 備份 key
|
||||
Windows 上產生的 key 會放在 `%APPDATA%\Storj\Identity\storagenode`。
|
||||
Linux 上產生的 key 會放在 `~/.local/share/storj/identity/storagenode`。
|
||||
記得備份。
|
||||
|
||||
# Setup storj docker
|
||||
Do this **once**.
|
||||
```bash
|
||||
sudo docker run --rm -e SETUP="true" \
|
||||
--mount type=bind,source="/home/awin/storj/key",destination=/app/identity \
|
||||
--mount type=bind,source="/home/awin/storj/data",destination=/app/config \
|
||||
--name storagenode storjlabs/storagenode:latest
|
||||
```
|
||||
|
||||
# Run storj docker
|
||||
```bash
|
||||
sudo docker run -d --restart always --stop-timeout 300 \
|
||||
-p 28967:28967/tcp \
|
||||
-p 28967:28967/udp \
|
||||
-p 14002:14002 \
|
||||
-e WALLET="0x9Ce80345355Ad8C17991620E13d8423900CEDcd0" \
|
||||
-e EMAIL="awinhuang@gmail.com" \
|
||||
-e ADDRESS="storj.awin.one:28967" \
|
||||
-e STORAGE="1800GB" \
|
||||
--memory=800m \
|
||||
--log-opt max-size=50m \
|
||||
--log-opt max-file=10 \
|
||||
--sysctl net.ipv4.tcp_fastopen=3 \
|
||||
--mount type=bind,source=/home/awin/storj/key,destination=/app/identity \
|
||||
--mount type=bind,source=/extusb1/storj,destination=/app/config \
|
||||
--name storagenode storjlabs/storagenode:latest
|
||||
```
|
||||
|
||||
# 更新
|
||||
更新 node 可以選擇用 docker 裝[storjlabs/watchtower](https://hub.docker.com/r/storjlabs/watchtower/tags) ,或是手動更新
|
||||
|
||||
## watchtower
|
||||
```shell
|
||||
sudo docker pull storjlabs/watchtower
|
||||
sudo docker run -d --restart=always --name watchtower -v /var/run/docker.sock:/var/run/docker.sock storjlabs/watchtower storagenode watchtower --stop-timeout 300s
|
||||
```
|
||||
|
||||
等 [[Watchtower|Watchtower]] 跑起來之後,可以用 `sudo docker exec -it storagenode /app/dashboard.sh` 來即時觀察執行流量。
|
||||
|
||||
## 手動
|
||||
```shell
|
||||
sudo docker stop -t 300 storagenode
|
||||
sudo docker rm storagenode
|
||||
sudo docker pull storjlabs/storagenode:latest
|
||||
```
|
||||
|
||||
# 參考
|
||||
- [Step 2. Get an Authorization Token - Storj Docs](https://docs.storj.io/node/get-started/auth-token)
|
||||
- [Step 5. Create an Identity - Storj Docs](https://docs.storj.io/node/get-started/identity)
|
||||
- [Install storagenode on Raspberry Pi3 or higher version – Storj](https://support.storj.io/hc/en-us/articles/360026612332-Install-storagenode-on-Raspberry-Pi3-or-higher-version)
|
||||
25
21.01. Linux/架站/_Server Map.canvas
Normal file
25
21.01. Linux/架站/_Server Map.canvas
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"nodes":[
|
||||
{"id":"c910b905ac74e6ac","type":"group","x":20,"y":-700,"width":660,"height":860,"label":"Dockers"},
|
||||
{"id":"07f9200cb8cda96b","type":"group","x":340,"y":-360,"width":320,"height":362,"label":"grafana"},
|
||||
{"id":"6156176d915b8a66","type":"group","x":340,"y":-640,"width":320,"height":220,"label":"Nextcloud"},
|
||||
{"id":"f33aa20a0c8167ec","type":"text","text":"### blog\n- \"8010:80\"","x":40,"y":-445,"width":280,"height":90},
|
||||
{"id":"7ac25f505df8f886","type":"text","text":"### portainer\n- 8000:8000\n- 2443:9443","x":40,"y":-560,"width":280,"height":100},
|
||||
{"id":"f68bc5941384884f","type":"text","text":"### nginx-certbot\n- 80:80\n- 443:443","x":40,"y":-680,"width":280,"height":100},
|
||||
{"id":"daa7f9a1b63e3a74","type":"text","text":"### nextcloud\n- 8080:80","x":360,"y":-620,"width":280,"height":80},
|
||||
{"id":"5f777bb386a0b8aa","type":"text","text":"### collabora\n- 8081:9980","x":360,"y":-525,"width":280,"height":85},
|
||||
{"id":"8d78e0acaa9616d5","type":"text","text":"### adguardhome\n- \"53:53/tcp\"\n- \"53:53/udp\"\n- \"3000:3000/tcp\"\n- \"8050:80/tcp\"","x":40,"y":-120,"width":280,"height":160},
|
||||
{"id":"41ec11c5704a134c","type":"text","text":"### freshrss\n- \"8070:1200\"","x":40,"y":60,"width":280,"height":80},
|
||||
{"id":"5f8a89afeef02f38","type":"text","text":"### openspeedtest\n- '8093:3000'\n- '8094:3001'","x":360,"y":35,"width":280,"height":105},
|
||||
{"id":"4b08c3fa2d3fe2cf","type":"text","text":"### gitea\n- \"8020:3000\"\n- \"2244:22\"","x":40,"y":-340,"width":280,"height":100},
|
||||
{"id":"b112aedbb6b5ce68","type":"text","text":"### filebrowser\n- 8040:80","x":40,"y":-220,"width":280,"height":80},
|
||||
{"id":"5c65ba78253b985b","type":"text","text":"### AWIN-PC2\n`192.168.1.24`","x":-240,"y":-260,"width":180,"height":80,"color":"2"},
|
||||
{"id":"c0c54f342022f6db","type":"text","text":"### grafana\n- \"8082:3000\"","x":360,"y":-340,"width":280,"height":75},
|
||||
{"id":"520020bcf81de93b","type":"text","text":"### prometheus\n- \"8083:9090\"","x":360,"y":-240,"width":280,"height":90},
|
||||
{"id":"59d436dadba47e3c","type":"text","text":"### node_exporter\n- \"8084:9100\"","x":360,"y":-120,"width":280,"height":102},
|
||||
{"id":"ae5e0200e802c0ff","x":720,"y":-640,"width":250,"height":100,"type":"text","text":"### Minecraft\n- 8100"}
|
||||
],
|
||||
"edges":[
|
||||
{"id":"2155d66680f8b2ba","fromNode":"5c65ba78253b985b","fromSide":"right","toNode":"c910b905ac74e6ac","toSide":"left"}
|
||||
]
|
||||
}
|
||||
52
21.01. Linux/架站/filebrowser.md
Normal file
52
21.01. Linux/架站/filebrowser.md
Normal file
@@ -0,0 +1,52 @@
|
||||
# docker-compose.yml
|
||||
```yml
|
||||
version: '3'
|
||||
services:
|
||||
file-browser:
|
||||
restart: always
|
||||
image: filebrowser/filebrowser:latest
|
||||
container_name: filebrowser
|
||||
user: 1000:1000
|
||||
ports:
|
||||
- 8040:80
|
||||
volumes:
|
||||
- /media/share:/srv
|
||||
- ./data/filebrowser.db:/database.db
|
||||
- ./data/settings.json:/.filebrowser.json
|
||||
- ./data/gafiled.png:/config/logo.png
|
||||
- ./data/branding:/branding
|
||||
security_opt:
|
||||
- no-new-privileges:true
|
||||
```
|
||||
|
||||
# 準備
|
||||
在 `docker compose up -d` 之前,需要先把檔案準備好。
|
||||
```shell
|
||||
touch data/filebrowser.db
|
||||
touch data/settings.json
|
||||
```
|
||||
|
||||
`data/settings.json` 的內容:
|
||||
```json
|
||||
{
|
||||
"port": 80,
|
||||
"baseURL": "",
|
||||
"address": "",
|
||||
"log": "stdout",
|
||||
"database": "/database.db",
|
||||
"root": "/srv"
|
||||
}
|
||||
```
|
||||
|
||||
# 登入
|
||||
預設的帳號密碼是`admin/admin`,記得要改掉。
|
||||
|
||||
# 問題
|
||||
因為Filebrowser會lock DB,所以docker在跑得時候會無法使用Filebrowser的command,所以需要先把docker停掉,然後用以下命令登入:
|
||||
```shell
|
||||
sudo docker run -it -v ./data/filebrowser.db:/database.db -v data/settings.json:/.filebrowser.json --entrypoint /bin/sh filebrowser/filebrowser
|
||||
```
|
||||
|
||||
# 參考
|
||||
- [Filebrowser Docker Installation | All about](https://bobcares.com/blog/filebrowser-installation-in-docker/)
|
||||
- [filebrowser/filebrowser: 📂 Web File Browser](https://github.com/filebrowser/filebrowser)
|
||||
26
21.01. Linux/架站/freshrss.md
Normal file
26
21.01. Linux/架站/freshrss.md
Normal file
@@ -0,0 +1,26 @@
|
||||
```yml
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
freshrss:
|
||||
image: linuxserver/Taipei:latest
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "8080:80"
|
||||
environment:
|
||||
TZ: Asia/Shanghai
|
||||
CRON_MIN: "*/60"
|
||||
PUID: 1000
|
||||
PGID: 1000
|
||||
volumes:
|
||||
- freshrss_data:/var/www/FreshRSS/data
|
||||
- freshrss_extensions:/var/www/FreshRSS/extensions
|
||||
|
||||
rsshub:
|
||||
image: diygod/rsshub:latest
|
||||
restart: unless-stopped
|
||||
expose:
|
||||
- "1200"
|
||||
environment:
|
||||
CACHE_EXPIRE: 3600
|
||||
```
|
||||
41
21.01. Linux/架站/minecraft.md
Normal file
41
21.01. Linux/架站/minecraft.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# `docker-compose.yml`
|
||||
|
||||
```yml
|
||||
services:
|
||||
minecraft:
|
||||
image: itzg/minecraft-server
|
||||
restart: unless-stopped
|
||||
tty: true
|
||||
stdin_open: true
|
||||
ports:
|
||||
- "8100:25565"
|
||||
environment:
|
||||
MEMORY: "16G" # 設定分配16GB RAM
|
||||
JVM_OPTS: "-XX:MaxRAMPercentage=75" # 設定JVM啟動參數,設定最多使用75% RAM
|
||||
|
||||
EULA: "TRUE" # 自動同意伺服器的EULA
|
||||
TYPE: "PAPER"
|
||||
VERSION: "1.19.4"
|
||||
MAX_BUILD_HEIGHT: 384
|
||||
VIEW_DISTANCE: 12
|
||||
MODE: "creative"
|
||||
ENABLE_WHITELIST: "TRUE"
|
||||
ENFORCE_WHITELIST: "TRUE"
|
||||
OPS: ""
|
||||
ONLINE_MODE: "TRUE"
|
||||
SERVER_NAME: "Crazy Smile City"
|
||||
MOTD: "Today is a good day~~~"
|
||||
ICON: ""
|
||||
OVERRIDE_SERVER_PROPERTIES: "TRUE"
|
||||
TZ:
|
||||
- /etc/localtime:/etc/localtime:ro
|
||||
- /etc/timezone:/etc/timezone:ro
|
||||
volumes:
|
||||
- ./data:/data
|
||||
```
|
||||
|
||||
# 參考
|
||||
- [如何在Ubuntu系統以Docker架設Minecraft Java版伺服器 · Ivon的部落格](https://ivonblog.com/posts/minecraft-java-edition-server-docker/)
|
||||
- [Docker Minecraft 开服记](https://blog.l3zc.com/2023/06/build-a-mc-server-with-docker/#%E8%BF%9B%E4%B8%80%E6%AD%A5%E8%B0%83%E6%95%B4)
|
||||
- [Variables - Minecraft Server on Docker (Java Edition)](https://docker-minecraft-server.readthedocs.io/en/latest/variables/#server)
|
||||
-
|
||||
Reference in New Issue
Block a user