Skip to content

Instantly share code, notes, and snippets.

View riy's full-sized avatar

Rias A. Sherzad riy

View GitHub Profile
@riy
riy / Setup production PostgreSQL instance
Last active March 16, 2025 21:12 — forked from rameerez/postgres-production-setup.sh
PostgreSQL Production Server Setup - Set up a new Ubuntu Server 24.04 LTS machine to run a production Postgres server
#!/bin/bash
# This script takes a clean Ubuntu Server 24.04 LTS image and installs and configures
# everything needed to deploy a production-ready PostgreSQL server.
set -euo pipefail
# --- AESTHETICS ---
GREEN='\033[0;32m'
@riy
riy / Stop old Docker containers
Last active March 16, 2025 21:13 — forked from ewjoachim/stop-old-containers.sh
Stop docker containers older than 1 day old
#!/bin/bash -eux
yesterday=$(date -d yesterday +%s)
# dnsdock should not be stopped : we limit to the containers created after it
docker ps --filter since=dnsdock -q --format "{{.ID}} {{.CreatedAt}}" | while read line
do
# line looks like:
# 123456789abcdef 2017-01-01 00:00:00 +02:00 CEST
set $line
id=$1
@riy
riy / Batch-install Jenkins plugins
Last active March 16, 2025 21:13 — forked from hgomez/jenkins-plugins-batch-install.md
Mass install/update of Jenkins Plugins
# Scripted Jenkins Plugins install
Jenkins has a very rich catalog of plugins and it's quite easy to install and update them via UI.
BTW, when you want to add tons of plugin via UI, it's a fairly long and boring procedure.
Hopefully, mass installation (or update) could be easy using a simple bash script (curl/python required) :
* https://raw.githubusercontent.com/hgomez/devops-incubator/master/forge-tricks/batch-install-jenkins-plugins.sh
Create a file containing plugins to be installed (or updated), ie iplugins :
## Useful Commands
Get kubectl version
kubectl version
Get cluster info:
@riy
riy / Generate Client and Server certificates to enable HTTPS auth to Docker
Last active March 16, 2025 21:14 — forked from bradrydzewski/generate_docker_cert.sh
Generate trusted CA certificates for running Docker with HTTPS
#!/bin/bash
#
# Generates client and server certificates used to enable HTTPS
# remote authentication to a Docker daemon.
#
# See http://docs.docker.com/articles/https/
#
# To start the Docker Daemon:
#
# sudo docker -d \
@riy
riy / Generate Docker keys
Last active March 16, 2025 21:14
Create Docker Certificate Authority, Server and Client Certificates
#!/bin/bash
HOST_IP=`ifconfig eth0| awk '/inet addr/{print substr($2,6)}'`
mkdir docker-ca
chmod 0700 docker-ca
cd docker-ca
openssl genrsa -aes256 -out ca-key.pem 2048
openssl req -new -x509 -days 365 -key ca-key.pem -sha256 -out ca.pem
openssl genrsa -out server-key.pem 2048
openssl req -subj "/CN=${HOST_IP}" -new -key server-key.pem -out server.csr