fix: remove allowed host (#541)
- Use official installation script for boundary instead of compiling from source. - Use boundary-run wrapper.
This commit is contained in:
parent
8add161f53
commit
e11ed2d7ae
@ -13,7 +13,7 @@ Run the [Claude Code](https://docs.anthropic.com/en/docs/agents-and-tools/claude
|
|||||||
```tf
|
```tf
|
||||||
module "claude-code" {
|
module "claude-code" {
|
||||||
source = "registry.coder.com/coder/claude-code/coder"
|
source = "registry.coder.com/coder/claude-code/coder"
|
||||||
version = "4.0.1"
|
version = "4.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/project"
|
workdir = "/home/coder/project"
|
||||||
claude_api_key = "xxxx-xxxxx-xxxx"
|
claude_api_key = "xxxx-xxxxx-xxxx"
|
||||||
@ -70,7 +70,7 @@ data "coder_parameter" "ai_prompt" {
|
|||||||
|
|
||||||
module "claude-code" {
|
module "claude-code" {
|
||||||
source = "registry.coder.com/coder/claude-code/coder"
|
source = "registry.coder.com/coder/claude-code/coder"
|
||||||
version = "4.0.1"
|
version = "4.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/project"
|
workdir = "/home/coder/project"
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ Run and configure Claude Code as a standalone CLI in your workspace.
|
|||||||
```tf
|
```tf
|
||||||
module "claude-code" {
|
module "claude-code" {
|
||||||
source = "registry.coder.com/coder/claude-code/coder"
|
source = "registry.coder.com/coder/claude-code/coder"
|
||||||
version = "4.0.1"
|
version = "4.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder"
|
workdir = "/home/coder"
|
||||||
install_claude_code = true
|
install_claude_code = true
|
||||||
@ -129,7 +129,7 @@ variable "claude_code_oauth_token" {
|
|||||||
|
|
||||||
module "claude-code" {
|
module "claude-code" {
|
||||||
source = "registry.coder.com/coder/claude-code/coder"
|
source = "registry.coder.com/coder/claude-code/coder"
|
||||||
version = "4.0.1"
|
version = "4.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/project"
|
workdir = "/home/coder/project"
|
||||||
claude_code_oauth_token = var.claude_code_oauth_token
|
claude_code_oauth_token = var.claude_code_oauth_token
|
||||||
@ -202,7 +202,7 @@ resource "coder_env" "bedrock_api_key" {
|
|||||||
|
|
||||||
module "claude-code" {
|
module "claude-code" {
|
||||||
source = "registry.coder.com/coder/claude-code/coder"
|
source = "registry.coder.com/coder/claude-code/coder"
|
||||||
version = "4.0.1"
|
version = "4.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/project"
|
workdir = "/home/coder/project"
|
||||||
model = "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
model = "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
|
||||||
@ -259,7 +259,7 @@ resource "coder_env" "google_application_credentials" {
|
|||||||
|
|
||||||
module "claude-code" {
|
module "claude-code" {
|
||||||
source = "registry.coder.com/coder/claude-code/coder"
|
source = "registry.coder.com/coder/claude-code/coder"
|
||||||
version = "4.0.1"
|
version = "4.1.0"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
workdir = "/home/coder/project"
|
workdir = "/home/coder/project"
|
||||||
model = "claude-sonnet-4@20250514"
|
model = "claude-sonnet-4@20250514"
|
||||||
|
|||||||
@ -240,6 +240,12 @@ variable "boundary_pprof_port" {
|
|||||||
default = "6067"
|
default = "6067"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
variable "compile_boundary_from_source" {
|
||||||
|
type = bool
|
||||||
|
description = "Whether to compile boundary from source instead of using the official install script"
|
||||||
|
default = false
|
||||||
|
}
|
||||||
|
|
||||||
resource "coder_env" "claude_code_md_path" {
|
resource "coder_env" "claude_code_md_path" {
|
||||||
count = var.claude_md_path == "" ? 0 : 1
|
count = var.claude_md_path == "" ? 0 : 1
|
||||||
|
|
||||||
@ -357,6 +363,7 @@ module "agentapi" {
|
|||||||
ARG_BOUNDARY_PROXY_PORT='${var.boundary_proxy_port}' \
|
ARG_BOUNDARY_PROXY_PORT='${var.boundary_proxy_port}' \
|
||||||
ARG_ENABLE_BOUNDARY_PPROF='${var.enable_boundary_pprof}' \
|
ARG_ENABLE_BOUNDARY_PPROF='${var.enable_boundary_pprof}' \
|
||||||
ARG_BOUNDARY_PPROF_PORT='${var.boundary_pprof_port}' \
|
ARG_BOUNDARY_PPROF_PORT='${var.boundary_pprof_port}' \
|
||||||
|
ARG_COMPILE_FROM_SOURCE='${var.compile_boundary_from_source}' \
|
||||||
ARG_CODER_HOST='${local.coder_host}' \
|
ARG_CODER_HOST='${local.coder_host}' \
|
||||||
/tmp/start.sh
|
/tmp/start.sh
|
||||||
EOT
|
EOT
|
||||||
|
|||||||
@ -28,6 +28,7 @@ ARG_BOUNDARY_LOG_LEVEL=${ARG_BOUNDARY_LOG_LEVEL:-"WARN"}
|
|||||||
ARG_BOUNDARY_PROXY_PORT=${ARG_BOUNDARY_PROXY_PORT:-"8087"}
|
ARG_BOUNDARY_PROXY_PORT=${ARG_BOUNDARY_PROXY_PORT:-"8087"}
|
||||||
ARG_ENABLE_BOUNDARY_PPROF=${ARG_ENABLE_BOUNDARY_PPROF:-false}
|
ARG_ENABLE_BOUNDARY_PPROF=${ARG_ENABLE_BOUNDARY_PPROF:-false}
|
||||||
ARG_BOUNDARY_PPROF_PORT=${ARG_BOUNDARY_PPROF_PORT:-"6067"}
|
ARG_BOUNDARY_PPROF_PORT=${ARG_BOUNDARY_PPROF_PORT:-"6067"}
|
||||||
|
ARG_COMPILE_FROM_SOURCE=${ARG_COMPILE_FROM_SOURCE:-false}
|
||||||
ARG_CODER_HOST=${ARG_CODER_HOST:-}
|
ARG_CODER_HOST=${ARG_CODER_HOST:-}
|
||||||
|
|
||||||
echo "--------------------------------"
|
echo "--------------------------------"
|
||||||
@ -45,6 +46,7 @@ printf "ARG_BOUNDARY_VERSION: %s\n" "$ARG_BOUNDARY_VERSION"
|
|||||||
printf "ARG_BOUNDARY_LOG_DIR: %s\n" "$ARG_BOUNDARY_LOG_DIR"
|
printf "ARG_BOUNDARY_LOG_DIR: %s\n" "$ARG_BOUNDARY_LOG_DIR"
|
||||||
printf "ARG_BOUNDARY_LOG_LEVEL: %s\n" "$ARG_BOUNDARY_LOG_LEVEL"
|
printf "ARG_BOUNDARY_LOG_LEVEL: %s\n" "$ARG_BOUNDARY_LOG_LEVEL"
|
||||||
printf "ARG_BOUNDARY_PROXY_PORT: %s\n" "$ARG_BOUNDARY_PROXY_PORT"
|
printf "ARG_BOUNDARY_PROXY_PORT: %s\n" "$ARG_BOUNDARY_PROXY_PORT"
|
||||||
|
printf "ARG_COMPILE_FROM_SOURCE: %s\n" "$ARG_COMPILE_FROM_SOURCE"
|
||||||
printf "ARG_CODER_HOST: %s\n" "$ARG_CODER_HOST"
|
printf "ARG_CODER_HOST: %s\n" "$ARG_CODER_HOST"
|
||||||
|
|
||||||
echo "--------------------------------"
|
echo "--------------------------------"
|
||||||
@ -63,11 +65,25 @@ case $session_cleanup_exit_code in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
function install_boundary() {
|
function install_boundary() {
|
||||||
# Install boundary from public github repo
|
if [ "${ARG_COMPILE_FROM_SOURCE:-false}" = "true" ]; then
|
||||||
git clone https://github.com/coder/boundary
|
# Install boundary by compiling from source
|
||||||
cd boundary
|
echo "Compiling boundary from source (version: $ARG_BOUNDARY_VERSION)"
|
||||||
git checkout $ARG_BOUNDARY_VERSION
|
git clone https://github.com/coder/boundary.git
|
||||||
go install ./cmd/...
|
cd boundary
|
||||||
|
git checkout "$ARG_BOUNDARY_VERSION"
|
||||||
|
|
||||||
|
# Build the binary
|
||||||
|
make build
|
||||||
|
|
||||||
|
# Install binary and wrapper script (optional)
|
||||||
|
sudo cp boundary /usr/local/bin/
|
||||||
|
sudo cp scripts/boundary-wrapper.sh /usr/local/bin/boundary-run
|
||||||
|
sudo chmod +x /usr/local/bin/boundary-run
|
||||||
|
else
|
||||||
|
# Install boundary using official install script
|
||||||
|
echo "Installing boundary using official install script (version: $ARG_BOUNDARY_VERSION)"
|
||||||
|
curl -fsSL https://raw.githubusercontent.com/coder/boundary/main/install.sh | bash -s -- --version "$ARG_BOUNDARY_VERSION"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function validate_claude_installation() {
|
function validate_claude_installation() {
|
||||||
@ -209,9 +225,8 @@ function start_agentapi() {
|
|||||||
BOUNDARY_ARGS+=(--pprof-port ${ARG_BOUNDARY_PPROF_PORT})
|
BOUNDARY_ARGS+=(--pprof-port ${ARG_BOUNDARY_PPROF_PORT})
|
||||||
fi
|
fi
|
||||||
|
|
||||||
agentapi server --allowed-hosts="*" --type claude --term-width 67 --term-height 1190 -- \
|
agentapi server --type claude --term-width 67 --term-height 1190 -- \
|
||||||
sudo -E env PATH=$PATH setpriv --reuid=$(id -u) --regid=$(id -g) --clear-groups \
|
boundary-run "${BOUNDARY_ARGS[@]}" -- \
|
||||||
--inh-caps=+net_admin --ambient-caps=+net_admin --bounding-set=+net_admin boundary "${BOUNDARY_ARGS[@]}" -- \
|
|
||||||
claude "${ARGS[@]}"
|
claude "${ARGS[@]}"
|
||||||
else
|
else
|
||||||
agentapi server --type claude --term-width 67 --term-height 1190 -- claude "${ARGS[@]}"
|
agentapi server --type claude --term-width 67 --term-height 1190 -- claude "${ARGS[@]}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user