Created
November 12, 2020 12:20
-
-
Save bree7e/d1ae470989d8b91e08243dbc89966b40 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .bashrc | |
# User specific aliases and functions | |
alias rm='rm -i' | |
alias cp='cp -i' | |
alias mv='mv -i' | |
# Source global definitions | |
if [ -f /etc/bashrc ]; then | |
. /etc/bashrc | |
fi | |
if [ -f ${HOME}/.vepp.alias ]; then | |
. ${HOME}/.vepp.alias | |
fi | |
if [ -f ${HOME}/.vepp.vars ]; then | |
. ${HOME}/.vepp.vars | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# vim: expandtab ts=2 sw=2 sts=2 | |
function container_name { | |
local name=$1 | |
local container=$(docker ps -q -f name=${name} | head -1) | |
echo "$(docker inspect --format='{{.Name}}' ${container})" | |
} | |
function de { | |
local name=$(container_name $1) | |
if [ -z "${name}" ]; then | |
echo "Unknown container: ${name}" | |
exit 1 | |
fi | |
shift | |
if [ -z "$@" ]; then | |
params=bash | |
else | |
params=$@ | |
fi | |
echo "Exec command ${params} in container: ${name}" | |
docker exec -it "${name}" ${params} | |
} | |
function logs { | |
local container=$1 | |
local logfile=$2 | |
shift | |
shift | |
local params=$@ | |
if [ -z "${params}" ]; then | |
params="-f -n1000" | |
fi | |
docker exec -it "$(container_name ${container})" tail ${params} /var/log/$logfile.log | |
} | |
function clean_logs { | |
log=$(docker inspect -f '{{.LogPath}}' "$(container_name $1)" 2> /dev/null) | |
truncate -s 0 $log | |
} | |
# | |
# Docker | |
# | |
alias dc='docker-compose' | |
alias dcdn='dc down' | |
alias dcup='dc up -d' | |
alias dp='docker ps --format="table {{.Names}}\t{{.Size}}\t{{.Status}}\t{{.Ports}}"' | |
alias dpa='dp -a' | |
alias dpg='dp | grep' | |
alias di='docker images' | |
alias compose='vim /opt/ispsystem/vepp/docker-compose.yaml' | |
# | |
# Logs | |
# | |
alias logw='logs vepp_back vepp_1_writer' | |
alias logr='logs vepp_back vepp_1_reader' | |
alias logctl='logs vepp_back veppctl_1' | |
# | |
# Containers | |
# | |
alias ab="de auth_back" | |
alias af="de auth_front" | |
alias vb="de vepp_back" | |
alias vf="de vepp_front" | |
alias m="docker exec -it \"$(container_name vepp_mysql)\" bash -c 'mysql -p\$MYSQL_ROOT_PASSWORD'" | |
alias market="de market" | |
alias sitemon="de sitemon" | |
alias tw="de vepp_back /opt/ispsystem/vepp/scripts/task_watcher.py" | |
alias version='grep image /opt/ispsystem/vepp/docker-compose.yaml | grep -v \"#\"' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment