Skip to content

Commit 953bc48

Browse files
committed
cleanup and write CLAUDE.md better
1 parent 4d4f652 commit 953bc48

3 files changed

Lines changed: 45 additions & 12 deletions

File tree

.sops.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@ _:
44
- &aster-void age1j647p0v0w4yjae97agk709smzjgyyl8ft4jp35hyh2ffeaj9wg9qfu3pe7
55

66
creation_rules:
7-
- path_regex: bots/auto-moderator/sops2.env
8-
age:
9-
- *deploy
107
- path_regex: bots/auto-moderator/*
118
age:
129
- *deploy

CLAUDE.md

Lines changed: 45 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,51 @@
1-
- `sops -d` を実行しない。コマンドを実行する必要がある場合は `sops exec-env` で直接実行する
2-
- `.age-key` を読まない
1+
# Discord-bots
32

4-
## コマンド実行方法
3+
Discord (など) で定期実行などされるBotのmonorepo。
54

6-
```bash
7-
eval "$(direnv export bash)" && <command>
8-
```
5+
## Bot 一覧
6+
7+
- bots/auto-moderator: 運営タスクリマインド (毎日)
8+
- bots/gsc-report: Google の検索パフォーマンス通知 (毎週)
9+
- bots/asakatsu-bot: 朝活確認 (毎日)
10+
- bots/joji-bot: Youtube から RSS で最新動画取得 (毎日)
11+
12+
詳細は ./rollcron.yaml で。
13+
14+
## 機密情報
15+
16+
### 配置・権限
17+
18+
sops を使う場合:
19+
20+
- SOPS ファイル: `bots/BOT/sops.env`
21+
- 暗号化ルール: `./.sops.yaml`
22+
23+
ローカル,デプロイ読み取りチェーン: `run.sh` -> `sops exec-env` -> `bots/BOT/sops.env` + (`.age-key` | `~/.config/sops/age/keys.txt`)
24+
25+
sops を使わない場合:
26+
27+
- ローカル読み取りチェーン: `run.sh` -> `bots/BOT/.env`
28+
- デプロイ読み取りチェーン: `rollcron.yaml` -> `~/run/discord-bots/BOT/env` (サーバーに `bots/BOT/.env` は存在しないので二重読みはない)
29+
30+
### 管理ルール
31+
32+
- `.env` を読まない。`sops -d` を実行しない。`.age-key` を読まない。サーバ上の機密ファイルを読まない。
33+
- もし確認する必要がある場合はコンテキストに入らないような仕組みでやる: `cat .env | cut -d= -f1` やハッシュ、 `wc`、コマンド直接実行など
34+
35+
## ファイル・インフラ配置 (.git 外)
36+
37+
### ローカルファイル配置
38+
39+
- `.age-key` - ローカル復号用
40+
41+
### coolify.utcode.net
42+
43+
- `/home/deploy/.config/sops/age/keys.txt` - デプロイ時復号用
944

10-
## SOPS検証方法
45+
## コマンド
1146

1247
```bash
13-
sops exec-env path/to/sops.env 'echo success!'
48+
eval "$(direnv export bash)" && COMMAND
49+
sops exec-env path/to/sops.env 'echo success!' # sops 鍵検証
50+
ssh USER@coolify.utcode.net "sudo -u deploy bash -c 'COMMAND'" # デプロイ先で操作
1451
```

rollcron.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ jobs:
1010
schedule: noon
1111
run: ./run.sh
1212
working_dir: bots/auto-moderator
13-
env_file: ~/run/discord-bots/auto-moderator/env
1413
log: ~/run/discord-bots/auto-moderator/log
1514

1615
gsc-report:

0 commit comments

Comments
 (0)