Oracle Cloud VPS 移行マニュアル¶
📁 docs/bot-scheduler/artifact/20260313_OracleCloud_VPS移行マニュアル.md
アーキテクチャ概要¶
graph TB
subgraph "Oracle Cloud Always Free VPS"
subgraph "systemd 常駐サービス"
BOT["🤖 MyLab Discord Bot<br/>mylab-discord-bot.service"]
end
subgraph "cron 定期実行"
TS["🔄 TaskSync<br/>毎15分"]
TM["📋 Task Monitor<br/>07:00 / 21:00 JST"]
DS["📊 Daily Summary<br/>21:30 JST"]
QC["📝 Qiita Collector<br/>08:00 JST"]
ZC["📚 Zenn Likes Digest<br/>08:30 JST"]
NC["📓 Note Collector<br/>09:00 JST"]
TC["💻 TechBlog Collector<br/>09:30 JST"]
YC["▶️ YouTube Digest<br/>10:00 JST"]
PC["🔍 Prompt Collector<br/>10:30 JST"]
BC["🐦 Buzz Collector<br/>08:00 JST"]
end
end
subgraph "外部サービス"
GH["GitHub Issues/Projects"]
GT["Google Tasks"]
DC["Discord"]
GS["Google Sheets"]
end
subgraph "Windows PC(開発のみ)"
DEV["Claude Code / 開発作業"]
end
BOT <--> DC
TS <--> GH
TS <--> GT
TM --> DC
DS --> DC
QC --> GS
ZC --> GS
NC --> GS
TC --> GS
YC --> GS
PC --> GS
BC --> GS
DEV -->|git push| GH
GH -->|git pull| BOT
VPS接続情報¶
| 項目 | 値 |
|---|---|
| IPアドレス | 168.138.42.7 |
| ユーザー | ubuntu |
| SSHキー(WSL) | /home/kazuma/.ssh/mylab_vps |
| リージョン | ap-osaka-1(大阪) |
| シェイプ | VM.Standard.A1.Flex(4OCPU/24GB) |
| OS | Ubuntu 22.04 LTS (aarch64) |
SSH接続方法¶
# WSLから接続
wsl -e bash -c "ssh -i /home/kazuma/.ssh/mylab_vps ubuntu@168.138.42.7"
# PowerShellから(WSL経由)
wsl -- ssh -i /home/kazuma/.ssh/mylab_vps ubuntu@168.138.42.7
サービス管理¶
Discord Bot(systemd)¶
# 状態確認
sudo systemctl status mylab-discord-bot
# 再起動
sudo systemctl restart mylab-discord-bot
# ログ確認(リアルタイム)
journalctl -fu mylab-discord-bot
# 停止 / 起動
sudo systemctl stop mylab-discord-bot
sudo systemctl start mylab-discord-bot
cron タスク¶
# crontab確認
crontab -l
# crontab編集
crontab -e
# ログ確認
ls ~/MyLab/logs/cron/
tail -f ~/MyLab/logs/cron/task-sync.log
tail -f ~/MyLab/logs/cron/buzz-collector.log
コードの更新方法¶
VPSは自動的にコードをpullしません。Windows側でpushした後、以下を実行:
または、deployスクリプトを使用:
cron スケジュール一覧(JST)¶
| タスク | 時刻 | ログファイル |
|---|---|---|
| TaskSync | 毎15分 | cron/task-sync.log |
| Task Monitor(朝) | 07:00 | cron/task-monitor-morning.log |
| Task Monitor(夜) | 21:00 | cron/task-monitor-evening.log |
| Daily Summary | 21:30 | cron/daily-summary.log |
| Qiita Collector | 08:00 | cron/qiita-collector.log |
| Zenn Likes Digest | 08:30 | cron/zenn-likes-digest.log |
| Note Collector | 09:00 | cron/note-collector.log |
| TechBlog Collector | 09:30 | cron/techblog-collector.log |
| YouTube Digest | 10:00 | cron/youtube-digest.log |
| Prompt Collector | 10:30 | cron/prompt-collector.log |
| Buzz Collector | 08:00 | cron/buzz-collector.log |
| ログローテーション | 毎週日曜 04:00 UTC | - |
Credentials配置場所¶
~/MyLab/Credentials/
├── mylab_discord_bot.json # Discord Botトークン
├── anthropic_learn_bot.json # Anthropic APIキー
├── github_pat.json # GitHub PAT
├── task_sync_oauth_token.json # Google Tasks OAuth
├── discord/bot.json
├── github/api.json
├── google/
│ ├── gcp-oauth.keys.json
│ └── oauth_client_secret.json
└── anthropic/learn_bot.json
トラブルシューティング¶
Botが起動しない¶
cronが実行されない¶
ディスク容量確認¶
VPSの負荷確認¶
OCI コンソールでの確認¶
- インスタンス状態: コンピュート → インスタンス → mylab-vps
- CPU/メモリ使用率: インスタンス詳細 → モニタリングタブ
- セキュリティリスト: ネットワーキング → VCN → セキュリティ・リスト
- コスト確認: 右上メニュー → 請求とコスト管理