Skip to content

Commit baf1ba4

Browse files
committed
feat: add rebuild-odek-telegram skill
Creates a new project skill for rebuilding and restarting the odek Telegram bot after a new release is created. The skill covers: 1. Pulling latest code and tags from the repo 2. Building the binary with go build 3. Restarting the running bot via SIGHUP (re-exec), systemctl, or manual kill + restart 4. Verification steps to confirm the bot is operational Trigger keywords: release, tag, deploy, update, build, telegram, bot, restart, rebuild Stored at .odek/skills/rebuild-odek-telegram/SKILL.md
1 parent e2e83fa commit baf1ba4

1 file changed

Lines changed: 99 additions & 0 deletions

File tree

  • .odek/skills/rebuild-odek-telegram
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
---
2+
name: rebuild-odek-telegram
3+
description: Rebuild the odek binary and restart the Telegram bot after a new release is created
4+
version: 1.0.0
5+
author: odek
6+
auto_load: false
7+
odek:
8+
trigger:
9+
topic: release tag deploy update build telegram bot restart
10+
action: rebuild restart deploy update
11+
---
12+
13+
# Rebuild & Restart odek Telegram Bot
14+
15+
After a new release is tagged and published (e.g., via `git tag` and `gh release create`), the odek binary must be rebuilt and the running Telegram bot process restarted for the changes to take effect.
16+
17+
## Overview
18+
19+
This skill automates the post-release steps:
20+
1. Pull the latest code from the repository
21+
2. Build the odek binary
22+
3. Restart the running Telegram bot process
23+
24+
## Steps
25+
26+
### 1. Pull latest code
27+
28+
```bash
29+
cd /root/projects/odek
30+
git pull origin main --tags
31+
```
32+
33+
Verify the new tag is present:
34+
```bash
35+
git tag --sort=-v:refname | head -3
36+
```
37+
38+
### 2. Rebuild the binary
39+
40+
```bash
41+
go build -o odek ./cmd/odek
42+
```
43+
44+
Verify the build succeeded and check the version:
45+
```bash
46+
./odek version
47+
```
48+
49+
### 3. Restart the Telegram bot
50+
51+
The odek Telegram bot handles restart via SIGHUP signal (implemented in `cmd/odek/telegram.go`). Sending SIGHUP causes the bot to re-exec itself, picking up the new binary.
52+
53+
Find the running bot process:
54+
```bash
55+
pgrep -f "odek telegram" || ps aux | grep "odek telegram" | grep -v grep
56+
```
57+
58+
Send SIGHUP to trigger a graceful restart:
59+
```bash
60+
pkill -SIGHUP -f "odek telegram" 2>/dev/null || kill -HUP $(pgrep -f "odek telegram")
61+
```
62+
63+
If running under systemd:
64+
```bash
65+
systemctl restart odek-telegram
66+
```
67+
68+
### 4. Verify the restart
69+
70+
Check that the bot process restarted successfully:
71+
```bash
72+
pgrep -f "odek telegram"
73+
```
74+
75+
Monitor logs for successful startup:
76+
```bash
77+
# If using log file:
78+
tail -f ~/.odek/telegram.log
79+
80+
# If logging to stderr/journald:
81+
journalctl -u odek-telegram --since "1 minute ago" # systemd
82+
```
83+
84+
## Pitfalls
85+
86+
- **Build errors**: If `go build` fails, check for compilation errors and fix before restarting
87+
- **Process not found**: The bot may be running under a different name or user (check with `ps aux | grep odek`)
88+
- **SIGHUP not supported**: If the running bot is an older version that doesn't support SIGHUP restart, you may need to kill the process and start it manually:
89+
```bash
90+
pkill -f "odek telegram"
91+
nohup ./odek telegram &
92+
```
93+
- **Permission denied**: If built as one user and running as another, ensure the binary is executable by the target user (`chmod +x odek`)
94+
95+
## Verification
96+
97+
After restarting, send a test message to the bot in Telegram to confirm it's operational:
98+
- Send `/start` to verify the bot responds
99+
- Send a simple task like `/help` to verify agent functionality

0 commit comments

Comments
 (0)