Skip to content

Instantly share code, notes, and snippets.

View MahdadGhasemian's full-sized avatar

Mahdad Ghasemian MahdadGhasemian

View GitHub Profile
@MahdadGhasemian
MahdadGhasemian / secure_external_ssd.md
Last active January 8, 2026 06:54
A concise guide to securely partitioning, encrypting, and formatting an external SSD for Linux use.

Secure External SSD

Make your external SSD partitions with ext4 filesystem for Linux

To prepare your external SSD for use in Linux, you can use the following tools:

  • Use lsblk or fdisk -l to identify your external SSD device.
  • Use fdisk or parted to create and manage partitions on the SSD.
  • Use mkfs.ext4 to format the created partitions with the ext4 filesystem.
  • For a graphical interface, consider using gparted.
@MahdadGhasemian
MahdadGhasemian / metallb-loadbalancer-layer2-vs-bgp-mode.md
Created July 24, 2025 03:05
This document provides a comparison of MetalLB's Layer 2 and BGP modes.

MetalLB: Layer 2 vs BGP Mode Comparison

🎯 Introduction

MetalLB is a load-balancer implementation for bare metal Kubernetes clusters. This document compares its two main operational modes: Layer 2 and BGP, helping you choose the right one for your environment.

🔁 Layer 2 Mode

🏗️ Example Cluster Setup

📦 Cluster Setup

@MahdadGhasemian
MahdadGhasemian / docker-compose.yml
Last active July 8, 2025 04:37
How to config a Redis Cluster in local with docker-compose
version: "3.7"
services:
# Node 0
redis-node-0:
image: docker.io/bitnami/redis-cluster:7.4
volumes:
- redis_cluster_data_0:/bitnami/redis/data
environment:
- "REDIS_PASSWORD=bitnami"
@MahdadGhasemian
MahdadGhasemian / mongodb_replica_set_docker_compose.md
Last active December 4, 2024 06:36
Setting Up a MongoDB Replica Set With Docker Compass (Local Test)

How to Set Up a stable MongoDB Replica Set Localy for Developing

version: "3.9"

services:
  mongodb-primary:
    image: docker.io/bitnami/mongodb:5.0
    environment:
      - MONGODB_ADVERTISED_HOSTNAME=mongodb-primary
@MahdadGhasemian
MahdadGhasemian / behind_proxy.md
Last active September 29, 2024 13:59
Bash, APT, Docker, K3S, Gitlab Runner Behind Proxy ?

1. bash behind proxy:

Edit .profile file (with vi or nano)

nano .profile

And add following lines:

export http_proxy=http://127.0.0.1:8888/
export https_proxy=http://127.0.0.1:8888/
@MahdadGhasemian
MahdadGhasemian / minio_backup_restore_guide.md
Last active January 8, 2026 21:43
Steps to backup and restore Minio Buckets

Restore Backup with Minio (Minio <----> Local)

Instructions for restoring buckets using Minio mirror features.

Install Minio Client

Install Link install link

@MahdadGhasemian
MahdadGhasemian / longhorn_restore_guide.md
Last active August 10, 2025 05:03
Steps to restore backed-up data using Longhorn, with a PostgreSQL example.

Restore Backup with Longhorn

Instructions for restoring data using Longhorn backup and restore features.

Restore Backup

Example: Restoring PostgreSQL Data

  1. Scale Down the PostgreSQL StatefulSet:
@MahdadGhasemian
MahdadGhasemian / DetermineAvailableDiskSpaceOnHetznerVolume.md
Last active January 15, 2025 22:05
Determine Available Disk Space on Hetzner Volume (K3S)

This guide will help you determine the available disk space on a Hetzner volume assigned to a K3S node.

1- Find Volume ID

  • Using hcloud CLI:

Run the following command to list your volumes:

hcloud volume list