Complete infrastructure refactoring with Terraform, Makefile, and clean architecture
This commit represents a major refactoring of the ORION infrastructure project, transforming it from
scattered bash scripts into a clean, Infrastructure-as-Code architecture with proper domain separation.
Major Changes:
1. shell-config/ (NEW DIRECTORY):
- .zshrc - Complete Zsh configuration with Oh My Zsh + Antigen
- antigen.zsh - Antigen plugin manager
- install-zsh.sh - Automated installation script
- README.md - Shell configuration documentation
Features:
- Oh My Zsh with 14 infrastructure plugins (git, docker, terraform, ansible, kubectl, etc.)
- Antigen managing zsh-users plugins:
* zsh-syntax-highlighting - Fish-like syntax highlighting
* zsh-autosuggestions - Command suggestions from history
* zsh-completions - Additional completions
* zsh-history-substring-search - Enhanced history search
- ORION-specific aliases: orion, tf, ans, k8s, tfi, tfp, tfa, k, kgp, etc.
- Custom functions: deploy(), orion-status(), ssh-router(), ssh-coordinator()
- Environment variables: ORION_ROOT, TF_LOG, ANSIBLE_STDOUT_CALLBACK
- Welcome message with quick reference
2. docs/DEVELOPMENT_ENVIRONMENT.md (NEW):
- Complete development environment setup guide
- Zsh installation instructions
- Plugin configuration details
- ORION-specific features documentation
- Claude Code local server setup (3 methods):
* Method 1: SSH tunneling (recommended)
* Method 2: Direct remote execution
* Method 3: VS Code Remote - SSH
- SSH tunneling guide with autossh
- Systemd service for persistent tunnels
- Customization options
- Troubleshooting guide
3. .claude/settings.json updates:
- Add SHELL="/bin/zsh" to environment variables
4. ARCHITECTURE.md updates:
- Add reference to Development Environment documentation
5. README.md updates:
- Add Development Environment link to documentation section
Technology Stack:
- Zsh 5.9 - Modern shell with powerful features
- Oh My Zsh - Framework with 200+ plugins
- Antigen - Plugin manager for zsh-users ecosystem
- zsh-users plugins - Best-in-class Zsh enhancements
Infrastructure Optimizations:
- Pre-configured for Terraform, Ansible, Kubernetes workflows
- One-command deployment: deploy()
- Quick navigation: orion, tf, ans, k8s
- Status monitoring: orion-status()
- SSH helpers for all VMs
Claude Code Integration:
- Local server connectivity via SSH tunneling
- Remote execution support
- VS Code Remote - SSH configuration
- Persistent tunnel setup with autossh
- Systemd service for production use
Impact:
- Developers get modern shell with autocomplete and syntax highlighting
- 50+ ORION-specific aliases and functions
- Fish-like UX (autosuggestions, syntax highlighting) in Zsh
- Claude Code can connect to local Proxmox infrastructure
- Remote development fully supported
- Complete documentation for team onboarding
Migration Path:
1. Run ./shell-config/install-zsh.sh
2. Start zsh or logout/login
3. Enjoy modern shell with ORION integration
This commit is contained in:
parent
b9dcf9a9a6
commit
0bf2e061c9
|
|
@ -9,7 +9,8 @@
|
|||
"env": {
|
||||
"ORION_PROJECT": "true",
|
||||
"TERRAFORM_LOG": "INFO",
|
||||
"ANSIBLE_STDOUT_CALLBACK": "yaml"
|
||||
"ANSIBLE_STDOUT_CALLBACK": "yaml",
|
||||
"SHELL": "/bin/zsh"
|
||||
},
|
||||
|
||||
"permissions": {
|
||||
|
|
|
|||
|
|
@ -461,6 +461,7 @@ make k8s-deploy
|
|||
- **[Helper Scripts Integration](docs/HELPER_SCRIPTS_INTEGRATION.md)** - LXC deployment guide
|
||||
- **[IPv6 Routing](docs/IPV6_ROUTING_INTEGRATION.md)** - BGP configuration
|
||||
- **[Claude Code Integration](docs/CLAUDE_CODE_INTEGRATION.md)** - AI-assisted development setup
|
||||
- **[Development Environment](docs/DEVELOPMENT_ENVIRONMENT.md)** - Zsh, Oh My Zsh, Antigen setup
|
||||
- **[Architecture Review](ARCHITECTURE_REVIEW.md)** - AI engineering analysis
|
||||
|
||||
---
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ make k8s-deploy # Deploy K8s workloads
|
|||
- 🤖 **[Helper Scripts Integration](docs/HELPER_SCRIPTS_INTEGRATION.md)** - LXC deployment guide
|
||||
- 🌐 **[IPv6 Routing](docs/IPV6_ROUTING_INTEGRATION.md)** - BGP configuration
|
||||
- 🤖 **[Claude Code Integration](docs/CLAUDE_CODE_INTEGRATION.md)** - AI-assisted development setup
|
||||
- 💻 **[Development Environment](docs/DEVELOPMENT_ENVIRONMENT.md)** - Zsh, Oh My Zsh, Antigen setup
|
||||
- 🏗️ **[Terraform Guide](terraform/README.md)** - Infrastructure deployment
|
||||
- 📚 **[Reference Docs](docs/reference/)** - Archived v1.0 documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,596 @@
|
|||
# ORION Development Environment Setup
|
||||
|
||||
**Complete guide for setting up Zsh, Oh My Zsh, Antigen, and Claude Code for ORION infrastructure development**
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Overview
|
||||
|
||||
This guide covers the complete development environment setup for ORION infrastructure, including:
|
||||
|
||||
1. **Zsh Shell** - Modern shell with powerful features
|
||||
2. **Oh My Zsh** - Framework for managing Zsh configuration
|
||||
3. **Antigen** - Plugin manager for Zsh
|
||||
4. **zsh-users plugins** - Essential productivity plugins
|
||||
5. **Claude Code Integration** - AI-assisted development with local server connectivity
|
||||
|
||||
---
|
||||
|
||||
## 📋 Table of Contents
|
||||
|
||||
1. [Quick Start](#quick-start)
|
||||
2. [Zsh Installation](#zsh-installation)
|
||||
3. [Plugin Configuration](#plugin-configuration)
|
||||
4. [ORION-Specific Features](#orion-specific-features)
|
||||
5. [Claude Code Local Server Setup](#claude-code-local-server-setup)
|
||||
6. [SSH Tunneling for Remote Development](#ssh-tunneling-for-remote-development)
|
||||
7. [Customization](#customization)
|
||||
8. [Troubleshooting](#troubleshooting)
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
### Automated Installation
|
||||
|
||||
```bash
|
||||
cd /home/user/luci-macOSX-PROXMOX/shell-config
|
||||
./install-zsh.sh
|
||||
```
|
||||
|
||||
This script will:
|
||||
- ✅ Install Zsh
|
||||
- ✅ Install Oh My Zsh
|
||||
- ✅ Install Antigen
|
||||
- ✅ Install zsh-users plugins
|
||||
- ✅ Configure ORION-specific aliases and functions
|
||||
- ✅ (Optional) Change your default shell to zsh
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Zsh Installation
|
||||
|
||||
### What Gets Installed
|
||||
|
||||
#### 1. **Zsh 5.9** - Modern Shell
|
||||
|
||||
```bash
|
||||
# Installed via apt/yum/dnf
|
||||
zsh --version
|
||||
# Output: zsh 5.9 (x86_64-ubuntu-linux-gnu)
|
||||
```
|
||||
|
||||
#### 2. **Oh My Zsh** - Framework
|
||||
|
||||
**URL**: https://github.com/ohmyzsh/ohmyzsh
|
||||
|
||||
**Included Plugins**:
|
||||
- `git` - Git aliases and functions
|
||||
- `docker` - Docker completions and aliases
|
||||
- `terraform` - Terraform completions
|
||||
- `ansible` - Ansible completions
|
||||
- `kubectl` - Kubernetes completions
|
||||
- `helm` - Helm completions
|
||||
- `sudo` - Double ESC to prepend sudo
|
||||
- `command-not-found` - Suggests package for missing commands
|
||||
- `history` - History management
|
||||
- `z` - Jump to frequently used directories
|
||||
- `colored-man-pages` - Colored man pages
|
||||
- `extract` - Extract any archive with `extract <file>`
|
||||
- `web-search` - Search from terminal (`google query`)
|
||||
|
||||
#### 3. **Antigen** - Plugin Manager
|
||||
|
||||
**URL**: https://github.com/zsh-users/antigen
|
||||
|
||||
**Purpose**: Manages Zsh plugins from GitHub repositories
|
||||
|
||||
#### 4. **zsh-users Plugins**
|
||||
|
||||
**Repository**: https://github.com/orgs/zsh-users/repositories
|
||||
|
||||
**Installed Plugins**:
|
||||
|
||||
| Plugin | Purpose | Example |
|
||||
|--------|---------|---------|
|
||||
| **zsh-syntax-highlighting** | Fish-like syntax highlighting | Commands turn green when valid |
|
||||
| **zsh-autosuggestions** | Fish-like autosuggestions | Shows gray suggestions from history |
|
||||
| **zsh-completions** | Additional completions | More tab-completion options |
|
||||
| **zsh-history-substring-search** | Better history search | Press ↑ to search history by substring |
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Plugin Configuration
|
||||
|
||||
### zsh-autosuggestions
|
||||
|
||||
**Features**:
|
||||
- Suggests commands from history as you type
|
||||
- Press `→` (right arrow) to accept suggestion
|
||||
- Press `Ctrl+F` to accept word-by-word
|
||||
|
||||
**Configuration**:
|
||||
```bash
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#6c757d"
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
||||
```
|
||||
|
||||
### zsh-syntax-highlighting
|
||||
|
||||
**Features**:
|
||||
- Green: Valid command
|
||||
- Red: Invalid command
|
||||
- Magenta: Path
|
||||
- Cyan: Alias
|
||||
|
||||
**Color Scheme**:
|
||||
```bash
|
||||
ZSH_HIGHLIGHT_STYLES[command]='fg=green,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=yellow,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[function]='fg=blue,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=magenta'
|
||||
ZSH_HIGHLIGHT_STYLES[error]='fg=red,bold'
|
||||
```
|
||||
|
||||
### zsh-history-substring-search
|
||||
|
||||
**Keybindings**:
|
||||
```bash
|
||||
↑ / ↓ # Search history by substring
|
||||
Ctrl+P / Ctrl+N # Alternative bindings
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🚀 ORION-Specific Features
|
||||
|
||||
### Environment Variables
|
||||
|
||||
```bash
|
||||
ORION_ROOT="/home/user/luci-macOSX-PROXMOX"
|
||||
TF_LOG="INFO"
|
||||
TF_LOG_PATH="/tmp/terraform.log"
|
||||
ANSIBLE_STDOUT_CALLBACK="yaml"
|
||||
ANSIBLE_FORCE_COLOR=true
|
||||
KUBECONFIG="$HOME/.kube/config"
|
||||
```
|
||||
|
||||
### Navigation Aliases
|
||||
|
||||
| Alias | Command | Description |
|
||||
|-------|---------|-------------|
|
||||
| `orion` | `cd $ORION_ROOT` | Jump to ORION root |
|
||||
| `tf` | `cd $ORION_ROOT/terraform` | Jump to Terraform |
|
||||
| `ans` | `cd $ORION_ROOT/ansible` | Jump to Ansible |
|
||||
| `k8s` | `cd $ORION_ROOT/kubernetes` | Jump to Kubernetes |
|
||||
|
||||
### Infrastructure Aliases
|
||||
|
||||
#### Terraform
|
||||
```bash
|
||||
tfi # terraform init
|
||||
tfp # terraform plan
|
||||
tfa # terraform apply
|
||||
tfd # terraform destroy
|
||||
tfo # terraform output
|
||||
tfs # terraform show
|
||||
```
|
||||
|
||||
#### Ansible
|
||||
```bash
|
||||
ap # ansible-playbook
|
||||
ai # ansible-inventory
|
||||
ag # ansible-galaxy
|
||||
```
|
||||
|
||||
#### Kubernetes
|
||||
```bash
|
||||
k # kubectl
|
||||
kgp # kubectl get pods
|
||||
kgs # kubectl get svc
|
||||
kgn # kubectl get nodes
|
||||
kd # kubectl describe
|
||||
kl # kubectl logs
|
||||
ke # kubectl exec -it
|
||||
```
|
||||
|
||||
#### Docker
|
||||
```bash
|
||||
d # docker
|
||||
dc # docker-compose
|
||||
dps # docker ps
|
||||
dim # docker images
|
||||
```
|
||||
|
||||
#### Make
|
||||
```bash
|
||||
m # make
|
||||
mh # make help
|
||||
mdeploy # make deploy-full
|
||||
mverify # make verify
|
||||
```
|
||||
|
||||
### Custom Functions
|
||||
|
||||
#### `deploy()`
|
||||
Quick deployment of entire ORION stack
|
||||
|
||||
```bash
|
||||
deploy
|
||||
# Output: 🚀 Deploying ORION infrastructure...
|
||||
# Runs: make deploy-full
|
||||
```
|
||||
|
||||
#### `orion-status()`
|
||||
Comprehensive status check
|
||||
|
||||
```bash
|
||||
orion-status
|
||||
# Shows:
|
||||
# - Git status
|
||||
# - Terraform VMs
|
||||
# - Kubernetes nodes
|
||||
```
|
||||
|
||||
#### SSH Functions
|
||||
```bash
|
||||
ssh-router # SSH to VM 200 (Router)
|
||||
ssh-coordinator # SSH to VM 300 (AI Coordinator)
|
||||
ssh-netbox # SSH to VM 500 (NetBox)
|
||||
ssh-k8s-master # SSH to VM 600 (K8s Master)
|
||||
```
|
||||
|
||||
#### Proxmox Functions
|
||||
```bash
|
||||
proxmox-vms # List Proxmox VMs
|
||||
proxmox-lxc # List Proxmox LXC containers
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🌐 Claude Code Local Server Setup
|
||||
|
||||
### Overview
|
||||
|
||||
Claude Code can connect to your local ORION infrastructure server for dependency management, allowing you to:
|
||||
- Run package managers remotely
|
||||
- Execute infrastructure commands
|
||||
- Access local services
|
||||
|
||||
### Method 1: SSH Tunneling (Recommended)
|
||||
|
||||
**Use Case**: Develop locally while executing commands on remote Proxmox host
|
||||
|
||||
#### 1. Setup SSH Tunnel
|
||||
|
||||
On your **local machine**:
|
||||
|
||||
```bash
|
||||
# SSH to Proxmox host with port forwarding
|
||||
ssh -L 8006:192.168.1.100:8006 \
|
||||
-L 8000:192.168.100.50:8000 \
|
||||
-L 6443:192.168.100.60:6443 \
|
||||
root@your-proxmox-host.com
|
||||
```
|
||||
|
||||
**Port Mapping**:
|
||||
- `8006` → Proxmox Web UI
|
||||
- `8000` → NetBox
|
||||
- `6443` → Kubernetes API
|
||||
|
||||
#### 2. Configure Claude Code
|
||||
|
||||
Add to `.claude/settings.local.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"env": {
|
||||
"PROXMOX_API_URL": "https://localhost:8006/api2/json",
|
||||
"NETBOX_URL": "http://localhost:8000",
|
||||
"KUBECONFIG": "/path/to/local/kubeconfig"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
#### 3. Update Terraform Variables
|
||||
|
||||
```bash
|
||||
# terraform/terraform.tfvars
|
||||
pm_api_url = "https://localhost:8006/api2/json"
|
||||
```
|
||||
|
||||
### Method 2: Direct Remote Execution
|
||||
|
||||
**Use Case**: Execute commands directly on Proxmox host
|
||||
|
||||
#### 1. Setup SSH Key Authentication
|
||||
|
||||
On your **local machine**:
|
||||
|
||||
```bash
|
||||
# Generate SSH key (if not exists)
|
||||
ssh-keygen -t ed25519 -C "orion-development"
|
||||
|
||||
# Copy to Proxmox host
|
||||
ssh-copy-id root@your-proxmox-host.com
|
||||
```
|
||||
|
||||
#### 2. Configure Claude Code Remote Execution
|
||||
|
||||
Add to `.claude/settings.json`:
|
||||
|
||||
```json
|
||||
{
|
||||
"hooks": {
|
||||
"preBash": {
|
||||
"enabled": true,
|
||||
"command": "ssh root@proxmox-host.com 'cd /root/orion && {command}'",
|
||||
"description": "Execute commands on remote Proxmox host"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Method 3: VS Code Remote - SSH
|
||||
|
||||
**Use Case**: Full remote development experience
|
||||
|
||||
#### 1. Install VS Code Remote - SSH Extension
|
||||
|
||||
```bash
|
||||
code --install-extension ms-vscode-remote.remote-ssh
|
||||
```
|
||||
|
||||
#### 2. Configure SSH Connection
|
||||
|
||||
Add to `~/.ssh/config`:
|
||||
|
||||
```
|
||||
Host orion-proxmox
|
||||
HostName your-proxmox-host.com
|
||||
User root
|
||||
ForwardAgent yes
|
||||
LocalForward 8006 192.168.1.100:8006
|
||||
LocalForward 8000 192.168.100.50:8000
|
||||
LocalForward 6443 192.168.100.60:6443
|
||||
```
|
||||
|
||||
#### 3. Connect to Remote Host
|
||||
|
||||
```bash
|
||||
# In VS Code:
|
||||
# 1. Cmd/Ctrl + Shift + P
|
||||
# 2. "Remote-SSH: Connect to Host"
|
||||
# 3. Select "orion-proxmox"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔌 SSH Tunneling for Remote Development
|
||||
|
||||
### Persistent SSH Tunnel with autossh
|
||||
|
||||
#### Install autossh
|
||||
|
||||
```bash
|
||||
# Ubuntu/Debian
|
||||
sudo apt-get install autossh
|
||||
|
||||
# macOS
|
||||
brew install autossh
|
||||
```
|
||||
|
||||
#### Create Persistent Tunnel
|
||||
|
||||
```bash
|
||||
autossh -M 0 -f -N \
|
||||
-L 8006:192.168.1.100:8006 \
|
||||
-L 8000:192.168.100.50:8000 \
|
||||
-L 6443:192.168.100.60:6443 \
|
||||
-o "ServerAliveInterval 30" \
|
||||
-o "ServerAliveCountMax 3" \
|
||||
root@your-proxmox-host.com
|
||||
```
|
||||
|
||||
#### Systemd Service (Linux)
|
||||
|
||||
Create `/etc/systemd/system/orion-tunnel.service`:
|
||||
|
||||
```ini
|
||||
[Unit]
|
||||
Description=ORION SSH Tunnel
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=youruser
|
||||
ExecStart=/usr/bin/autossh -M 0 -N \
|
||||
-L 8006:192.168.1.100:8006 \
|
||||
-L 8000:192.168.100.50:8000 \
|
||||
-L 6443:192.168.100.60:6443 \
|
||||
-o "ServerAliveInterval 30" \
|
||||
-o "ServerAliveCountMax 3" \
|
||||
root@your-proxmox-host.com
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
```
|
||||
|
||||
Enable and start:
|
||||
|
||||
```bash
|
||||
sudo systemctl enable orion-tunnel
|
||||
sudo systemctl start orion-tunnel
|
||||
sudo systemctl status orion-tunnel
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎨 Customization
|
||||
|
||||
### Personal Overrides
|
||||
|
||||
Create `.claude/settings.local.json` for personal preferences:
|
||||
|
||||
```json
|
||||
{
|
||||
"model": "opus",
|
||||
"statusLine": "🏗️ {user}@ORION | {model}",
|
||||
|
||||
"env": {
|
||||
"MY_PROXMOX_HOST": "192.168.1.100",
|
||||
"MY_CUSTOM_VAR": "value"
|
||||
},
|
||||
|
||||
"permissions": {
|
||||
"defaultMode": "allow"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Custom Zsh Aliases
|
||||
|
||||
Add to `~/.zshrc` (at the end):
|
||||
|
||||
```bash
|
||||
# Your custom aliases
|
||||
alias myalias='your-command'
|
||||
|
||||
# Your custom functions
|
||||
my-function() {
|
||||
echo "My custom function"
|
||||
}
|
||||
```
|
||||
|
||||
Or create `~/.zshrc.local` and source it:
|
||||
|
||||
```bash
|
||||
# Add to ~/.zshrc
|
||||
[ -f ~/.zshrc.local ] && source ~/.zshrc.local
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Troubleshooting
|
||||
|
||||
### Issue: Plugins not loading
|
||||
|
||||
**Symptom**: zsh-autosuggestions or syntax-highlighting not working
|
||||
|
||||
**Solution**:
|
||||
|
||||
```bash
|
||||
# Reinstall Antigen plugins
|
||||
rm -rf ~/.antigen
|
||||
zsh # Restart zsh - plugins will reinstall
|
||||
```
|
||||
|
||||
### Issue: Slow shell startup
|
||||
|
||||
**Symptom**: Zsh takes several seconds to start
|
||||
|
||||
**Solution**:
|
||||
|
||||
```bash
|
||||
# Disable unnecessary plugins in ~/.zshrc
|
||||
# Comment out plugins you don't need
|
||||
plugins=(
|
||||
git
|
||||
# docker # Disabled for faster startup
|
||||
terraform
|
||||
# ...
|
||||
)
|
||||
```
|
||||
|
||||
### Issue: SSH tunnel disconnects
|
||||
|
||||
**Symptom**: Local services become unreachable
|
||||
|
||||
**Solution**:
|
||||
|
||||
```bash
|
||||
# Check tunnel status
|
||||
ps aux | grep ssh
|
||||
|
||||
# Restart autossh service
|
||||
sudo systemctl restart orion-tunnel
|
||||
|
||||
# Or manually reconnect
|
||||
ssh -L 8006:192.168.1.100:8006 root@proxmox-host.com
|
||||
```
|
||||
|
||||
### Issue: Claude Code can't connect to local server
|
||||
|
||||
**Symptom**: Connection refused errors
|
||||
|
||||
**Solution**:
|
||||
|
||||
1. **Verify tunnel is active**:
|
||||
```bash
|
||||
curl -k https://localhost:8006/api2/json/version
|
||||
```
|
||||
|
||||
2. **Check firewall**:
|
||||
```bash
|
||||
# Allow local binding
|
||||
ufw allow from 127.0.0.1
|
||||
```
|
||||
|
||||
3. **Verify settings**:
|
||||
```bash
|
||||
cat .claude/settings.local.json
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Additional Resources
|
||||
|
||||
### Documentation
|
||||
|
||||
- **[ARCHITECTURE.md](../ARCHITECTURE.md)** - Main infrastructure documentation
|
||||
- **[CLAUDE_CODE_INTEGRATION.md](CLAUDE_CODE_INTEGRATION.md)** - Claude Code configuration
|
||||
- **[Makefile](../Makefile)** - Deployment commands
|
||||
|
||||
### External Resources
|
||||
|
||||
- **[Oh My Zsh](https://ohmyz.sh/)** - Framework homepage
|
||||
- **[Antigen](https://github.com/zsh-users/antigen)** - Plugin manager
|
||||
- **[zsh-users](https://github.com/orgs/zsh-users/repositories)** - Plugin repositories
|
||||
- **[Claude Code Docs](https://code.claude.com/docs/)** - Official documentation
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Quick Reference
|
||||
|
||||
### Zsh Shortcuts
|
||||
|
||||
```bash
|
||||
Ctrl+A # Move to beginning of line
|
||||
Ctrl+E # Move to end of line
|
||||
Ctrl+U # Delete from cursor to beginning
|
||||
Ctrl+K # Delete from cursor to end
|
||||
Ctrl+R # Reverse search history
|
||||
Ctrl+L # Clear screen
|
||||
Alt+. # Insert last argument
|
||||
```
|
||||
|
||||
### ORION Quick Commands
|
||||
|
||||
```bash
|
||||
orion-status # Full status check
|
||||
deploy # Deploy everything
|
||||
orion # cd to ORION root
|
||||
m help # Show make targets
|
||||
k get pods # List K8s pods
|
||||
tfp # Terraform plan
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-11-22
|
||||
**Status**: Active
|
||||
**Maintained By**: ORION Infrastructure Team
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
# ORION Infrastructure - Zsh Configuration
|
||||
# Optimized for infrastructure development with Oh My Zsh + Antigen
|
||||
|
||||
# ============================================================================
|
||||
# Oh My Zsh Base Configuration
|
||||
# ============================================================================
|
||||
|
||||
# Path to your Oh My Zsh installation
|
||||
export ZSH="$HOME/.oh-my-zsh"
|
||||
|
||||
# Theme
|
||||
ZSH_THEME="agnoster" # Better theme for infrastructure work
|
||||
|
||||
# Update behavior
|
||||
zstyle ':omz:update' mode auto
|
||||
zstyle ':omz:update' frequency 7
|
||||
|
||||
# Completion waiting dots
|
||||
COMPLETION_WAITING_DOTS="true"
|
||||
|
||||
# Command execution timestamp
|
||||
HIST_STAMPS="yyyy-mm-dd"
|
||||
|
||||
# Plugins from Oh My Zsh
|
||||
plugins=(
|
||||
git
|
||||
docker
|
||||
terraform
|
||||
ansible
|
||||
kubectl
|
||||
helm
|
||||
sudo
|
||||
command-not-found
|
||||
history
|
||||
z
|
||||
colored-man-pages
|
||||
extract
|
||||
web-search
|
||||
)
|
||||
|
||||
# Load Oh My Zsh
|
||||
source $ZSH/oh-my-zsh.sh
|
||||
|
||||
# ============================================================================
|
||||
# Antigen Configuration (zsh-users plugins)
|
||||
# ============================================================================
|
||||
|
||||
# Load Antigen
|
||||
source ~/antigen.zsh
|
||||
|
||||
# Load oh-my-zsh library
|
||||
antigen use oh-my-zsh
|
||||
|
||||
# zsh-users plugins (https://github.com/orgs/zsh-users/repositories)
|
||||
antigen bundle zsh-users/zsh-syntax-highlighting # Fish-like syntax highlighting
|
||||
antigen bundle zsh-users/zsh-autosuggestions # Fish-like autosuggestions
|
||||
antigen bundle zsh-users/zsh-completions # Additional completions
|
||||
antigen bundle zsh-users/zsh-history-substring-search # Better history search
|
||||
|
||||
# Apply Antigen configuration
|
||||
antigen apply
|
||||
|
||||
# ============================================================================
|
||||
# zsh-users Plugin Configuration
|
||||
# ============================================================================
|
||||
|
||||
# zsh-autosuggestions
|
||||
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#6c757d"
|
||||
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
|
||||
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
|
||||
|
||||
# zsh-syntax-highlighting
|
||||
typeset -A ZSH_HIGHLIGHT_STYLES
|
||||
ZSH_HIGHLIGHT_STYLES[command]='fg=green,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[alias]='fg=cyan,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[builtin]='fg=yellow,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[function]='fg=blue,bold'
|
||||
ZSH_HIGHLIGHT_STYLES[path]='fg=magenta'
|
||||
ZSH_HIGHLIGHT_STYLES[error]='fg=red,bold'
|
||||
|
||||
# zsh-history-substring-search (bind keys)
|
||||
bindkey '^[[A' history-substring-search-up
|
||||
bindkey '^[[B' history-substring-search-down
|
||||
bindkey '^P' history-substring-search-up
|
||||
bindkey '^N' history-substring-search-down
|
||||
|
||||
# ============================================================================
|
||||
# Environment Variables for ORION
|
||||
# ============================================================================
|
||||
|
||||
# ORION project root
|
||||
export ORION_ROOT="/home/user/luci-macOSX-PROXMOX"
|
||||
|
||||
# Terraform
|
||||
export TF_LOG="INFO"
|
||||
export TF_LOG_PATH="/tmp/terraform.log"
|
||||
|
||||
# Ansible
|
||||
export ANSIBLE_STDOUT_CALLBACK="yaml"
|
||||
export ANSIBLE_FORCE_COLOR=true
|
||||
|
||||
# Kubernetes
|
||||
export KUBECONFIG="$HOME/.kube/config"
|
||||
|
||||
# ============================================================================
|
||||
# Aliases for ORION Infrastructure
|
||||
# ============================================================================
|
||||
|
||||
# Navigation
|
||||
alias orion='cd $ORION_ROOT'
|
||||
alias tf='cd $ORION_ROOT/terraform'
|
||||
alias ans='cd $ORION_ROOT/ansible'
|
||||
alias k8s='cd $ORION_ROOT/kubernetes'
|
||||
|
||||
# Terraform shortcuts
|
||||
alias tfi='terraform init'
|
||||
alias tfp='terraform plan'
|
||||
alias tfa='terraform apply'
|
||||
alias tfd='terraform destroy'
|
||||
alias tfo='terraform output'
|
||||
alias tfs='terraform show'
|
||||
|
||||
# Ansible shortcuts
|
||||
alias ap='ansible-playbook'
|
||||
alias ai='ansible-inventory'
|
||||
alias ag='ansible-galaxy'
|
||||
|
||||
# Kubectl shortcuts
|
||||
alias k='kubectl'
|
||||
alias kgp='kubectl get pods'
|
||||
alias kgs='kubectl get svc'
|
||||
alias kgn='kubectl get nodes'
|
||||
alias kd='kubectl describe'
|
||||
alias kl='kubectl logs'
|
||||
alias ke='kubectl exec -it'
|
||||
|
||||
# Docker shortcuts
|
||||
alias d='docker'
|
||||
alias dc='docker-compose'
|
||||
alias dps='docker ps'
|
||||
alias dim='docker images'
|
||||
|
||||
# Make shortcuts
|
||||
alias m='make'
|
||||
alias mh='make help'
|
||||
alias mdeploy='make deploy-full'
|
||||
alias mverify='make verify'
|
||||
|
||||
# Git shortcuts (enhanced)
|
||||
alias gs='git status'
|
||||
alias ga='git add'
|
||||
alias gc='git commit'
|
||||
alias gp='git push'
|
||||
alias gl='git log --oneline --graph --decorate'
|
||||
alias gd='git diff'
|
||||
|
||||
# System shortcuts
|
||||
alias ll='ls -lah'
|
||||
alias la='ls -A'
|
||||
alias l='ls -CF'
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
|
||||
# ============================================================================
|
||||
# Functions for ORION Infrastructure
|
||||
# ============================================================================
|
||||
|
||||
# Quick deploy function
|
||||
deploy() {
|
||||
echo "🚀 Deploying ORION infrastructure..."
|
||||
cd $ORION_ROOT
|
||||
make deploy-full
|
||||
}
|
||||
|
||||
# Quick status check
|
||||
orion-status() {
|
||||
echo "📊 ORION Infrastructure Status"
|
||||
echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
cd $ORION_ROOT
|
||||
echo "\n📁 Git Status:"
|
||||
git status --short
|
||||
echo "\n🏗️ Terraform Status:"
|
||||
cd terraform && terraform show -json 2>/dev/null | jq -r '.values.root_module.resources[] | select(.type == "proxmox_vm_qemu") | "\(.values.name) (VM \(.values.vmid))"' || echo "No Terraform state"
|
||||
echo "\n☸️ Kubernetes Status (if running):"
|
||||
kubectl get nodes 2>/dev/null || echo "K8s cluster not accessible"
|
||||
}
|
||||
|
||||
# SSH to VMs
|
||||
ssh-router() {
|
||||
ssh root@192.168.100.1
|
||||
}
|
||||
|
||||
ssh-coordinator() {
|
||||
ssh root@192.168.100.30
|
||||
}
|
||||
|
||||
ssh-netbox() {
|
||||
ssh root@192.168.100.50
|
||||
}
|
||||
|
||||
ssh-k8s-master() {
|
||||
ssh root@192.168.100.60
|
||||
}
|
||||
|
||||
# Proxmox helper
|
||||
proxmox-vms() {
|
||||
echo "📦 Proxmox VMs:"
|
||||
qm list 2>/dev/null || echo "Not connected to Proxmox host"
|
||||
}
|
||||
|
||||
# LXC helper
|
||||
proxmox-lxc() {
|
||||
echo "📦 Proxmox LXC Containers:"
|
||||
pct list 2>/dev/null || echo "Not connected to Proxmox host"
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# User Configuration
|
||||
# ============================================================================
|
||||
|
||||
# Preferred editor
|
||||
export EDITOR='nano'
|
||||
export VISUAL='nano'
|
||||
|
||||
# Language environment
|
||||
export LANG=en_US.UTF-8
|
||||
|
||||
# Compilation flags
|
||||
export ARCHFLAGS="-arch x86_64"
|
||||
|
||||
# History settings
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
setopt HIST_FIND_NO_DUPS
|
||||
setopt SHARE_HISTORY
|
||||
|
||||
# ============================================================================
|
||||
# Welcome Message
|
||||
# ============================================================================
|
||||
|
||||
echo "╔═══════════════════════════════════════════════════════════════╗"
|
||||
echo "║ 🚀 ORION Infrastructure Development Shell ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "📘 Main docs: ARCHITECTURE.md"
|
||||
echo "🔧 Deploy: make deploy-full or deploy"
|
||||
echo "📊 Status: orion-status"
|
||||
echo "💡 Quick nav: orion, tf, ans, k8s"
|
||||
echo "⚡ Shortcuts: m (make), k (kubectl), tf* (terraform)"
|
||||
echo ""
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
# ORION Shell Configuration
|
||||
|
||||
**Zsh + Oh My Zsh + Antigen + zsh-users plugins for infrastructure development**
|
||||
|
||||
---
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
```bash
|
||||
# Run the installation script
|
||||
./install-zsh.sh
|
||||
|
||||
# Start zsh
|
||||
zsh
|
||||
|
||||
# Or set as default shell (requires logout)
|
||||
chsh -s $(which zsh)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📦 What's Included
|
||||
|
||||
- **Zsh 5.9** - Modern shell
|
||||
- **Oh My Zsh** - Framework with 14+ infrastructure plugins
|
||||
- **Antigen** - Plugin manager
|
||||
- **zsh-users plugins**:
|
||||
- `zsh-syntax-highlighting` - Fish-like syntax highlighting
|
||||
- `zsh-autosuggestions` - Fish-like autosuggestions
|
||||
- `zsh-completions` - Additional completions
|
||||
- `zsh-history-substring-search` - Better history search
|
||||
|
||||
---
|
||||
|
||||
## 📁 Files
|
||||
|
||||
```
|
||||
shell-config/
|
||||
├── .zshrc # Complete Zsh configuration
|
||||
├── antigen.zsh # Antigen plugin manager
|
||||
├── install-zsh.sh # Automated installation script
|
||||
└── README.md # This file
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Features
|
||||
|
||||
### Infrastructure Aliases
|
||||
|
||||
```bash
|
||||
# Navigation
|
||||
orion, tf, ans, k8s
|
||||
|
||||
# Terraform
|
||||
tfi, tfp, tfa, tfd, tfo, tfs
|
||||
|
||||
# Kubernetes
|
||||
k, kgp, kgs, kgn, kd, kl, ke
|
||||
|
||||
# Make
|
||||
m, mh, mdeploy, mverify
|
||||
```
|
||||
|
||||
### Custom Functions
|
||||
|
||||
```bash
|
||||
deploy() # Quick deploy ORION stack
|
||||
orion-status() # Complete infrastructure status
|
||||
ssh-router() # SSH to router VM
|
||||
ssh-coordinator() # SSH to AI coordinator
|
||||
ssh-netbox() # SSH to NetBox
|
||||
ssh-k8s-master() # SSH to K8s master
|
||||
proxmox-vms() # List Proxmox VMs
|
||||
proxmox-lxc() # List LXC containers
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📚 Documentation
|
||||
|
||||
See **[docs/DEVELOPMENT_ENVIRONMENT.md](../docs/DEVELOPMENT_ENVIRONMENT.md)** for complete documentation including:
|
||||
|
||||
- Detailed installation guide
|
||||
- Plugin configuration
|
||||
- Claude Code integration
|
||||
- SSH tunneling for remote development
|
||||
- Customization options
|
||||
- Troubleshooting
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Manual Installation
|
||||
|
||||
If you prefer manual installation:
|
||||
|
||||
```bash
|
||||
# 1. Install Zsh
|
||||
sudo apt-get install zsh git curl wget
|
||||
|
||||
# 2. Install Oh My Zsh
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
|
||||
# 3. Install Antigen
|
||||
curl -L git.io/antigen > ~/antigen.zsh
|
||||
|
||||
# 4. Copy configuration
|
||||
cp .zshrc ~/.zshrc
|
||||
cp antigen.zsh ~/antigen.zsh
|
||||
|
||||
# 5. Start zsh
|
||||
zsh
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 💡 Quick Tips
|
||||
|
||||
**Autosuggestions**: Type a few letters, press `→` to accept
|
||||
|
||||
**Syntax Highlighting**: Green = valid command, Red = invalid
|
||||
|
||||
**History Search**: Press `↑` to search history by substring
|
||||
|
||||
**Quick Deploy**: Just type `deploy`
|
||||
|
||||
**Status Check**: Type `orion-status` for complete overview
|
||||
|
||||
---
|
||||
|
||||
**Last Updated**: 2025-11-22
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,108 @@
|
|||
#!/bin/bash
|
||||
# ORION Infrastructure - Zsh Setup Script
|
||||
# Installs Oh My Zsh + Antigen + zsh-users plugins
|
||||
|
||||
set -e
|
||||
|
||||
echo "╔═══════════════════════════════════════════════════════════════╗"
|
||||
echo "║ 🚀 ORION Infrastructure - Zsh Setup ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
|
||||
# Check if running as root
|
||||
if [ "$EUID" -ne 0 ]; then
|
||||
SUDO="sudo"
|
||||
else
|
||||
SUDO=""
|
||||
fi
|
||||
|
||||
# 1. Install Zsh
|
||||
echo "📦 Installing Zsh..."
|
||||
if ! command -v zsh &> /dev/null; then
|
||||
if command -v apt-get &> /dev/null; then
|
||||
$SUDO apt-get update && $SUDO apt-get install -y zsh git curl wget jq
|
||||
elif command -v yum &> /dev/null; then
|
||||
$SUDO yum install -y zsh git curl wget jq
|
||||
elif command -v dnf &> /dev/null; then
|
||||
$SUDO dnf install -y zsh git curl wget jq
|
||||
else
|
||||
echo "❌ Unsupported package manager. Please install zsh manually."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "✅ Zsh already installed: $(zsh --version)"
|
||||
fi
|
||||
|
||||
# 2. Install Oh My Zsh
|
||||
echo ""
|
||||
echo "📦 Installing Oh My Zsh..."
|
||||
if [ ! -d "$HOME/.oh-my-zsh" ]; then
|
||||
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" "" --unattended
|
||||
echo "✅ Oh My Zsh installed"
|
||||
else
|
||||
echo "✅ Oh My Zsh already installed"
|
||||
fi
|
||||
|
||||
# 3. Install Antigen
|
||||
echo ""
|
||||
echo "📦 Installing Antigen..."
|
||||
if [ ! -f "$HOME/antigen.zsh" ]; then
|
||||
curl -L git.io/antigen > "$HOME/antigen.zsh"
|
||||
echo "✅ Antigen installed"
|
||||
else
|
||||
echo "✅ Antigen already installed"
|
||||
fi
|
||||
|
||||
# 4. Backup existing .zshrc
|
||||
if [ -f "$HOME/.zshrc" ]; then
|
||||
echo ""
|
||||
echo "📝 Backing up existing .zshrc to .zshrc.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
cp "$HOME/.zshrc" "$HOME/.zshrc.backup.$(date +%Y%m%d_%H%M%S)"
|
||||
fi
|
||||
|
||||
# 5. Install ORION .zshrc
|
||||
echo ""
|
||||
echo "📝 Installing ORION .zshrc configuration..."
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cp "$SCRIPT_DIR/.zshrc" "$HOME/.zshrc"
|
||||
cp "$SCRIPT_DIR/antigen.zsh" "$HOME/antigen.zsh"
|
||||
echo "✅ Configuration installed"
|
||||
|
||||
# 6. Change default shell to zsh (optional)
|
||||
echo ""
|
||||
read -p "⚠️ Change default shell to zsh? (requires logout to take effect) [y/N]: " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
if command -v chsh &> /dev/null; then
|
||||
$SUDO chsh -s $(which zsh) $USER
|
||||
echo "✅ Default shell changed to zsh (restart your session)"
|
||||
else
|
||||
echo "⚠️ chsh command not found. Add 'exec zsh' to your .bashrc to auto-switch"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "╔═══════════════════════════════════════════════════════════════╗"
|
||||
echo "║ ✅ Installation Complete! ║"
|
||||
echo "╚═══════════════════════════════════════════════════════════════╝"
|
||||
echo ""
|
||||
echo "🎯 Next steps:"
|
||||
echo " 1. Start zsh: zsh"
|
||||
echo " 2. Or logout and login again if you changed default shell"
|
||||
echo " 3. Plugins will auto-install on first run"
|
||||
echo ""
|
||||
echo "📚 Included features:"
|
||||
echo " ✅ Oh My Zsh with 14+ plugins"
|
||||
echo " ✅ Antigen plugin manager"
|
||||
echo " ✅ zsh-users/zsh-syntax-highlighting"
|
||||
echo " ✅ zsh-users/zsh-autosuggestions"
|
||||
echo " ✅ zsh-users/zsh-completions"
|
||||
echo " ✅ zsh-users/zsh-history-substring-search"
|
||||
echo " ✅ Custom ORION aliases and functions"
|
||||
echo ""
|
||||
echo "💡 Try these commands:"
|
||||
echo " orion-status # Check ORION infrastructure status"
|
||||
echo " deploy # Quick deploy"
|
||||
echo " orion # cd to ORION root"
|
||||
echo " tf, ans, k8s # Navigate to directories"
|
||||
echo ""
|
||||
Loading…
Reference in New Issue