Files
code-tools/tf/apps.tf

287 lines
9.6 KiB
HCL

# =============================================================================
# Coder Applications - Service Access Points
# Web interfaces and tools for development services
# =============================================================================
# =============================================================================
# IDE and Code Editor Access
# =============================================================================
# VS Code Server
resource "coder_app" "code_server" {
agent_id = coder_agent.main.id
slug = "code-server"
display_name = "VS Code"
url = "http://localhost:8080"
icon = "/icon/code.svg"
subdomain = true
share = "owner"
order = 1
healthcheck {
url = "http://localhost:8080/healthz"
interval = 10
Files
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
# =============================================================================
# Coder Applications - Service Access Points
# Web interfaces and tools for development services
# =============================================================================
# =============================================================================
# IDE and Code Editor Access
# =============================================================================
# VS Code Server
\}
$0
threshold = 5
}
}
# Terminal Access
resource "coder_app" "terminal" {
agent_id = coder_agent.main.id
slug = "terminal"
display_name = "Terminal"
icon = "/icon/terminal.svg"
command = "bash"
order = 2
}
# =============================================================================
# Service Port Forwarding for Docker Container Access
# Note: Using direct container URLs since containers are on same Docker network
# =============================================================================
# =============================================================================
# Database Management Interfaces
# =============================================================================
# pgAdmin - PostgreSQL Administration
resource "coder_app" "pgadmin" {
count = data.coder_parameter.enable_services.value && data.coder_parameter.enable_pgadmin.value ? 1 : 0
agent_id = coder_agent.main.id
slug = "pgadmin"
display_name = "pgAdmin"
url = "http://pgadmin-${local.workspace_id}:80"
icon = "/icon/postgresql.svg"
subdomain = true
share = "owner"
order = 10
healthcheck {
url = "http://pgadmin-${local.workspace_id}:80"
interval = 15
threshold = 5
}
}
# Qdrant Dashboard - Vector Database Management
resource "coder_app" "qdrant" {
count = data.coder_parameter.enable_services.value ? 1 : 0
agent_id = coder_agent.main.id
slug = "qdrant-dashboard"
display_name = "Qdrant Dashboard"
url = "http://qdrant-${local.workspace_id}:6333/dashboard"
icon = "/icon/database.svg"
subdomain = true
share = "owner"
order = 11
healthcheck {
url = "http://qdrant-${local.workspace_id}:6333/health" # Use proper health endpoint
interval = 30
threshold = 10
}
}
# =============================================================================
# Development Server Ports
# =============================================================================
# Next.js Development Server (default port 3000)
resource "coder_app" "nextjs_dev" {
agent_id = coder_agent.main.id
slug = "nextjs-3000"
display_name = "Next.js Dev Server"
url = "http://localhost:3000"
icon = "/icon/react.svg"
subdomain = true
share = "owner"
healthcheck {
url = "http://localhost:3000"
interval = 10
threshold = 10
}
}
# Generic Development Server (port 3000)
resource "coder_app" "dev_server_3000" {
agent_id = coder_agent.main.id
slug = "dev-3000"
display_name = "Dev Server (3000)"
url = "http://localhost:3000"
icon = "/icon/web.svg"
subdomain = true
share = "owner"
order = 21
healthcheck {
url = "http://localhost:3000"
interval = 10
threshold = 10
}
}
# API Server - FastAPI/Flask (port 8000)
resource "coder_app" "api_server_8000" {
agent_id = coder_agent.main.id
slug = "api-8000"
display_name = "API Server (8000)"
url = "http://localhost:8000"
icon = "/icon/api.svg"
subdomain = true
share = "owner"
order = 20
healthcheck {
url = "http://localhost:8000/health"
interval = 10
threshold = 10
}
}
# Vite Development Server (port 5173)
resource "coder_app" "vite_dev" {
agent_id = coder_agent.main.id
slug = "vite-5173"
display_name = "Vite Dev Server"
url = "http://localhost:5173"
icon = "/icon/web.svg"
subdomain = true
share = "owner"
healthcheck {
url = "http://localhost:5173"
interval = 10
threshold = 10
}
}
# Rust Development Server (port 8080)
resource "coder_app" "rust_server" {
agent_id = coder_agent.main.id
slug = "rust-8080"
display_name = "Rust Server (8080)"
url = "http://localhost:8080"
icon = "/icon/code.svg"
subdomain = true
share = "owner"
healthcheck {
url = "http://localhost:8080/health"
interval = 10
threshold = 10
}
}
# =============================================================================
# Data Science and Analytics Tools
# =============================================================================
# Jupyter Lab (if enabled)
resource "coder_app" "jupyter" {
count = data.coder_parameter.enable_jupyter.value ? 1 : 0
agent_id = coder_agent.main.id
slug = "jupyter"
display_name = "Jupyter Lab"
url = "http://localhost:8888"
icon = "/icon/python.svg"
subdomain = true
share = "owner"
healthcheck {
url = "http://localhost:8888"
interval = 15
threshold = 10
}
}
# =============================================================================
# Utility and Management Applications
# =============================================================================
# Environment Information
resource "coder_app" "env_info" {
agent_id = coder_agent.main.id
slug = "env-info"
display_name = "Environment Info"
icon = "/icon/info.svg"
command = "devinfo"
}
# Database Connection Tester
resource "coder_app" "db_tester" {
count = data.coder_parameter.enable_services.value ? 1 : 0
agent_id = coder_agent.main.id
slug = "db-tester"
display_name = "Database Tester"
icon = "/icon/terminal.svg"
command = "bash -c 'echo \"=== Database Connection Test ===\"; echo \"PostgreSQL: postgres-${local.workspace_id}:5432\"; echo \"Redis: redis-${local.workspace_id}:6379\"; echo \"Qdrant: qdrant-${local.workspace_id}:6333\"; echo; echo \"Test PostgreSQL:\"; pg_isready -h postgres-${local.workspace_id} -p 5432 -U postgres || echo \"PostgreSQL not ready\"; echo; echo \"Test Redis:\"; redis-cli -h redis-${local.workspace_id} -p 6379 -a \"${var.redis_password}\" ping || echo \"Redis not ready\"; echo; echo \"Test Qdrant:\"; curl -f http://qdrant-${local.workspace_id}:6333 || echo \"Qdrant not ready\"; echo; read -p \"Press Enter to exit...\"'"
}
# Development Logs Viewer
resource "coder_app" "dev_logs" {
agent_id = coder_agent.main.id
slug = "dev-logs"
display_name = "Development Logs"
icon = "/icon/terminal.svg"
command = "bash"
}
# Git Repository Manager
resource "coder_app" "git_manager" {
agent_id = coder_agent.main.id
slug = "git"
display_name = "Git Repository"
icon = "/icon/git.svg"
command = "bash"
}
# =============================================================================
# AI Development Tools Access
# =============================================================================
# Claude Code CLI Access
resource "coder_app" "claude_code" {
count = data.coder_parameter.enable_ai_tools.value && data.coder_parameter.enable_claude_code.value ? 1 : 0
agent_id = coder_agent.main.id
slug = "claude-code"
display_name = "Claude Code"
icon = "/icon/ai.svg"
command = "claude"
}
# JetBrains Gateway
resource "coder_app" "jetbrains_gateway" {
count = data.coder_parameter.enable_jetbrains.value ? 1 : 0
agent_id = coder_agent.main.id
slug = "jetbrains-gateway"
display_name = "JetBrains Gateway"
icon = "/icon/intellij.svg"
command = "bash -c 'echo \"🚀 JetBrains Gateway Integration\"; echo \"========================\"; echo \"\"; echo \"📍 Project Folder: /workspaces\"; echo \"🔧 Available IDEs: IntelliJ IDEA Ultimate, WebStorm, PyCharm Professional, GoLand\"; echo \"🌐 Default IDE: IntelliJ IDEA Ultimate\"; echo \"\"; echo \"💡 To connect:\"; echo \" 1. Install JetBrains Gateway on your local machine\"; echo \" 2. Connect to this workspace using Coder Gateway plugin\"; echo \" 3. Select your preferred IDE from the available options\"; echo \"\"; echo \"📚 Documentation: https://coder.com/docs/ides/gateway\"; echo \"\"; read -p \"Press Enter to continue...\";'"
order = 3
}
# File Manager
resource "coder_app" "file_manager" {
agent_id = coder_agent.main.id
slug = "files"
display_name = "File Manager"
icon = "/icon/folder.svg"
command = "bash -c 'export TERM=xterm-256color && cd /workspaces && ranger'"
order = 5
}