Skip to content

Commit 59f7898

Browse files
gmrclaude
andcommitted
Add imbi-slackbot service dispatch to the container entrypoint
- Add a 'slackbot' target to env validation and startup (serves on :8004). - In 'all' mode the bot starts without requiring its vars: it auto-enables only when ANTHROPIC_API_KEY and the SLACK_* tokens are present, so forcing them would break Slack-less deployments. - The standalone 'slackbot' service requires SLACK_APP_TOKEN, SLACK_BOT_TOKEN, ANTHROPIC_API_KEY, and POSTGRES_URL (it opens the graph), since running it without them is pointless. - List slackbot in the unknown-service error messages. - Document the intentional word-splitting on the sentry-cli upload args. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7d0271b commit 59f7898

1 file changed

Lines changed: 25 additions & 2 deletions

File tree

entrypoint.sh

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ require_gateway_vars() {
3838
require_var POSTGRES_URL "PostgreSQL connection URL (e.g. postgresql://user:pass@host/db)"
3939
}
4040

41+
require_slackbot_vars() {
42+
require_var SLACK_APP_TOKEN "Slack app-level token for socket mode"
43+
require_var SLACK_BOT_TOKEN "Slack bot OAuth token"
44+
require_var ANTHROPIC_API_KEY "Anthropic API key (bot stays disabled without it)"
45+
require_var POSTGRES_URL "PostgreSQL connection URL (e.g. postgresql://user:pass@host/db)"
46+
}
47+
4148
check_errors() {
4249
if [ -n "$errors" ]; then
4350
echo "ERROR: Missing required environment variables for $1:" >&2
@@ -75,6 +82,9 @@ case "$IMBI_SERVICE" in
7582
require_var CLICKHOUSE_URL "ClickHouse connection URL (e.g. clickhouse+http://default:password@clickhouse:8123/imbi)"
7683
require_var IMBI_AUTH_ENCRYPTION_KEY "Fernet encryption key for sensitive data"
7784
require_gateway_vars
85+
# Slack bot is optional in 'all' mode: it auto-enables only when
86+
# ANTHROPIC_API_KEY and the SLACK_* tokens are present, so its vars
87+
# are not required here.
7888
;;
7989
api)
8090
require_api_vars
@@ -88,9 +98,12 @@ case "$IMBI_SERVICE" in
8898
mcp)
8999
# No required vars currently
90100
;;
101+
slackbot)
102+
require_slackbot_vars
103+
;;
91104
*)
92105
echo "ERROR: Unknown service '$IMBI_SERVICE'" >&2
93-
echo "Valid values: all, api, assistant, gateway, mcp" >&2
106+
echo "Valid values: all, api, assistant, gateway, mcp, slackbot" >&2
94107
exit 1
95108
;;
96109
esac
@@ -119,6 +132,7 @@ upload_sourcemaps() {
119132
if [ -n "${SENTRY_URL:-}" ]; then
120133
args="$args --url $SENTRY_URL"
121134
fi
135+
# shellcheck disable=SC2086 # $args holds multiple flags; intentional word-splitting
122136
sentry-cli sourcemaps upload $args /srv/ui/assets/
123137
echo "Source maps uploaded."
124138
}
@@ -174,6 +188,11 @@ start_mcp() {
174188
imbi-mcp serve --transport streamable-http --host 0.0.0.0 --port 8001 &
175189
}
176190

191+
start_slackbot() {
192+
echo "Starting imbi-slackbot on :8004..."
193+
imbi-slackbot serve --host 0.0.0.0 --port 8004 &
194+
}
195+
177196
start_caddy() {
178197
echo "Starting caddy reverse proxy on :8080..."
179198
caddy run --config /etc/caddy/Caddyfile &
@@ -185,6 +204,7 @@ case "$IMBI_SERVICE" in
185204
start_assistant
186205
start_gateway
187206
start_mcp
207+
start_slackbot
188208
start_caddy
189209
;;
190210
api)
@@ -199,9 +219,12 @@ case "$IMBI_SERVICE" in
199219
mcp)
200220
exec imbi-mcp serve --transport streamable-http --host 0.0.0.0 --port 8001
201221
;;
222+
slackbot)
223+
exec imbi-slackbot serve --host 0.0.0.0 --port 8004
224+
;;
202225
*)
203226
echo "ERROR: Unknown service '$IMBI_SERVICE'" >&2
204-
echo "Valid values: all, api, assistant, gateway, mcp" >&2
227+
echo "Valid values: all, api, assistant, gateway, mcp, slackbot" >&2
205228
exit 1
206229
;;
207230
esac

0 commit comments

Comments
 (0)