add dotfiles: engine, warehouse, forgejo profiles
This commit is contained in:
parent
71baffe80f
commit
2b1777b3ba
|
|
@ -0,0 +1,133 @@
|
|||
# ~/.profile: executed by Bourne-compatible login shells
|
||||
# Forgejo container - git user
|
||||
# Managed by artale
|
||||
# Last updated: 2026-07-18
|
||||
|
||||
# ── Shell options ────────────────────────────────────────────────
|
||||
HISTSIZE=5000
|
||||
HISTFILESIZE=10000
|
||||
HISTTIMEFORMAT="%F %T "
|
||||
HISTCONTROL=ignoredups:ignorespace
|
||||
shopt -s histappend checkwinsize
|
||||
|
||||
# ── Editor ───────────────────────────────────────────────────────
|
||||
EDITOR=vi
|
||||
VISUAL=vi
|
||||
export EDITOR VISUAL
|
||||
|
||||
# ── Forgejo admin shortcuts ─────────────────────────────────────
|
||||
alias gitea='forgejo'
|
||||
alias ga='forgejo admin'
|
||||
alias ga-user='forgejo admin user list'
|
||||
alias ga-repo='forgejo admin repo-list'
|
||||
alias ga-queue='forgejo admin queue'
|
||||
alias gc='forgejo cert'
|
||||
alias gd='forgejo dump'
|
||||
alias gu='forgejo upgrade'
|
||||
|
||||
# ── Git aliases ──────────────────────────────────────────────────
|
||||
alias g='git'
|
||||
alias gs='git status'
|
||||
alias gl='git log --oneline --graph -20'
|
||||
alias gb='git branch'
|
||||
alias gd='git diff'
|
||||
alias gco='git checkout'
|
||||
alias gc='git clone'
|
||||
alias gp='git push'
|
||||
alias gpl='git pull'
|
||||
alias gst='git stash'
|
||||
alias gta='git tag'
|
||||
alias gclean='git clean -fd'
|
||||
|
||||
# ── Repository navigation ───────────────────────────────────────
|
||||
alias repos='ls -la ~/repositories/'
|
||||
alias repo-list='find ~/repositories -maxdepth 2 -name "*.git" | sed "s|.*/repositories/||" | sort'
|
||||
alias repo-size='du -sh ~/repositories/*/*.git 2>/dev/null | sort -rh | head -20'
|
||||
alias repo-count='find ~/repositories -name "*.git" -type d | wc -l'
|
||||
|
||||
# ── Disk and system (data dir) ───────────────────────────────────
|
||||
alias df='df -h'
|
||||
alias du='du -sh'
|
||||
alias ls='ls --color=auto'
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias lt='ls -ltr'
|
||||
alias data-size='du -sh /data/* 2>/dev/null | sort -rh | head -20'
|
||||
alias actions='ls -la /data/actions_log /data/actions_artifacts 2>/dev/null'
|
||||
|
||||
# ── Logs ─────────────────────────────────────────────────────────
|
||||
alias logs='ls -la /data/log/ 2>/dev/null'
|
||||
alias log-tail='tail -f /data/log/forgejo.log 2>/dev/null || echo "no log file found"'
|
||||
|
||||
# ── SSH ──────────────────────────────────────────────────────────
|
||||
alias ssh-keys='cat ~/.ssh/authorized_keys 2>/dev/null | head -20 || echo "no authorized_keys"'
|
||||
alias ssh-keys-count='cat ~/.ssh/authorized_keys 2>/dev/null | wc -l || echo "0"'
|
||||
|
||||
# ── Functions ────────────────────────────────────────────────────
|
||||
|
||||
# Show repo info by name
|
||||
repo-info() {
|
||||
local repo="$1"
|
||||
if [ -z "$repo" ]; then
|
||||
echo "Usage: repo-info org/repo"
|
||||
return 1
|
||||
fi
|
||||
local path="$HOME/repositories/$repo.git"
|
||||
if [ -d "$path" ]; then
|
||||
echo "Repository: $repo"
|
||||
echo " Path: $path"
|
||||
echo " Size: $(du -sh "$path" 2>/dev/null | cut -f1)"
|
||||
echo " Branches:"
|
||||
git --git-dir="$path" branch -a 2>/dev/null | head -20
|
||||
echo " Remotes:"
|
||||
git --git-dir="$path" remote -v 2>/dev/null
|
||||
echo " Last commit:"
|
||||
git --git-dir="$path" log -1 --format="%h %ai %s" 2>/dev/null
|
||||
else
|
||||
echo "Repository not found: $repo"
|
||||
echo "Look in: $HOME/repositories/"
|
||||
fi
|
||||
}
|
||||
|
||||
# List all repos owned by a specific user/org
|
||||
repos-by() {
|
||||
local owner="${1:-}"
|
||||
if [ -z "$owner" ]; then
|
||||
repo-list
|
||||
else
|
||||
find ~/repositories -maxdepth 2 -name "*.git" -path "*/$owner/*" | sed "s|.*/repositories/||" | sed 's|\.git$||' | sort
|
||||
fi
|
||||
}
|
||||
|
||||
# Last N repos updated
|
||||
recent-repos() {
|
||||
local count="${1:-10}"
|
||||
echo "Most recently updated repositories (top $count):"
|
||||
find ~/repositories -name "*.git" -type d -exec sh -c 'echo "$(git --git-dir="$1" log -1 --format="%ai" 2>/dev/null) $1"' _ {} \; 2>/dev/null | sort -r | head -"$count" | sed 's|.*/repositories/||' | sed 's|\.git$||'
|
||||
}
|
||||
|
||||
# Forgejo admin - list all repos
|
||||
ga-repos() {
|
||||
forgejo admin repo-list 2>/dev/null | head -50
|
||||
}
|
||||
|
||||
# Forgejo admin - user management
|
||||
ga-users() {
|
||||
forgejo admin user list 2>/dev/null
|
||||
}
|
||||
|
||||
# Show the artale-owned repos
|
||||
artale-repos() {
|
||||
echo "Artale repositories:"
|
||||
repos-by artale
|
||||
}
|
||||
|
||||
# ── Banner ───────────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "========================================="
|
||||
echo " Forgejo $(forgejo --version 2>/dev/null | head -1 || echo "?")"
|
||||
echo " Data: /data ($(du -sh /data 2>/dev/null | cut -f1))"
|
||||
echo " Repos: $(find ~/repositories -name '*.git' -type d 2>/dev/null | wc -l)"
|
||||
echo " Users: $(forgejo admin user list 2>/dev/null | wc -l)"
|
||||
echo "========================================="
|
||||
echo ""
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
# ~/.profile: executed by Bourne-compatible login shells
|
||||
# Engine (Hetzner) - goku
|
||||
# Last updated: 2026-07-18
|
||||
|
||||
# ── PATH ──────────────────────────────────────────────────────────
|
||||
if [ -d "$HOME/bin" ]; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/.local/bin" ]; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/.cargo/bin" ]; then
|
||||
PATH="$HOME/.cargo/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/.npm-global/bin" ]; then
|
||||
PATH="$HOME/.npm-global/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/.bun/bin" ]; then
|
||||
PATH="$HOME/.bun/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/.opencode/bin" ]; then
|
||||
PATH="$HOME/.opencode/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/go/bin" ]; then
|
||||
PATH="$HOME/go/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/.local/go/bin" ]; then
|
||||
PATH="$HOME/.local/go/bin:$PATH"
|
||||
fi
|
||||
|
||||
# ── Editor ───────────────────────────────────────────────────────
|
||||
EDITOR=vim
|
||||
VISUAL=vim
|
||||
export EDITOR VISUAL
|
||||
|
||||
# ── Locale ───────────────────────────────────────────────────────
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
# ── Shell options ────────────────────────────────────────────────
|
||||
HISTSIZE=10000
|
||||
HISTFILESIZE=20000
|
||||
HISTTIMEFORMAT="%F %T "
|
||||
HISTCONTROL=ignoredups:ignorespace
|
||||
shopt -s histappend checkwinsize cdspell dirspell autocd
|
||||
|
||||
# ── Cargo ────────────────────────────────────────────────────────
|
||||
. "$HOME/.cargo/env"
|
||||
|
||||
# ── Library path ─────────────────────────────────────────────────
|
||||
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/bin
|
||||
|
||||
# ── Source bashrc (aliases, functions, prompt) ───────────────────
|
||||
if [ "$BASH" ]; then
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Docker shortcuts ─────────────────────────────────────────────
|
||||
alias d='docker'
|
||||
alias dc='docker compose'
|
||||
alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
|
||||
alias dsa='docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
|
||||
alias dlog='docker logs -f'
|
||||
alias di='docker images'
|
||||
alias dexec='docker exec -it'
|
||||
alias dprune='docker system prune -af --volumes'
|
||||
alias dup='docker compose up -d'
|
||||
alias ddown='docker compose down'
|
||||
alias dtop='docker stats --no-stream'
|
||||
alias dstop-all='docker stop $(docker ps -q)'
|
||||
alias dip="docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}'"
|
||||
alias dwatch='watch -n2 "docker ps --format \"table {{.Names}}\t{{.Status}}\t{{.Ports}}\""'
|
||||
|
||||
# ── System ───────────────────────────────────────────────────────
|
||||
alias df='df -h'
|
||||
alias du='du -sh'
|
||||
alias free='free -h'
|
||||
alias psg='ps aux | grep'
|
||||
alias cpu='ps aux --sort=-%cpu | head -10'
|
||||
alias mem='ps aux --sort=-%mem | head -10'
|
||||
alias ports='ss -tlnp'
|
||||
alias top='htop'
|
||||
alias myip='curl -s ifconfig.me 2>/dev/null || curl -s https://api.ipify.org'
|
||||
alias disk-usage='du -sh /* 2>/dev/null | sort -rh | head -10'
|
||||
|
||||
# ── Network ──────────────────────────────────────────────────────
|
||||
alias ping='ping -c 4'
|
||||
alias wg-show='wg show'
|
||||
alias wg-stats='wg show wg0 | grep -E "transfer|latest handshake|endpoint"'
|
||||
|
||||
# ── Navigation ───────────────────────────────────────────────────
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias lt='ls -ltr'
|
||||
alias l='ls -CF'
|
||||
|
||||
# ── Git ──────────────────────────────────────────────────────────
|
||||
alias gs='git status'
|
||||
alias gl='git log --oneline --graph -20'
|
||||
alias gc='git commit -m'
|
||||
alias gp='git push'
|
||||
alias gpl='git pull'
|
||||
alias gd='git diff'
|
||||
alias gco='git checkout'
|
||||
alias gb='git branch'
|
||||
|
||||
# ── Tmux ─────────────────────────────────────────────────────────
|
||||
alias tm='tmux new -s'
|
||||
alias tma='tmux attach -t'
|
||||
alias tml='tmux ls'
|
||||
alias tmk='tmux kill-session -t'
|
||||
|
||||
# ── Forge shortcuts (from original bashrc) ───────────────────────
|
||||
alias ops="mprocs -c ~/forge/forge-mprocs.yaml"
|
||||
alias threads="bash ~/forge/nexus/bin/forge-worker.sh"
|
||||
|
||||
# ── WireGuard / network ──────────────────────────────────────────
|
||||
alias wgo='wg show wg0'
|
||||
alias wg-peers='wg show wg0 peers'
|
||||
alias wg-latest='wg show wg0 | grep -A3 "latest handshake"'
|
||||
alias wg-transfer='wg show wg0 | grep transfer'
|
||||
|
||||
# ── Functions ────────────────────────────────────────────────────
|
||||
|
||||
# Full docker inspect
|
||||
dipall() {
|
||||
docker inspect "$1" --format "\
|
||||
Name: {{.Name}}
|
||||
Status: {{.State.Status}}
|
||||
IP: {{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}
|
||||
Image: {{.Config.Image}}
|
||||
Ports: {{range $p, $c := .NetworkSettings.Ports}}{{$p}} {{end}}"
|
||||
}
|
||||
|
||||
# Docker shell
|
||||
dsh() {
|
||||
docker exec -it "$1" sh -c 'if command -v bash >/dev/null 2>&1; then bash; else sh; fi' 2>/dev/null || \
|
||||
docker exec -it "$1" sh
|
||||
}
|
||||
|
||||
# SSH with keys
|
||||
sshw() {
|
||||
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -i ~/.ssh/id_ed25519 "$@"
|
||||
}
|
||||
|
||||
sshw-root() {
|
||||
ssh -o StrictHostKeyChecking=no -o ConnectTimeout=5 -i ~/.ssh/id_ed25519 "root@$1" "$2"
|
||||
}
|
||||
|
||||
# Quick wireguard ping all peers
|
||||
wg-ping() {
|
||||
for ip in 10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.4 10.0.0.5; do
|
||||
ping -c 1 -W 1 $ip 2>/dev/null | grep -q "1 received" && echo " $ip OK" || echo " $ip DEAD"
|
||||
done
|
||||
}
|
||||
|
||||
# ── Login banner ─────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "========================================"
|
||||
echo " engine (Hetzner) - goku"
|
||||
echo " Uptime: $(uptime -p 2>/dev/null || echo "?")"
|
||||
echo " Load: $(cat /proc/loadavg | cut -d' ' -f1-3)"
|
||||
echo " Disk: $(df -h / | tail -1 | awk '{print $3 " / " $2 " (" $5 ")"}')"
|
||||
echo " RAM: $(free -h | grep Mem | awk '{print $3 " / " $2}')"
|
||||
echo " Docker: $(docker ps -q 2>/dev/null | wc -l) running / $(docker ps -aq 2>/dev/null | wc -l) total"
|
||||
if command -v wg >/dev/null 2>&1 && wg show wg0 >/dev/null 2>&1; then
|
||||
echo " WG: $(wg show wg0 2>/dev/null | grep -c "peer:" 2>/dev/null) peers, $(wg show wg0 2>/dev/null | grep "latest handshake" | wc -l) connected"
|
||||
fi
|
||||
echo "========================================"
|
||||
echo ""
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
# ~/.profile: executed by Bourne-compatible login shells
|
||||
# Source: warehouse server - vmi3221427 (Contabo)
|
||||
# Last updated: 2026-07-18
|
||||
|
||||
# ── PATH ──────────────────────────────────────────────────────────
|
||||
if [ -d "$HOME/.local/bin" ]; then
|
||||
PATH="$HOME/.local/bin:$PATH"
|
||||
fi
|
||||
if [ -d "$HOME/bin" ]; then
|
||||
PATH="$HOME/bin:$PATH"
|
||||
fi
|
||||
|
||||
# ── Shell options ────────────────────────────────────────────────
|
||||
HISTSIZE=10000
|
||||
HISTFILESIZE=20000
|
||||
HISTTIMEFORMAT="%F %T "
|
||||
HISTCONTROL=ignoredups:ignorespace
|
||||
shopt -s histappend checkwinsize cdspell dirspell autocd
|
||||
|
||||
# ── Editor ───────────────────────────────────────────────────────
|
||||
EDITOR=vim
|
||||
VISUAL=vim
|
||||
export EDITOR VISUAL
|
||||
|
||||
# ── Locale ───────────────────────────────────────────────────────
|
||||
export LANG=en_US.UTF-8
|
||||
export LC_ALL=en_US.UTF-8
|
||||
|
||||
# ── Source bashrc (aliases, functions, prompt) ───────────────────
|
||||
if [ "$BASH" ]; then
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
fi
|
||||
|
||||
# ── Docker shortcuts ─────────────────────────────────────────────
|
||||
alias d='docker'
|
||||
alias dc='docker compose'
|
||||
alias dps='docker ps --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
|
||||
alias dsa='docker ps -a --format "table {{.Names}}\t{{.Status}}\t{{.Ports}}"'
|
||||
alias dlog='docker logs -f'
|
||||
alias di='docker images'
|
||||
alias dexec='docker exec -it'
|
||||
alias dprune='docker system prune -af --volumes'
|
||||
alias drestart='docker restart'
|
||||
alias dup='docker compose up -d'
|
||||
alias ddown='docker compose down'
|
||||
alias dtop='docker stats --no-stream'
|
||||
alias dstop-all='docker stop $(docker ps -q)'
|
||||
alias dip="docker inspect --format '{{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}'"
|
||||
|
||||
# ── System ───────────────────────────────────────────────────────
|
||||
alias df='df -h'
|
||||
alias du='du -sh'
|
||||
alias free='free -h'
|
||||
alias psg='ps aux | grep'
|
||||
alias cpu='ps aux --sort=-%cpu | head -10'
|
||||
alias mem='ps aux --sort=-%mem | head -10'
|
||||
alias ports='ss -tlnp'
|
||||
alias top='htop'
|
||||
alias myip='curl -s ifconfig.me 2>/dev/null || curl -s https://api.ipify.org'
|
||||
alias disk-usage='du -sh /* 2>/dev/null | sort -rh | head -10'
|
||||
alias wg-show='wg show'
|
||||
alias wg-stats='wg show wg0 | grep -E "transfer|latest handshake|endpoint"'
|
||||
|
||||
# ── Network ──────────────────────────────────────────────────────
|
||||
alias ping='ping -c 4'
|
||||
|
||||
# ── Navigation ───────────────────────────────────────────────────
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
alias ll='ls -alF'
|
||||
alias la='ls -A'
|
||||
alias lt='ls -ltr'
|
||||
alias l='ls -CF'
|
||||
|
||||
# ── Git ──────────────────────────────────────────────────────────
|
||||
alias gs='git status'
|
||||
alias gl='git log --oneline --graph -20'
|
||||
alias gc='git commit -m'
|
||||
alias gp='git push'
|
||||
alias gpl='git pull'
|
||||
alias gd='git diff'
|
||||
alias gco='git checkout'
|
||||
alias gb='git branch'
|
||||
|
||||
# ── Tmux ─────────────────────────────────────────────────────────
|
||||
alias tm='tmux new -s'
|
||||
alias tma='tmux attach -t'
|
||||
alias tml='tmux ls'
|
||||
alias tmk='tmux kill-session -t'
|
||||
|
||||
# ── Functions ────────────────────────────────────────────────────
|
||||
|
||||
# Full docker inspect summary
|
||||
dipall() {
|
||||
docker inspect "$1" --format "\
|
||||
Name: {{.Name}}
|
||||
Status: {{.State.Status}}
|
||||
IP: {{range .NetworkSettings.Networks}}{{.IPAddress}} {{end}}
|
||||
Image: {{.Config.Image}}
|
||||
Ports: {{range $p, $c := .NetworkSettings.Ports}}{{$p}} {{end}}"
|
||||
}
|
||||
|
||||
# Docker logs with timestamps
|
||||
dlogt() {
|
||||
docker logs -f --timestamps "$@"
|
||||
}
|
||||
|
||||
# Get shell inside a container
|
||||
dsh() {
|
||||
docker exec -it "$1" sh -c 'if command -v bash >/dev/null 2>&1; then bash; else sh; fi' 2>/dev/null || \
|
||||
docker exec -it "$1" sh
|
||||
}
|
||||
|
||||
# Docker system disk usage
|
||||
du-containers() {
|
||||
docker system df
|
||||
}
|
||||
|
||||
# Watch container health
|
||||
dwatch() {
|
||||
watch -n2 "docker ps --format 'table {{.Names}}\t{{.Status}}'"
|
||||
}
|
||||
|
||||
# List all Docker networks with containers
|
||||
dnetworks() {
|
||||
echo "Networks:"
|
||||
docker network ls --format "table {{.Name}}\t{{.Driver}}"
|
||||
echo ""
|
||||
for net in $(docker network ls -q); do
|
||||
name=$(docker network inspect "$net" --format '{{.Name}}')
|
||||
echo " -- $name --"
|
||||
docker network inspect "$net" --format ' Gateway: {{(index .IPAM.Config 0).Gateway}} ({{(index .IPAM.Config 0).Subnet}})
|
||||
Containers: {{range $c, $v := .Containers}}{{$v.Name}} ({{$v.IPv4Address}}) {{end}}' 2>/dev/null
|
||||
done
|
||||
}
|
||||
|
||||
# ── Login banner ─────────────────────────────────────────────────
|
||||
echo ""
|
||||
echo "======================================"
|
||||
echo " vmi3221427 - Contabo Warehouse"
|
||||
echo " Uptime: $(uptime -p 2>/dev/null || echo "?")"
|
||||
echo " Load: $(cat /proc/loadavg | cut -d' ' -f1-3)"
|
||||
echo " Disk: $(df -h / | tail -1 | awk '{print $3 " / " $2 " (" $5 ")"}')"
|
||||
echo " RAM: $(free -h | grep Mem | awk '{print $3 " / " $2}')"
|
||||
echo " Docker: $(docker ps -q 2>/dev/null | wc -l) running"
|
||||
echo "======================================"
|
||||
echo ""
|
||||
Loading…
Reference in New Issue