Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions terraform-gpu-devservers/docker/bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

# Show MOTD only for interactive login shells (skip for Claude Code, scripts, etc.)
# Check: stdin is a terminal AND stdout is a terminal
if [ -t 0 ] && [ -t 1 ] && [ -f /etc/motd ]; then
cat /etc/motd
fi
# MOTD is now handled by .bashrc_ext with proper TTY checks
# This ensures it works correctly on persistent disks without needing profile updates
6 changes: 6 additions & 0 deletions terraform-gpu-devservers/docker/bashrc_ext
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# User identification (set by Lambda on startup)
export GPU_DEV_USER_ID="dev"

# Show MOTD once per session, only for interactive terminals (skip for Claude Code, scripts, etc.)
if [ -z "$GPU_DEV_MOTD_SHOWN" ] && [ -t 0 ] && [ -t 1 ] && [ -f /etc/motd ]; then
cat /etc/motd
export GPU_DEV_MOTD_SHOWN=1
fi

# Function to check for GPU reservation expiry warnings and startup script status
check_warnings() {
# Check for startup script still running
Expand Down
7 changes: 2 additions & 5 deletions terraform-gpu-devservers/docker/profile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,5 @@ if [ -n "$BASH_VERSION" ] && [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

# Show MOTD only for interactive login shells (skip for Claude Code, scripts, etc.)
# Check: stdin is a terminal AND stdout is a terminal
if [ -t 0 ] && [ -t 1 ] && [ -f /etc/motd ]; then
cat /etc/motd
fi
# MOTD is now handled by .bashrc_ext with proper TTY checks
# This ensures it works correctly on persistent disks without needing profile updates
7 changes: 2 additions & 5 deletions terraform-gpu-devservers/docker/zprofile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,5 @@ if [ -f ~/.zshrc ]; then
source ~/.zshrc
fi

# Show MOTD only for interactive login shells (skip for Claude Code, scripts, etc.)
# Check: stdin is a terminal AND stdout is a terminal
if [ -t 0 ] && [ -t 1 ] && [ -f /etc/motd ]; then
cat /etc/motd
fi
# MOTD is now handled by .zshrc_ext with proper TTY checks
# This ensures it works correctly on persistent disks without needing profile updates
6 changes: 6 additions & 0 deletions terraform-gpu-devservers/docker/zshrc_ext
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@
# User identification (set by Lambda on startup)
export GPU_DEV_USER_ID="dev"

# Show MOTD once per session, only for interactive terminals (skip for Claude Code, scripts, etc.)
if [[ -z "$GPU_DEV_MOTD_SHOWN" ]] && [[ -t 0 ]] && [[ -t 1 ]] && [[ -f /etc/motd ]]; then
cat /etc/motd
export GPU_DEV_MOTD_SHOWN=1
fi

# Function to check for GPU reservation expiry warnings and startup script status
check_warnings() {
# Check for startup script still running
Expand Down
25 changes: 25 additions & 0 deletions terraform-gpu-devservers/lambda/reservation_processor/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -3913,6 +3913,12 @@ def create_pod(
# User identification
export GPU_DEV_USER_ID="{user_id or 'dev'}"

# Show MOTD once per session, only for interactive terminals (skip for Claude Code, scripts, etc.)
if [ -z "\$GPU_DEV_MOTD_SHOWN" ] && [ -t 0 ] && [ -t 1 ] && [ -f /etc/motd ]; then
cat /etc/motd
export GPU_DEV_MOTD_SHOWN=1
fi

# Function to check for GPU reservation expiry warnings and startup script status
check_warnings() {{
# Check for startup script still running
Expand Down Expand Up @@ -3941,6 +3947,12 @@ def create_pod(
# User identification
export GPU_DEV_USER_ID="{user_id or 'dev'}"

# Show MOTD once per session, only for interactive terminals (skip for Claude Code, scripts, etc.)
if [[ -z "\$GPU_DEV_MOTD_SHOWN" ]] && [[ -t 0 ]] && [[ -t 1 ]] && [[ -f /etc/motd ]]; then
cat /etc/motd
export GPU_DEV_MOTD_SHOWN=1
fi

# Function to check for GPU reservation expiry warnings and startup script status
check_warnings() {{
# Check for startup script still running
Expand Down Expand Up @@ -3980,6 +3992,19 @@ def create_pod(
done
echo "[STARTUP] ✓ Shell extension sourcing configured"

# Always update system profile files (these control login behavior)
# MOTD is now handled by extension files, so remove from profiles
echo "[STARTUP] Updating system profile files..."
if [ -d "/devserver-setup" ]; then
for profile_file in .bash_profile .zprofile .profile; do
if [ -f "/devserver-setup/$profile_file" ]; then
cp "/devserver-setup/$profile_file" "/home/dev/$profile_file"
echo "[STARTUP] ✓ Updated $profile_file"
fi
done
fi
echo "[STARTUP] ✓ System profile files updated"

# Ensure correct ownership
chown -R dev:dev /home/dev

Expand Down