diff --git a/README.md b/README.md index dc027efe..83f6de5a 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,3 @@ - -Sample Java Applicaiton V1.7 -ravi change - +Updated by Emmanuel M +Version 2.2 +June 2020 diff --git a/commands b/commands new file mode 100644 index 00000000..64275527 --- /dev/null +++ b/commands @@ -0,0 +1,24 @@ + +Based on your config, the project was generated at: + +``` +~/my-project/ +``` + +That's what `output_dir` was set to. So your full project path would be: + +``` +~/my-project/mycontext-onboarding-api/ +``` + +**Verify:** +``` +ls ~/my-project/ +``` + +If you see the folder, then: +``` +ls ~/my-project/mycontext-onboarding-api/ +``` + +This will show you the generated project structure. Paste the output so we can start working on the app code. diff --git a/systemSetUp.txt b/systemSetUp.txt new file mode 100644 index 00000000..73d2f95b --- /dev/null +++ b/systemSetUp.txt @@ -0,0 +1,589 @@ +================================================================================ + SENIOR DEVOPS ENGINEER - MACBOOK PRO SETUP GUIDE 2026 + Complete Step-by-Step Command Reference + Follow each phase in order. Do NOT skip steps. +================================================================================ + + +================================================================================ + PHASE 1 - XCODE COMMAND LINE TOOLS + (Required before everything else) +================================================================================ + +STEP 1 - Install Xcode CLI tools +A popup window will appear on screen - click "Install" and wait for it to finish. + + xcode-select --install + +STEP 2 - Verify it installed correctly +You should see a path like /Library/Developer/CommandLineTools + + xcode-select -p + +NOTE: Do NOT move to Phase 2 until the Xcode install popup says it is complete. + + +================================================================================ + PHASE 2 - HOMEBREW + (The Mac package manager - everything else depends on this) +================================================================================ + +STEP 3 - Install Homebrew + + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + +STEP 4 - Add Homebrew to your PATH (Apple Silicon Macs only - M1/M2/M3/M4) +Run 'uname -m' first. If it says arm64, you are on Apple Silicon. Run these two lines: + + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile + + eval "$(/opt/homebrew/bin/brew shellenv)" + +NOTE: If 'uname -m' says x86_64 you are on Intel - skip Step 4, Homebrew is +already on your PATH automatically. + +STEP 5 - Verify Homebrew is healthy + + brew doctor + +You should see: "Your system is ready to brew." + + +================================================================================ + PHASE 3 - GUI APPLICATIONS + (Ghostty terminal, Docker, Raycast launcher, Cursor editor) +================================================================================ + +STEP 6 - Install all GUI applications + + brew install --cask ghostty docker raycast cursor + +STEP 7 - Open Docker from your Applications folder and complete the setup wizard. +Then verify Docker is running: + + docker --version + + docker run hello-world + +STEP 8 - In Docker Desktop go to Settings > Resources and set: + - CPUs: 4 + - Memory: 8 GB + +IMPORTANT: After Ghostty installs, open it from /Applications and use it +as your terminal for all remaining steps. It has Nerd Font icons built in. + + +================================================================================ + PHASE 4 - CORE PLATFORM AND INFRASTRUCTURE TOOLS + (kubectl, helm, k9s, tenv, stern) +================================================================================ + +STEP 9 - Install all core platform tools in one command + + brew install kubectl helm kubectx k9s tenv stern + +STEP 10 - Verify kubectl installed + + kubectl version --client + +STEP 11 - Verify k9s installed + + k9s version + +STEP 12 - Install latest stable Terraform via tenv +(tenv replaces tfenv and tofuenv - manages Terraform, OpenTofu and Terragrunt) + + tenv tf install latest + + tenv tf use latest + +STEP 13 - Verify Terraform + + terraform version + + +================================================================================ + PHASE 5 - SECRETS AND ENVIRONMENT MANAGEMENT + (SOPS, age, direnv - the senior edge) +================================================================================ + +STEP 14 - Install the three tools + + brew install sops age direnv + +STEP 15 - Create the directory for your age key + + mkdir -p ~/.config/sops/age + +STEP 16 - Generate your personal age encryption key + + age-keygen -o ~/.config/sops/age/keys.txt + +STEP 17 - View your public key (you will need this in the next step) + + age-keygen -y ~/.config/sops/age/keys.txt + +The output will look like: age1xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +Copy that full string. + +STEP 18 - Create your SOPS config file +Replace AGE1YOURPUBLICKEYHERE with the public key from Step 17: + + cat > ~/.sops.yaml << 'EOF' +creation_rules: + - age: age1YOURPUBLICKEYHERE +EOF + +WARNING: Back up ~/.config/sops/age/keys.txt somewhere safe (password manager, +encrypted USB). If you lose this file you cannot decrypt any secrets you encrypt. +NEVER commit it to Git. + + +================================================================================ + PHASE 6 - HIGH PERFORMANCE CLI AND NETWORKING TOOLS + (starship, zoxide, fzf, bat, eza, mtr, git-delta and more) +================================================================================ + +STEP 19 - Install all CLI tools in one command + + brew install starship zoxide fzf bat eza jq yq tldr mtr curl watch htop git-delta + +STEP 20 - Set up fzf key bindings +When prompted, press y to enable key bindings and press y to enable fuzzy completion. + + $(brew --prefix)/opt/fzf/install + + +================================================================================ + PHASE 7 - CLOUD CLIs + (AWS, Azure, Google Cloud) +================================================================================ + +STEP 21 - Install AWS and Azure CLIs + + brew install awscli azure-cli + +STEP 22 - Install Google Cloud SDK + + brew install --cask google-cloud-sdk + +STEP 23 - Verify AWS CLI + + aws --version + +STEP 24 - Configure AWS for your first client profile +Replace 'client-name' with the actual profile name you want to use. +You will be prompted for: Access Key ID, Secret Access Key, Region, Output format. + + aws configure --profile client-name + +NOTE: Always use --profile and never configure a default profile. +Running commands without --profile in the wrong account causes incidents. + + +================================================================================ + PHASE 8 - SECURITY AND CODE QUALITY + (trivy, pre-commit, k6) +================================================================================ + +STEP 25 - Install security and quality tools + + brew install trivy pre-commit k6 + +STEP 26 - Verify trivy by scanning a public image + + trivy image nginx:latest + +STEP 27 - Verify k6 + + k6 version + + +================================================================================ + PHASE 9 - SHELL CONFIGURATION + (Your complete ~/.zshrc file) +================================================================================ + +STEP 28 - Write your complete ~/.zshrc +Copy and paste this entire block into your terminal as one command: + + cat > ~/.zshrc << 'ZSHRC' +# --- INIT --- +eval "$(starship init zsh)" +eval "$(zoxide init zsh)" +eval "$(direnv hook zsh)" +source <(fzf --zsh) + +# --- KUBERNETES --- +alias k='kubectl' +alias ks='k9s' +alias kctx='kubectx' +alias kns='kubens' +alias kl='kubectl logs -f' +alias kls='stern' +alias ke='kubectl exec -it' +alias kdebug='kubectl run -i --tty --rm debug --image=busybox --restart=Never -- sh' + +# --- DOCKER --- +alias d='docker' +alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"' +alias dclean='docker system prune -f' +alias dstats='docker stats --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}"' + +# --- GIT --- +alias g='git' +alias gs='git status -sb' +alias ga='git add .' +alias gcm='git commit -m' +alias gp='git push' +alias gl='git log --oneline --graph --all' +alias gundo='git reset --soft HEAD~1' +alias gd='git diff' +export GIT_PAGER='delta' + +# --- CLOUD ACCOUNT VERIFICATION --- +alias whoami-aws='aws sts get-caller-identity' +alias whoami-k8s='kubectl config current-context' + +# --- SYSTEM --- +alias ls='eza --icons --group-directories-first' +alias ccat='bat' +alias ..='cd ..' +alias ...='cd ../..' +alias path='echo $PATH | tr ":" "\n"' + +ZSHRC + +STEP 29 - Reload your shell to apply the changes + + source ~/.zshrc + +NOTE: We use 'ccat' instead of aliasing 'cat' to avoid breaking system scripts +that rely on standard POSIX cat behaviour. + + +================================================================================ + PHASE 10 - FANCY COLOURFUL TERMINAL PROMPT (STARSHIP) + (Shows OS, git status, kubernetes context, AWS profile, language versions) +================================================================================ + +STEP 30 - Create the config directory + + mkdir -p ~/.config + +STEP 31 - Write the full Starship config +Copy and paste this entire block into your terminal as one command: + + cat > ~/.config/starship.toml << 'TOML' +format = """ +[╭─](bold green)$os$username$hostname$directory$git_branch$git_status$kubernetes$aws$terraform$python$nodejs +[╰─](bold green)$character""" + +palette = "custom" + +[palettes.custom] +green = "#1D9E75" +blue = "#378ADD" +purple = "#7F77DD" +orange = "#EF9F27" +red = "#E24B4A" +cyan = "#1D8E9E" + +[os] +disabled = false +style = "bold blue" + +[os.symbols] +Macos = " " + +[username] +show_always = true +style_user = "bold cyan" +format = "[$user]($style)[@](dimmed white)" + +[hostname] +ssh_only = false +format = "[$hostname](bold cyan) " + +[directory] +style = "bold blue" +format = "[ $path]($style)[$read_only]($read_only_style) " +truncation_length = 4 +truncate_to_repo = true +read_only = " " + +[git_branch] +symbol = " " +style = "bold purple" +format = "[$symbol$branch]($style) " + +[git_status] +style = "bold yellow" +conflicted = "⚡" +ahead = "⇡${count}" +behind = "⇣${count}" +diverged = "⇕⇡${ahead_count}⇣${behind_count}" +up_to_date = " ✓" +untracked = " ?" +stashed = " " +modified = " !" +staged = " +" +renamed = " »" +deleted = " ✘" +format = '([$all_status$ahead_behind]($style) )' + +[kubernetes] +symbol = "☸ " +style = "bold cyan" +format = "[$symbol$context(\($namespace\))]($style) " +disabled = false + +[aws] +symbol = " " +style = "bold yellow" +format = "[$symbol$profile(\($region\))]($style) " +disabled = false + +[terraform] +symbol = "💠 " +style = "bold purple" +format = "[$symbol$workspace]($style) " +disabled = false + +[python] +symbol = " " +style = "bold yellow" +format = "[$symbol$version]($style) " + +[nodejs] +symbol = " " +style = "bold green" +format = "[$symbol$version]($style) " + +[character] +success_symbol = "[❯](bold green)" +error_symbol = "[❯](bold red)" +vimcmd_symbol = "[❮](bold green)" +TOML + +STEP 32 - Reload to see your new prompt + + source ~/.zshrc + +Your prompt will now look like this: +╭─ you@macbook ~/projects/client main ✓ ☸ prod-cluster eu-west-2 +╰─ ❯ + + +================================================================================ + PHASE 11 - GHOSTTY TERMINAL CONFIGURATION + (Dark theme, font size, opacity, cursor) +================================================================================ + +STEP 33 - Create the Ghostty config directory + + mkdir -p ~/.config/ghostty + +STEP 34 - Write the Ghostty config + + cat > ~/.config/ghostty/config << 'GHOSTTY' +theme = catppuccin-mocha +font-size = 14 +background-opacity = 0.96 +cursor-style = block +cursor-style-blink = true +shell-integration = zsh +window-padding-x = 12 +window-padding-y = 8 +scrollback-limit = 10000 +GHOSTTY + +STEP 35 - Fully quit Ghostty and reopen it to apply the config +Press Cmd+Q to quit, then open from Applications again. + +NOTE: The catppuccin-mocha theme is a dark purple and teal colour scheme that +works beautifully with the Starship prompt. Ghostty includes Nerd Fonts natively +so icons render without any extra font installation. + + +================================================================================ + PHASE 12 - DIRENV PROJECT WORKFLOW + (Auto-switch AWS profiles and Kubernetes contexts per project) +================================================================================ + +STEP 36 - Create a project folder and add a .envrc file +Replace 'client-name' and values with your actual project details: + + mkdir -p ~/projects/client-name + + cd ~/projects/client-name + + cat > .envrc << 'EOF' +export AWS_PROFILE=client-prod +export AWS_REGION=eu-west-2 +export KUBECONFIG=~/.kube/client-prod-config +export TF_WORKSPACE=production +EOF + +STEP 37 - Allow direnv to load this project's .envrc + + direnv allow . + +STEP 38 - Test that it works + + whoami-aws + + whoami-k8s + +HOW IT WORKS: +Every time you cd into this project folder your AWS profile, Kubernetes context +and Terraform workspace switch automatically. When you cd out they reset. +Create a separate .envrc in every client project folder with that client's values. +This eliminates the risk of running a command in the wrong AWS account. + + +================================================================================ + PHASE 13 - GIT GLOBAL CONFIGURATION + (Sensible defaults, beautiful diffs with delta) +================================================================================ + +STEP 39 - Set global git defaults +Run each line separately: + + git config --global pull.rebase true + + git config --global init.defaultBranch main + + git config --global core.autocrlf input + + git config --global core.pager delta + + git config --global interactive.diffFilter "delta --color-only" + + git config --global delta.navigate true + + git config --global delta.line-numbers true + + git config --global delta.side-by-side true + +STEP 40 - Set your local git identity (run this inside EACH project folder) +Always use --local so you never commit with the wrong email on a client repo: + + git config --local user.name "Your Full Name" + + git config --local user.email "yourname@client.com" + + +================================================================================ + PHASE 14 - PRE-COMMIT HOOKS + (Run trivy and terraform fmt automatically before every commit) +================================================================================ + +STEP 41 - Install pre-commit hooks in a repo +Run this inside any git repository you want to protect: + + pre-commit install + +STEP 42 - Create a basic .pre-commit-config.yaml in your project root +Copy and paste this entire block: + + cat > .pre-commit-config.yaml << 'EOF' +repos: + - repo: https://github.com/antonbabenko/pre-commit-terraform + rev: v1.88.0 + hooks: + - id: terraform_fmt + - id: terraform_validate + - repo: https://github.com/aquasecurity/trivy + rev: v0.50.0 + hooks: + - id: trivy + args: ["config", "."] +EOF + + +================================================================================ + PHASE 15 - FINAL VERIFICATION + (Run this to confirm everything installed correctly) +================================================================================ + +STEP 43 - Run the full verification check +Paste this entire block into your terminal: + + echo "=== Homebrew ===" && brew --version + echo "=== kubectl ===" && kubectl version --client --short + echo "=== helm ===" && helm version --short + echo "=== k9s ===" && k9s version + echo "=== Terraform ===" && terraform version + echo "=== stern ===" && stern --version + echo "=== AWS CLI ===" && aws --version + echo "=== sops ===" && sops --version + echo "=== age ===" && age --version + echo "=== trivy ===" && trivy --version + echo "=== starship ===" && starship --version + echo "=== k6 ===" && k6 version + echo "=== direnv ===" && direnv version + echo "=== delta ===" && delta --version + echo "" + echo "ALL CHECKS COMPLETE" + +If any tool fails run: brew doctor && brew update && brew upgrade + + +================================================================================ + MONDAY MORNING CHECKLIST + (Do this before your first day on any new contract) +================================================================================ + +[ ] Ghostty open and icons rendering correctly (Nerd Font icons visible in prompt) +[ ] Docker running and resource limits set (4 CPUs / 8GB RAM in Settings) +[ ] Cursor open, VS Code extensions imported, AI features logged in +[ ] Raycast: set Clipboard History hotkey to Cmd + Option + V +[ ] SOPS age key backed up to password manager +[ ] Project folder created with .envrc for this client +[ ] Local git identity set in project folder (git config --local user.email) +[ ] Run: whoami-aws to confirm you are in the right AWS account +[ ] Run: whoami-k8s to confirm you are on the right Kubernetes context + + +================================================================================ + DAILY WORKFLOW QUICK REFERENCE + (Commands you will use every single day) +================================================================================ + +KUBERNETES + k get pods -n namespace List pods + k get pods -A List pods in all namespaces + kls my-app Tail logs for all pods matching my-app + ke pod-name -- bash Exec into a pod + kdebug Spin up a busybox debug pod + ks Open k9s dashboard + +DOCKER + dps Pretty list of running containers + dstats Live CPU and memory per container + dclean Remove all stopped containers and unused images + +GIT + gs Short git status + gl Pretty log with graph + gd Colourful side-by-side diff (uses delta) + gundo Undo last commit but keep changes staged + +CLOUD VERIFICATION (run before ANY infrastructure command) + whoami-aws Show current AWS account and role + whoami-k8s Show current Kubernetes context + +SECURITY SCANNING + scan-image nginx:latest Scan a Docker image for vulnerabilities + scan-tf ./terraform Scan Terraform code for misconfigurations + +NETWORK DIAGNOSTICS + mtr google.com Real-time traceroute with packet loss stats + + +================================================================================ + END OF GUIDE + Total tools installed: 30+ + Estimated setup time: 45-60 minutes +================================================================================