Skip to content

Instantly share code, notes, and snippets.

View pjmazenot's full-sized avatar

Pierre-Julien Mazenot pjmazenot

View GitHub Profile
@pjmazenot
pjmazenot / backup-website.sh
Created August 8, 2019 15:01
Simple website and DB backup - Generates a tar.gz archive including the website files and a database dump
#!/bin/sh
# Simple website and DB backup
# Generates a tar.gz archive including the website files and a database dump
# /!\ DO NOT USE IF YOU HAVE A FOLDER NAMED "database" IN YOUR WEBSITE ROOT FOLDER
echo ""
echo "Starting backup process..."
echo ""
@pjmazenot
pjmazenot / clean-rancher-node.sh
Last active February 2, 2019 17:42
Clean Rancher node
#!/bin/sh
# Remove Docker containers, images and volumes
docker rm -f $(docker ps -qa)
docker rmi -f $(docker images -q)
docker volume rm $(docker volume ls -q)
# Unmount all mounts
for mount in $(mount | grep tmpfs | grep '/var/lib/kubelet' | awk '{ print $3 }') /var/lib/kubelet /var/lib/rancher; do umount $mount; done
@pjmazenot
pjmazenot / solr-7.2-install-osx.sh
Created December 29, 2017 00:58
Install Solr 7.2 on OSX for local or development purpose
#!/bin/sh
#
# Install Solr 7.2 on OSX for local or development purpose
# Author: Pierre-Julien Mazenot
#
# Run as sudo `./solr-7.2-install-osx.sh`
#
# cd to the /opt dir
cd /opt/
apt-get install percona-nagios-plugins
mkdir -p /etc/nagios
sudo nano /etc/nagios/mysql.cnf
# [client]
# user = root
# password = s3cret
@pjmazenot
pjmazenot / nagios3-install-ubuntu-14.04.sh
Created December 28, 2017 20:19
Install Nagios 3 on Ubuntu 14.04 (Apache 2.4, PHP 7.0)
# 1. Install Apache 2.4
export DEBIAN_FRONTEND=noninteractive && apt update && apt full-upgrade -y
apt-get install -y python-software-properties software-properties-common gcc make re2c libpcre3-dev curl sshpass apt-utils
apt-get -y install apache2
# 2. Install custom apt repository for PHP 7.0
apt install -y locales && locale-gen en_US.UTF-8 && locale -a
LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 add-apt-repository -y ppa:ondrej/php
# 3. Install php 7.0
@pjmazenot
pjmazenot / nagios4-install-ubuntu-16.04
Created December 28, 2017 19:45
Install Nagios 4 on Ubuntu 16.04
sudo add-apt-repository ppa:beevm/nagios4
sudo apt-get update
@pjmazenot
pjmazenot / k8s-commands.sh
Last active December 27, 2017 22:11
Useful commands for k8s management
# Get pods list in all namespaces
# The `--all-namespaces` can be added to most of the kubectl retrieving commands
kubectl get pods --all-namespaces
# Restart a pod with the definition file
# E.g: `kubectl delete pods mysql-default-934tl && kubectl create -f ./mysql-default.yaml`
# Errors:
# - Pod not found: add `-n NAMESPACE` after the delete command
kubectl delete pods [POD] && kubectl create -f [YAML_POD_DEFINTION_FILE]
@pjmazenot
pjmazenot / percona-server-install-ubuntu-14.04.sh
Last active December 27, 2017 22:07
Install Percona Server on Ubuntu 14.04
#
# Install Percona Server on Ubuntu 14.04 (run as sudo)
#
# Official guide:
# https://www.percona.com/doc/percona-server/LATEST/installation/apt_repo.html
# Add MySQL 5.7 repo since it's not present by default
wget http://dev.mysql.com/get/mysql-apt-config_0.6.0-1_all.deb
dpkg -i mysql-apt-config_0.6.0-1_all.deb
@pjmazenot
pjmazenot / docker-install-lubuntu-17.04.sh
Last active March 14, 2021 17:52
Install Docker CE on Lubuntu 17.04
#!/bin/sh
# Install Docker CE on Lubuntu 17.04
# Run this script with sudo privileges `sudo docker-install-lubuntu-17.04.sh`
apt-get install -y apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu zesty stable"
apt-get update
apt-get install -y docker-ce
@pjmazenot
pjmazenot / rancher-install-ubuntu-16.04.sh
Last active January 2, 2023 09:33
Install of Rancher on Ubuntu 16.04
#!/bin/sh
# Install of Rancher on Ubuntu 16.04
# Prepare installation
sudo apt-get remove docker docker.io docker-engine
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl software-properties-common
# Install docker (Rancher support and best compatibility for Kubernetes)