nushell/config/docker.nu

92 lines
2.4 KiB
Plaintext
Raw Normal View History

2023-12-22 16:09:35 +00:00
# docker aliases
# lazydocker
alias ld = lazydocker
# docker-compose
alias dc = docker-compose
# docker-compose build
alias dcb = docker-compose build
# docker-compose build and push
def dcp [] { docker-compose build; docker-compose push }
# docker-compose up with build and remove-orphans
alias dcu = docker-compose up -d --build --remove-orphans
# docker-compose down
alias dcd = docker-compose down
# docker-compose down and up
def dcr [] { docker-compose down; docker-compose up -d --build --remove-orphans }
# kubernetes aliases
$env.KUBECONFIG = if ([$env.HOME, .kubes, current-cube] | path join | path exists) {
open ([$env.HOME, .kubes, current-cube] | path join)
} else {
""
}
def _kube_kubes [] {
_ls ~/.kubes | where type == dir | get name | path basename
}
# easily switch kube config
def --env kube [name?: string@_kube_kubes] {
use assert
let kubes_path = [$env.HOME, .kubes] | path join
if $name == null {
rm ([$kubes_path, current-cube] | path join)
$env.KUBECONFIG = ""
return
}
let kube_config = [$kubes_path, $name, config] | path join
if not ($kube_config | path exists) {
error make {msg: ($kube_config + " does not exist")}
}
$kube_config | save -f ([$kubes_path, current-cube] | path join)
$env.KUBECONFIG = $kube_config
}
# k9s
alias kns = k9s -n all
2024-01-10 10:40:36 +00:00
# shortcut for lazydocker on pi
2024-01-09 10:12:40 +00:00
alias pi = ssh pi -t "cd www/docker && /home/pi/.local/bin/lazydocker"
2024-01-10 10:40:36 +00:00
# shortcut for lazydocker on phoenix's prod
alias mnemosyne = ssh phoenix -t "cd prod && /home/polymny/.local/bin/lazydocker"
# shortcut for lazydocker on phoenix's infra
alias infra = ssh phoenix -t "cd infra && /home/polymny/.local/bin/lazydocker"
# shortcut for kns zeus's kubernetes cluster
2023-12-22 16:09:35 +00:00
alias zeus = k9s -n all --kubeconfig ($env.HOME + '/.kubes/zeus/config')
2024-01-10 10:40:36 +00:00
# shortcut for kns safir's kubernetes cluster
2023-12-22 16:09:35 +00:00
alias safir = k9s -n all --kubeconfig ($env.HOME + '/.kubes/safir/config')
# start minikube with test kube
def "minikube start" [] {
$env.KUBECONFIG = ([$env.HOME, '.kubes', 'test', 'config'] | path join)
^minikube start
}
# stop minikube with test kube
def "minikube stop" [] {
$env.KUBECONFIG = ([$env.HOME, '.kubes', 'test', 'config'] | path join)
^minikube stop
}
# delete minikube with test kube
def "minikube delete" [] {
$env.KUBECONFIG = ([$env.HOME, '.kubes', 'test', 'config'] | path join)
^minikube delete
}