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
SELECT nspname || '.' || relname AS "relation", | |
pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size" | |
FROM pg_class C | |
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) | |
WHERE nspname NOT IN ('pg_catalog', 'information_schema') | |
AND C.relkind <> 'i' | |
AND nspname !~ '^pg_toast' | |
ORDER BY pg_total_relation_size(C.oid) DESC | |
LIMIT 10; | |
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
# assuming the service is called nginx, | |
# to stop it gracefully | |
docker exec -it <container> | |
s6-svc -o /var/run/s6/services/nginx # puts the service in "run-once" mode | |
s6-svc -q /var/run/s6/services/nginx # sends the SIGQUIT signal required bby nginx for a graceful shutdown | |
# to start the service again | |
s6-svc -u /var/run/s6/services/nginx # puts the service back up in "run-always" mode |
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
kubectl config use-context docker-for-desktop | |
kubectl create -f https://raw.githubusercontent.com/kubernetes/dashboard/master/src/deploy/recommended/kubernetes-dashboard.yaml | |
cat > k8s-dashboard-nodeport-service.yaml << EOF | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
k8s-app: kubernetes-dashboard |
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
# COMMIT_TO_REPO is a boolean parameter | |
# STACK is a choice parameter | |
if [ "${COMMIT_TO_REPO}" == "true" ]; then | |
# commit, push and create PR to the stack repo | |
REPONAME=XXX-stack | |
BRANCH=${STACK}-$(date +%Y%m%d-%H%M%S) | |
FILE_TO_COMMIT=$(readlink -f $PROJDIR/.env | sed "s|${BASEDIR}/${REPONAME}/||") | |
# don't care about possible wonky private files; we only care about that .env file | |
rsync -a ${BASEDIR}/${REPONAME} ${WORKSPACE}/ 2>/dev/null || echo -en "" | |
cd ${WORKSPACE}/${REPONAME} |
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
# SERVICE is the docker-compose service name | |
OLD_IMAGE_ID=$(docker-compose images -q $SERVICE) | |
# CLEAN_UP_OLD_IMAGE is a jenkins boolean param | |
if [ "${CLEAN_UP_OLD_IMAGE}" == "true" ]; then | |
echo -en "\n\nTrying to remove the old image used for ${SERVICE} (ID: ${OLD_IMAGE_ID})...\n" | |
docker rmi ${OLD_IMAGE_ID} 2>/dev/null || echo -en "\nThis image is still in use and has NOT been removed.\n" | |
else | |
echo -en "\nThe old image remains on disk (ID: ${OLD_IMAGE_ID})...\n" | |
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
#!/bin/bash | |
MAX_DAYS=180 | |
USER=YOUR_USER | |
[ -z $1 ] || MAX_DAYS=$1 | |
LAST_DATE=$(date --date ${MAX_DAYS}' days ago' +'%d-%b-%Y') | |
echo "Mailbox status before proceeding:" |