Skip to content

docs: README を仕様書化し、docs を種類別に整理 - #5

Open
makoto-kamimura wants to merge 3 commits into
masterfrom
docs/align-doc-structure
Open

makoto-kamimura wants to merge 3 commits into
masterfrom
docs/align-doc-structure

Conversation

@makoto-kamimura

@makoto-kamimura makoto-kamimura commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

概要

README を「仕様書の本体」にし、docs/ を種類ごとのフォルダに分けました。あわせて、本番で動いている運用スクリプト(ファイルのバックアップ・運用ダイジェスト・n8n)を取り込み、このリポジトリを「セキュアな WordPress を簡易展開するソース」に絞るため、デモ固有・個人向けの部分は git 管理外へ分けています。

変更内容

1. docs: README の構成を揃える(1886da0)

  • README を コンセプト → 第1部 概要説明 → 第2部 技術説明 → 付録(決定事項 D1〜D10・未決事項 Q1〜Q5)の構成に書き直した。旧 design.md の WordPress スタック部分を統合
  • -f docker-compose.demo.yml 前提のコマンドと、存在しない doc/... へのリンクを削除
  • docs/ を design / runbooks / incidents / automation / tasks に分けた。中身は引き続き git 管理外で、追跡するのは docs/README.md と各フォルダの .gitkeep だけ(.gitignore を /docs/** + 例外に変更)

2. feat: 運用スクリプトと n8n(f219998)

  • backup-files.sh + cron.d/files-backup: uploads を毎日 tar.gz で保存。追加の対象は git 管理外の platform/backup-files.targets から読む
  • ops-digest.sh: WAF・fail2ban・証明書・アクセス・バックアップ・ディスクを 1 通にまとめる。デモ DB の行は置き場所があるときだけ出す
  • n8n(profile=automation、127.0.0.1 のみ): MCP ツール・毎朝のダイジェスト・WAF 閾値アラート
  • CI の Trivy に n8n のイメージを追加

3. テーマを同梱しない(5a0011d)

  • テーマのサブモジュールを外した。テーマは wp-content/themes/ に git 管理外で置き、.env の THEME_SLUG(.env.example に追加)で initial-setup.sh が有効にする。未設定ならテーマの切り替えをスキップする
  • テーマ独自の REST API 向けの WAF 除外(id 9500100)を、git 管理外の REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.local.conf に移した
  • README の同梱テーマの説明を、テーマの置き方の説明に置き換えた

git 管理外へ分けたもの

内容 置き場所
デモ用サブドメイン・デモバナー webhook・自サイトのドメイン固定の WAF 除外 nginx_data/modsec-rules/REQUEST-900-EXCLUSION-RULES-BEFORE-CRS.local.conf(overlay でマウント)
デモバナー用・ブログ自動投稿用・テーマ用の環境変数 docker-compose.demo.yml(overlay)
ブログ自動投稿の n8n ワークフロー 3 本 .gitignore に列挙
デモのボリュームのバックアップ対象 platform/backup-files.targets
デモ・ブログ用の .env.example のキー ローカルの docs に控えた
テーマ本体とテーマ向けの WAF 除外 wp-content/themes/・*.local.conf

本番で行った操作

  • WAF 除外ルールを 2 ファイル間で移し(inode を保ったまま書き換え)、nginx -t の後に reload した。テーマ API への攻撃風の本文は前後とも WAF を通過(400)、他のパスは前後とも 403、トップは 200 で変わらないことを確認した
  • テーマは本番のディスクにそのまま残り、.env に THEME_SLUG を追記した(compose は参照しないので再作成なし)
  • nginx を再作成した(local の WAF 除外をマウントするため。数秒停止)。事前に使い捨てコンテナで nginx -t を通した
  • 再作成の前後で全ドメインの HTTP ステータスが同じであることを確認した
  • local ファイル側の除外ルールが効いていることを確認した(トップページが「PostgreSQL」の文字列を含んだまま最後まで配信される)
  • n8n・wordpress の実効設定は、環境変数の移動の前後で同じ(compose の config hash で確認)なので、再作成していない

確認

  • docker compose config --quiet(.env.example から。本体 + admin/stats/automation の profile 込み)
  • ShellCheck(platform/scripts 全体、CI と同じ -e SC1091)
  • README・docs/README.md・n8n/README.md 内のアンカーと相対リンクがすべて解決する
  • backup-files.sh の対象が変更前と同じ 5 件に解決される / ops-digest.sh の出力が変わらない
  • 追加する差分に、ホスト名・IP・トークンなどの秘匿値が含まれていない
  • docker compose config(.env.example と本番の .env の両方)が通る
  • ShellCheck(initial-setup.sh、-e SC1091)
  • 追跡ファイルに、非公開のテーマ・アプリの名称が残っていない

- backup-files.sh + cron: archive wp-content/uploads daily; extra targets
  (e.g. overlay apps' volumes) come from the untracked platform/backup-files.targets
- ops-digest.sh: one daily summary of WAF / fail2ban / certificates / access /
  backups / disk, with items that need action listed first
- n8n (profile=automation, 127.0.0.1 only): MCP tools for the report scripts,
  morning digest mail and hourly WAF threshold alert
- keep server-specific pieces out of the repo: domain-specific WAF exclusions
  (*.local.conf), personal blog auto-post workflows and their env vars now
  live in the untracked overlay
- scan the n8n image with Trivy
- README.md becomes the spec body: concept, Part 1 overview (features,
  services, basic flows, theme, roadmap), Part 2 technical (stack, system
  diagram, quick start, network, volumes, implementation notes,
  non-functional requirements) and an appendix with decisions and open
  questions; merges the WordPress-stack parts of the former design notes
- drop demo-specific commands and links to untracked docs from README
- docs/ is organized by kind (design / runbooks / incidents / automation /
  tasks); only docs/README.md and the .gitkeep files are tracked, contents
  stay out of this public repo
@makoto-kamimura makoto-kamimura changed the title docs: docker_time_management に揃えて README を仕様書化し、docs を種類別に整理 docs: README を仕様書化し、docs を種類別に整理 Sep 29, 2026
- drop the theme submodule; themes now live untracked under
  wp-content/themes/ like other server-specific pieces
- initial-setup.sh activates THEME_SLUG from .env and skips when unset
- move the theme's REST API WAF exclusion to the untracked *.local.conf
- README: describe how to bring your own theme instead of the bundled one
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant