Team Onboarding Workflow - jvPalma/dotrun GitHub Wiki

Team Onboarding Workflow

This workflow demonstrates how to use dotrun to create a streamlined onboarding experience for new team members, ensuring consistent development environment setup and rapid productivity.

Overview

A team onboarding workflow with dotrun provides:

  • Standardized development environment setup
  • Automated tool installation and configuration
  • Team-specific script collections
  • Consistent project structure across team members
  • Reduced time-to-productivity for new hires

Pre-Onboarding Setup (Team Lead/DevOps)

1. Create Team Script Collection

# Create centralized team repository
git clone https://github.com/yourcompany/team-dotrun-scripts.git
cd team-dotrun-scripts

# Directory structure
mkdir -p {onboarding,development,deployment,utilities,configs,templates}

2. Onboarding Scripts

Master Onboarding Script

onboarding/setup-developer.sh

#!/bin/bash
# Complete developer environment setup

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../utilities/colors.sh"
source "$SCRIPT_DIR/../utilities/logging.sh"

COMPANY_NAME="YourCompany"
DEVELOPER_NAME=""
DEVELOPER_EMAIL=""
GITHUB_USERNAME=""

# Welcome message
clear
echo -e "${BBLUE}"
cat <<'EOF'
 _____                    ____        _             
|_   _|__  __ _ _ __ ___  / ___|  ___ | |_ _   _ _ __ 
  | |/ _ \/ _` | '_ ` _ \ \___ \ / _ \| __| | | | '_ \
  | |  __/ (_| | | | | | | ___) |  __/| |_| |_| | |_) |
  |_|\___|\__,_|_| |_| |_|____/ \___| \__|\__,_| .__/
                                              |_|    
EOF
echo -e "${NC}"
echo -e "${BGREEN}Welcome to $COMPANY_NAME Development Team!${NC}"
echo -e "${BLUE}This script will set up your complete development environment.${NC}\n"

# Collect developer information
echo -e "${BLUE}=== Developer Information ===${NC}"
read -p "Full Name: " DEVELOPER_NAME
read -p "Email Address: " DEVELOPER_EMAIL
read -p "GitHub Username: " GITHUB_USERNAME

log_info "Setting up environment for $DEVELOPER_NAME ($DEVELOPER_EMAIL)"

# System requirements check
echo -e "\n${BLUE}=== System Requirements Check ===${NC}"
bash "$SCRIPT_DIR/check-requirements.sh"

# Install development tools
echo -e "\n${BLUE}=== Installing Development Tools ===${NC}"
bash "$SCRIPT_DIR/install-tools.sh"

# Configure Git
echo -e "\n${BLUE}=== Configuring Git ===${NC}"
bash "$SCRIPT_DIR/configure-git.sh" "$DEVELOPER_NAME" "$DEVELOPER_EMAIL"

# Set up SSH keys
echo -e "\n${BLUE}=== Setting up SSH Keys ===${NC}"
bash "$SCRIPT_DIR/setup-ssh.sh" "$DEVELOPER_EMAIL"

# Clone team repositories
echo -e "\n${BLUE}=== Cloning Team Repositories ===${NC}"
bash "$SCRIPT_DIR/clone-repositories.sh" "$GITHUB_USERNAME"

# Install dotrun and team scripts
echo -e "\n${BLUE}=== Installing dotrun and Team Scripts ===${NC}"
bash "$SCRIPT_DIR/setup-dotrun.sh"

# Configure development environment
echo -e "\n${BLUE}=== Configuring Development Environment ===${NC}"
bash "$SCRIPT_DIR/configure-environment.sh"

# Verify setup
echo -e "\n${BLUE}=== Verifying Setup ===${NC}"
bash "$SCRIPT_DIR/verify-setup.sh"

# Final instructions
echo -e "\n${BGREEN}=== Setup Complete! ===${NC}"
cat <<EOF

🎉 Welcome to the team, $DEVELOPER_NAME!

Your development environment is now ready. Here's what was set up:

✅ Development tools installed
✅ Git configured with your credentials
✅ SSH keys generated and configured
✅ Team repositories cloned
✅ dotrun installed with team scripts
✅ Development environment configured

Next Steps:
1. Add your SSH public key to GitHub: ~/.ssh/id_rsa.pub
2. Join our team Slack channels: #dev-team, #deployment
3. Review our development guidelines: https://wiki.company.com/dev-guidelines
4. Schedule a code review session with your mentor

Useful Commands:
  dotrun list                    # Show available team scripts
  dotrun run dev/start-project   # Start working on a project
  dotrun run help/team-resources # Show team resources and links

Questions? Ask in #dev-team or reach out to your mentor!
EOF

log_success "Onboarding completed successfully for $DEVELOPER_NAME"

Requirements Check Script

onboarding/check-requirements.sh

#!/bin/bash
# Check system requirements

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../utilities/colors.sh"
source "$SCRIPT_DIR/../utilities/logging.sh"

echo -e "${BLUE}Checking system requirements...${NC}\n"

# Check OS
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
  OS="Linux"
  DISTRO=$(lsb_release -si 2>/dev/null || echo "Unknown")
  echo -e "OS: ${GREEN}$OS ($DISTRO)${NC}"
elif [[ "$OSTYPE" == "darwin"* ]]; then
  OS="macOS"
  VERSION=$(sw_vers -productVersion)
  echo -e "OS: ${GREEN}$OS ($VERSION)${NC}"
else
  echo -e "OS: ${RED}Unsupported ($OSTYPE)${NC}"
  exit 1
fi

# Check available disk space (minimum 10GB)
available_space=$(df / | awk 'NR==2 {print $4}')
available_gb=$((available_space / 1024 / 1024))

if [[ $available_gb -ge 10 ]]; then
  echo -e "Disk Space: ${GREEN}${available_gb}GB available${NC}"
else
  echo -e "Disk Space: ${RED}${available_gb}GB available (minimum 10GB required)${NC}"
  exit 1
fi

# Check memory (minimum 8GB)
if [[ "$OS" == "Linux" ]]; then
  total_mem=$(free -g | awk 'NR==2{print $2}')
elif [[ "$OS" == "macOS" ]]; then
  total_mem=$(($(sysctl -n hw.memsize) / 1024 / 1024 / 1024))
fi

if [[ $total_mem -ge 8 ]]; then
  echo -e "Memory: ${GREEN}${total_mem}GB${NC}"
else
  echo -e "Memory: ${YELLOW}${total_mem}GB (8GB+ recommended)${NC}"
fi

# Check internet connectivity
if ping -c 1 google.com &>/dev/null; then
  echo -e "Internet: ${GREEN}Connected${NC}"
else
  echo -e "Internet: ${RED}No connection${NC}"
  exit 1
fi

echo -e "\n${GREEN}System requirements check passed!${NC}"

Tools Installation Script

onboarding/install-tools.sh

#!/bin/bash
# Install development tools

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../utilities/colors.sh"
source "$SCRIPT_DIR/../utilities/logging.sh"

install_tool() {
  local tool_name=$1
  local install_cmd=$2
  local check_cmd=$3

  if command -v $check_cmd &>/dev/null; then
    log_success "$tool_name already installed"
    return
  fi

  log_info "Installing $tool_name..."
  eval "$install_cmd"

  if command -v $check_cmd &>/dev/null; then
    log_success "$tool_name installed successfully"
  else
    log_error "Failed to install $tool_name"
    exit 1
  fi
}

# Detect OS and set package manager
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
  if command -v apt &>/dev/null; then
    PKG_MANAGER="apt"
    UPDATE_CMD="sudo apt update"
    INSTALL_CMD="sudo apt install -y"
  elif command -v yum &>/dev/null; then
    PKG_MANAGER="yum"
    UPDATE_CMD="sudo yum update"
    INSTALL_CMD="sudo yum install -y"
  fi
elif [[ "$OSTYPE" == "darwin"* ]]; then
  PKG_MANAGER="brew"
  UPDATE_CMD="brew update"
  INSTALL_CMD="brew install"
fi

# Update package manager
log_info "Updating package manager..."
eval "$UPDATE_CMD"

# Essential tools
echo -e "\n${BLUE}Installing essential tools...${NC}"

install_tool "Git" "$INSTALL_CMD git" "git"
install_tool "Curl" "$INSTALL_CMD curl" "curl"
install_tool "Wget" "$INSTALL_CMD wget" "wget"
install_tool "Vim" "$INSTALL_CMD vim" "vim"

# Programming languages
echo -e "\n${BLUE}Installing programming languages...${NC}"

# Node.js (via NodeSource)
if [[ "$PKG_MANAGER" == "apt" ]]; then
  install_tool "Node.js" "curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash - && sudo apt-get install -y nodejs" "node"
elif [[ "$PKG_MANAGER" == "brew" ]]; then
  install_tool "Node.js" "brew install node" "node"
fi

# Python 3
install_tool "Python 3" "$INSTALL_CMD python3 python3-pip" "python3"

# Docker
echo -e "\n${BLUE}Installing Docker...${NC}"
if [[ "$PKG_MANAGER" == "apt" ]]; then
  if ! command -v docker &>/dev/null; then
    log_info "Installing Docker..."
    curl -fsSL https://get.docker.com -o get-docker.sh
    sudo sh get-docker.sh
    sudo usermod -aG docker $USER
    rm get-docker.sh
    log_success "Docker installed (restart required to use without sudo)"
  else
    log_success "Docker already installed"
  fi
elif [[ "$PKG_MANAGER" == "brew" ]]; then
  install_tool "Docker" "brew install --cask docker" "docker"
fi

# Development tools
echo -e "\n${BLUE}Installing development tools...${NC}"

if [[ "$PKG_MANAGER" == "brew" ]]; then
  install_tool "VS Code" "brew install --cask visual-studio-code" "code"
  install_tool "iTerm2" "brew install --cask iterm2" "open"
else
  # VS Code for Linux
  if ! command -v code &>/dev/null; then
    log_info "Installing VS Code..."
    wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor >packages.microsoft.gpg
    sudo install -o root -g root -m 644 packages.microsoft.gpg /etc/apt/trusted.gpg.d/
    sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/trusted.gpg.d/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
    sudo apt update
    sudo apt install -y code
    log_success "VS Code installed"
  else
    log_success "VS Code already installed"
  fi
fi

log_success "All development tools installed successfully!"

Repository Cloning Script

onboarding/clone-repositories.sh

#!/bin/bash
# Clone team repositories

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../utilities/colors.sh"
source "$SCRIPT_DIR/../utilities/logging.sh"

GITHUB_USERNAME=$1
ORG_NAME="yourcompany"
PROJECTS_DIR="$HOME/projects"

# Repository list (customize for your team)
REPOSITORIES=(
  "frontend-app"
  "backend-api"
  "shared-components"
  "documentation"
  "deployment-scripts"
)

# Create projects directory
mkdir -p "$PROJECTS_DIR"
cd "$PROJECTS_DIR"

log_info "Cloning team repositories to $PROJECTS_DIR"

for repo in "${REPOSITORIES[@]}"; do
  if [[ -d "$repo" ]]; then
    log_info "$repo already exists, pulling latest changes..."
    cd "$repo"
    git pull origin main || git pull origin master
    cd ..
  else
    log_info "Cloning $repo..."
    git clone "[email protected]:$ORG_NAME/$repo.git"

    # Set up repository-specific configuration
    cd "$repo"

    # Install dependencies if package.json exists
    if [[ -f "package.json" ]]; then
      log_info "Installing Node.js dependencies for $repo..."
      npm install
    fi

    # Install Python dependencies if requirements.txt exists
    if [[ -f "requirements.txt" ]]; then
      log_info "Installing Python dependencies for $repo..."
      pip3 install -r requirements.txt
    fi

    cd ..
  fi
done

log_success "All repositories cloned and configured!"

# Create workspace file for VS Code
cat >"$PROJECTS_DIR/team-workspace.code-workspace" <<EOF
{
    "folders": [
$(for repo in "${REPOSITORIES[@]}"; do
  echo "        { \"path\": \"./$repo\" },"
done | sed '$ s/,$//')
    ],
    "settings": {
        "terminal.integrated.defaultProfile.linux": "bash",
        "editor.formatOnSave": true
    }
}
EOF

log_info "VS Code workspace file created: $PROJECTS_DIR/team-workspace.code-workspace"

3. Team Development Scripts

Project Starter Script

development/start-project.sh

#!/bin/bash
# Interactive project starter

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../utilities/colors.sh"

echo -e "${BLUE}=== Project Starter ===${NC}\n"

# List available projects
PROJECTS_DIR="$HOME/projects"
cd "$PROJECTS_DIR"

echo -e "${BLUE}Available projects:${NC}"
select project in */; do
  if [[ -n "$project" ]]; then
    PROJECT_NAME=${project%/}
    break
  fi
done

echo -e "\n${BLUE}Starting development environment for: ${BGREEN}$PROJECT_NAME${NC}\n"

cd "$PROJECT_NAME"

# Show project info
echo -e "${BLUE}Project Information:${NC}"
if [[ -f "package.json" ]]; then
  echo "  Type: Node.js/JavaScript"
  echo "  Name: $(node -p "require('./package.json').name" 2>/dev/null || echo "N/A")"
  echo "  Version: $(node -p "require('./package.json').version" 2>/dev/null || echo "N/A")"
elif [[ -f "requirements.txt" ]]; then
  echo "  Type: Python"
elif [[ -f "Cargo.toml" ]]; then
  echo "  Type: Rust"
elif [[ -f "go.mod" ]]; then
  echo "  Type: Go"
fi

# Git status
if git rev-parse --git-dir >/dev/null 2>&1; then
  echo "  Branch: $(git branch --show-current)"

  # Check for uncommitted changes
  if ! git diff-index --quiet HEAD --; then
    echo -e "  Status: ${YELLOW}Uncommitted changes${NC}"
    git status --short
  else
    echo -e "  Status: ${GREEN}Clean${NC}"
  fi
fi

echo ""

# Start development servers
echo -e "${BLUE}Starting development environment...${NC}"

# Node.js project
if [[ -f "package.json" ]]; then
  if grep -q "\"dev\":" package.json; then
    echo "Starting development server..."
    npm run dev
  elif grep -q "\"start\":" package.json; then
    echo "Starting server..."
    npm start
  else
    echo "No dev/start script found in package.json"
  fi
# Python project
elif [[ -f "app.py" ]] || [[ -f "main.py" ]]; then
  if [[ -f "app.py" ]]; then
    echo "Starting Flask/FastAPI server..."
    python3 app.py
  else
    echo "Starting Python application..."
    python3 main.py
  fi
# Docker project
elif [[ -f "docker-compose.yml" ]]; then
  echo "Starting Docker services..."
  docker-compose up
else
  echo "Opening project in VS Code..."
  code .
fi

Database Management Script

development/database-tools.sh

#!/bin/bash
# Database management tools

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/../utilities/colors.sh"

echo -e "${BLUE}=== Database Tools ===${NC}"
echo "1) Start local PostgreSQL"
echo "2) Start local MySQL"
echo "3) Start Redis"
echo "4) Run database migrations"
echo "5) Create database backup"
echo "6) Restore database backup"
echo "7) Reset development database"

read -p "Choose option (1-7): " choice

case $choice in
  1)
    echo -e "${BLUE}Starting PostgreSQL...${NC}"
    docker run --name postgres-dev -e POSTGRES_PASSWORD=dev123 -p 5432:5432 -d postgres:13
    echo "PostgreSQL running on localhost:5432"
    echo "Username: postgres, Password: dev123"
    ;;
  2)
    echo -e "${BLUE}Starting MySQL...${NC}"
    docker run --name mysql-dev -e MYSQL_ROOT_PASSWORD=dev123 -p 3306:3306 -d mysql:8.0
    echo "MySQL running on localhost:3306"
    echo "Username: root, Password: dev123"
    ;;
  3)
    echo -e "${BLUE}Starting Redis...${NC}"
    docker run --name redis-dev -p 6379:6379 -d redis:alpine
    echo "Redis running on localhost:6379"
    ;;
  4)
    echo -e "${BLUE}Running database migrations...${NC}"
    if [[ -f "package.json" ]] && grep -q "migrate" package.json; then
      npm run migrate
    elif [[ -f "manage.py" ]]; then
      python manage.py migrate
    elif [[ -f "alembic.ini" ]]; then
      alembic upgrade head
    else
      echo "No migration tool detected"
    fi
    ;;
  5)
    echo -e "${BLUE}Creating database backup...${NC}"
    timestamp=$(date +%Y%m%d_%H%M%S)
    read -p "Database name: " db_name
    pg_dump $db_name >"backup_${db_name}_${timestamp}.sql"
    echo "Backup created: backup_${db_name}_${timestamp}.sql"
    ;;
  6)
    echo -e "${BLUE}Restoring database backup...${NC}"
    ls -la *.sql
    read -p "Backup file: " backup_file
    read -p "Target database: " db_name
    psql $db_name <$backup_file
    echo "Database restored successfully"
    ;;
  7)
    echo -e "${YELLOW}This will completely reset your development database!${NC}"
    read -p "Are you sure? (y/N): " confirm
    if [[ $confirm == [yY] ]]; then
      docker stop postgres-dev mysql-dev redis-dev 2>/dev/null || true
      docker rm postgres-dev mysql-dev redis-dev 2>/dev/null || true
      echo "Development databases reset"
    fi
    ;;
esac

4. Utility Scripts

utilities/logging.sh

#!/bin/bash
# Logging utilities

LOG_FILE="/tmp/dotrun-$(date +%Y%m%d).log"

log_info() {
  local message="$1"
  echo -e "${BLUE}[INFO]${NC} $message"
  echo "[$(date '+%Y-%m-%d %H:%M:%S')] INFO: $message" >>"$LOG_FILE"
}

log_success() {
  local message="$1"
  echo -e "${GREEN}[SUCCESS]${NC} $message"
  echo "[$(date '+%Y-%m-%d %H:%M:%S')] SUCCESS: $message" >>"$LOG_FILE"
}

log_warning() {
  local message="$1"
  echo -e "${YELLOW}[WARNING]${NC} $message"
  echo "[$(date '+%Y-%m-%d %H:%M:%S')] WARNING: $message" >>"$LOG_FILE"
}

log_error() {
  local message="$1"
  echo -e "${RED}[ERROR]${NC} $message"
  echo "[$(date '+%Y-%m-%d %H:%M:%S')] ERROR: $message" >>"$LOG_FILE"
}

5. Team Resources Script

utilities/team-resources.sh

#!/bin/bash
# Display team resources and links

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "$SCRIPT_DIR/colors.sh"

echo -e "${BBLUE}=== Team Resources ===${NC}\n"

echo -e "${BLUE}📚 Documentation:${NC}"
echo "  • Development Guidelines: https://wiki.company.com/dev-guidelines"
echo "  • API Documentation: https://api-docs.company.com"
echo "  • Code Review Process: https://wiki.company.com/code-review"
echo "  • Deployment Guide: https://wiki.company.com/deployment"

echo -e "\n${BLUE}🔧 Development Tools:${NC}"
echo "  • GitHub Organization: https://github.com/yourcompany"
echo "  • CI/CD Dashboard: https://ci.company.com"
echo "  • Error Tracking: https://sentry.company.com"
echo "  • Monitoring: https://monitoring.company.com"

echo -e "\n${BLUE}💬 Communication:${NC}"
echo "  • Slack Workspace: https://yourcompany.slack.com"
echo "  • Dev Team Channel: #dev-team"
echo "  • Deployment Notifications: #deployments"
echo "  • General Discussion: #general"

echo -e "\n${BLUE}🎯 Project Management:${NC}"
echo "  • Issue Tracker: https://jira.company.com"
echo "  • Sprint Board: https://board.company.com"
echo "  • Team Calendar: https://calendar.company.com"

echo -e "\n${BLUE}🚀 Quick Commands:${NC}"
echo "  • dotrun list                 # Show all available scripts"
echo "  • dotrun run dev/start-project # Start working on a project"
echo "  • dotrun run dev/database-tools # Database management"
echo "  • dotrun run utilities/update-tools # Update development tools"

echo -e "\n${BLUE}👥 Team Contacts:${NC}"
echo "  • Tech Lead: [email protected]"
echo "  • DevOps: [email protected]"
echo "  • HR/Onboarding: [email protected]"

echo -e "\n${GREEN}Need help? Ask in #dev-team or reach out to your mentor!${NC}"

Onboarding Day Schedule

Day 1: Environment Setup

  1. Morning (9:00 AM)

    • Welcome meeting with team lead
    • Run onboarding script: dotrun run onboarding/setup-developer
    • Account setup (GitHub, Slack, email)
  2. Afternoon (1:00 PM)

    • Complete environment verification
    • Clone and explore team repositories
    • First team standup meeting

Day 2-3: Project Familiarization

  1. Project Overview

    • Architecture documentation review
    • Codebase walkthrough with mentor
    • Local development environment testing
  2. First Tasks

    • Small bug fixes or documentation updates
    • Code review process participation
    • Team development workflow practice

Week 1: Integration

  • Participate in all team ceremonies
  • Complete first feature implementation
  • Set up monitoring and error tracking accounts
  • Shadow experienced developers

Measuring Success

Onboarding Metrics

  • Time to first commit: Target < 2 days
  • Time to first feature: Target < 1 week
  • Environment setup time: Target < 4 hours
  • Script execution success rate: Target > 95%

Feedback Collection

  • Daily check-ins during first week
  • Weekly feedback sessions for first month
  • Anonymous feedback form
  • Mentor evaluation

This team onboarding workflow ensures new developers can quickly become productive team members with a consistent, automated setup process.

⚠️ **GitHub.com Fallback** ⚠️