Edit action config & Commands.md
All checks were successful
Deploy / deploy (push) Successful in 58s
All checks were successful
Deploy / deploy (push) Successful in 58s
This commit is contained in:
@@ -11,5 +11,6 @@ jobs:
|
||||
host: "100.114.118.48"
|
||||
username: "root"
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
passphrase: ${{ secrets.SSH_PRIVATE_KEY_PASSPHRASE }}
|
||||
command_timeout: 3h
|
||||
script: bash /root/maria/script/action/blog.sh
|
||||
@@ -6,7 +6,20 @@ level: classified
|
||||
|
||||
## 初始化
|
||||
|
||||
Maria:
|
||||
### Maria
|
||||
|
||||
**推送 GitHub 私钥**:
|
||||
|
||||
```bash
|
||||
# 在 CatTomServer1 处执行
|
||||
rsync -avP /home/cattom/.ssh/cattomgithub [server_id]:/root/.ssh/
|
||||
# 指定用户名与 IP
|
||||
rsync -avP /home/cattom/.ssh/cattomgithub root@[server_ip]:/root/.ssh/
|
||||
# 指定端口、私钥、用户名和 IP
|
||||
rsync -avP -e 'ssh -p 25800 -i /home/cattom/.ssh/Maria' /home/cattom/.ssh/cattomgithub root@[server_ip]:/root/.ssh/
|
||||
```
|
||||
|
||||
**克隆 Maria 仓库**:
|
||||
|
||||
```bash
|
||||
git config --global credential.helper store && git clone https://github.com/cattomgithub/maria.git
|
||||
@@ -16,21 +29,28 @@ Maria:
|
||||
|
||||
## 修改 SSH 配置
|
||||
|
||||
首先,启动 SSH 服务:
|
||||
**启动 SSH 服务**:
|
||||
|
||||
```bash
|
||||
sudo systemctl enable ssh && sudo systemctl restart ssh && sudo systemctl status ssh
|
||||
```
|
||||
|
||||
接着,生成并配置 SSH 密钥。进入 CatTomServer3-1 的终端,然后执行:
|
||||
**配置 SSH 密钥**: 在 CatTomServer1 终端执行
|
||||
|
||||
```bash
|
||||
ssh-keygen -m PEM -t rsa -b 4096 -C "[username]@[server_ip]" -f ~/.ssh/[server_name]
|
||||
|
||||
ssh-copy-id -p 25800 -i /home/cattom/.ssh/[server_name].pub root@[server_ip]
|
||||
# Maria
|
||||
ssh-copy-id -i /home/cattom/.ssh/Maria.pub root@[server_ip]
|
||||
# HomeLab
|
||||
ssh-copy-id -i /home/cattom/.ssh/CatTomServer.pub cattom@[server_ip]
|
||||
# 指定端口
|
||||
ssh-copy-id -p 25800 ...
|
||||
```
|
||||
|
||||
最后,修改 `/etc/ssh/sshd_config`:
|
||||
**修改 SSH 配置**:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/ssh/sshd_config
|
||||
```
|
||||
|
||||
- Port 22 → **Port 25800**
|
||||
- PermitRootLogin **prohibit-password** (取消该行注释)
|
||||
@@ -243,21 +263,17 @@ lsmod | grep bbr
|
||||
|
||||
若出现 `tcp_bbr` 的输出,说明开启成功。
|
||||
|
||||
## 配置 SSH Action
|
||||
## 配置 Actions
|
||||
|
||||
### GitHub Actions
|
||||
|
||||
[cattomgithub/maria - Settings - Secrets - Actions](https://github.com/cattomgithub/maria/settings/secrets/actions)
|
||||
转至 [cattomgithub/maria - Settings - Secrets - Actions](https://github.com/cattomgithub/maria/settings/secrets/actions)
|
||||
|
||||
修改以下配置项:
|
||||
|
||||
- SSH_HOSTS: foo,bar
|
||||
|
||||
服务器需配置 GitHub Actions Key,进入 CatTomServer3-1 的终端,执行:
|
||||
|
||||
```bash
|
||||
ssh-copy-id -f -p 25800 -i /home/cattom/.ssh/maria-github-actions-key.pub [server_id]
|
||||
```
|
||||
|
||||
[Ref: 用于 GitHub Actions 的 SSH](https://github.com/appleboy/ssh-action/blob/master/README.zh-cn.md)
|
||||
### Gitea Actions
|
||||
|
||||
## NFS 配置
|
||||
|
||||
@@ -285,3 +301,28 @@ lsmod | grep bbr
|
||||
# Or
|
||||
sudo docker exec -it [container_name] /bin/sh
|
||||
```
|
||||
|
||||
## rsync 同步文件
|
||||
|
||||
rsync 参数解释:
|
||||
|
||||
- `-a`: 归档模式,保留文件的权限、时间戳、软链接、属主和属组。
|
||||
- `-v`: 详细模式,输出同步过程中的文件名。
|
||||
- `-z`: 在传输时进行压缩。
|
||||
- `-P`: 等同于 `--partial` `--progress`。`--progress` 会显示每个文件的传输进度,`--partial` 允许断点续传。
|
||||
|
||||
rsync 对路径末尾的斜杠敏感:
|
||||
|
||||
- `/local/source/folder/` (有斜杠): 只同步文件夹里面的**内容**到目标目录。
|
||||
- `/local/source/folder` (无斜杠): 将 `folder` 这个**目录本身连同里面的内容**,整个放入目标目录中。
|
||||
|
||||
``` bash
|
||||
# 将本地文件夹推送到远程服务器 (Push)
|
||||
rsync -avzP --delete /local/source/folder/ [server_id]:/remote/destination/folder/
|
||||
# 从远程服务器拉取文件夹到本地 (Pull)
|
||||
rsync -avzP --delete [server_id]:/local/source/folder/ /remote/destination/folder/
|
||||
```
|
||||
|
||||
## 参考
|
||||
|
||||
[用于 GitHub Actions 的 SSH](https://github.com/appleboy/ssh-action/blob/master/README.zh-cn.md)
|
||||
Reference in New Issue
Block a user