<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Muzaffar khan</title>
    <description>The latest articles on Forem by Muzaffar khan (@muzafferjoya).</description>
    <link>https://forem.com/muzafferjoya</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1150416%2F9b395061-b305-4af4-89e5-ef79f978d06f.jpeg</url>
      <title>Forem: Muzaffar khan</title>
      <link>https://forem.com/muzafferjoya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/muzafferjoya"/>
    <language>en</language>
    <item>
      <title>AI-powered DevOps tricks</title>
      <dc:creator>Muzaffar khan</dc:creator>
      <pubDate>Sat, 23 Aug 2025 08:42:29 +0000</pubDate>
      <link>https://forem.com/muzafferjoya/ai-powered-devops-tricks-43ie</link>
      <guid>https://forem.com/muzafferjoya/ai-powered-devops-tricks-43ie</guid>
      <description>&lt;p&gt;I’ve been collecting AI-powered DevOps tricks for months.&lt;br&gt;
Finally bundled them into a practical guide: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;📘 "AI-Powered Kubernetes: 21 Time-Saving Hacks for DevOps Engineers" 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Inside: &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;20+ ready-to-use AI prompts
Scripts for auto-healing, cost alerts, log parsing
How to integrate AI into ArgoCD &amp;amp; Terraform
Bonus: 10 AI prompts for K8s interviews
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;👉 Free Sample Chapter: &lt;a href="https://muzzyjoya.gumroad.com/l/ai-kubernetes-guide" rel="noopener noreferrer"&gt;https://muzzyjoya.gumroad.com/l/ai-kubernetes-guide&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;No fluff. No theory. Just stuff that saves hours every week. &lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>devops</category>
      <category>chatgpt</category>
    </item>
    <item>
      <title>Bash script that install docker and docker compose latest version on Linux system</title>
      <dc:creator>Muzaffar khan</dc:creator>
      <pubDate>Thu, 31 Aug 2023 06:27:04 +0000</pubDate>
      <link>https://forem.com/muzafferjoya/bash-script-that-install-docker-and-docker-compose-latest-version-on-linux-system-45e</link>
      <guid>https://forem.com/muzafferjoya/bash-script-that-install-docker-and-docker-compose-latest-version-on-linux-system-45e</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

# Update the package index
sudo apt update

# Install prerequisites for Docker
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common

# Add Docker GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# Add Docker repository
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list &amp;gt; /dev/null

# Update the package index again (with Docker repository)
sudo apt update

# Install Docker
sudo apt install -y docker-ce docker-ce-cli containerd.io

# Add the current user to the docker group (to run Docker commands without sudo)
sudo usermod -aG docker $USER

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

# Print Docker and Docker Compose versions
docker --version
docker-compose --version

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
      <category>docker</category>
    </item>
    <item>
      <title>Bash script that create a backup of a PostgreSQL database</title>
      <dc:creator>Muzaffar khan</dc:creator>
      <pubDate>Thu, 31 Aug 2023 06:18:11 +0000</pubDate>
      <link>https://forem.com/muzafferjoya/bash-script-that-create-a-backup-of-a-postgresql-database-2ikc</link>
      <guid>https://forem.com/muzafferjoya/bash-script-that-create-a-backup-of-a-postgresql-database-2ikc</guid>
      <description>&lt;p&gt;&lt;strong&gt;This script is used to create a backup of a PostgreSQL database running in a Docker container, and then upload that backup to an Amazon S3 bucket.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
DB_CONTAINER_NAME=""
DB_NAME=""
DB_USER=""

S3_BUCKET_NAME="&amp;lt;BUCKET_NAME&amp;gt;/&amp;lt;FOLDER&amp;gt;/"

TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_FILE="$DB_NAME-$TIMESTAMP.sql"

docker exec -i $DB_CONTAINER_NAME pg_dump -U $DB_USER -d $DB_NAME &amp;gt; $BACKUP_FILE

aws s3 cp $BACKUP_FILE s3://$S3_BUCKET_NAME

rm $BACKUP_FILE

echo "Backup completed and uploaded to S3: s3://$S3_BUCKET_NAME$BACKUP_FILE"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;PostgreSQL Container Details:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;DB_CONTAINER_NAME:&lt;/strong&gt; The name of the PostgreSQL Docker container.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DB_NAME:&lt;/strong&gt; The name of the database to be backed up.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DB_USER:&lt;/strong&gt; The PostgreSQL user used to access the database.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;S3 Bucket Details:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;S3_BUCKET_NAME:&lt;/strong&gt; The name of the Amazon S3 bucket where the backup will be uploaded.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note: &lt;em&gt;Make sure that aws cli installed on your system.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>docker</category>
      <category>linux</category>
    </item>
    <item>
      <title>Bash script that automating the process of updating a configuration file based on environment variables</title>
      <dc:creator>Muzaffar khan</dc:creator>
      <pubDate>Thu, 31 Aug 2023 05:59:48 +0000</pubDate>
      <link>https://forem.com/muzafferjoya/bash-script-that-automating-the-process-of-updating-a-configuration-file-based-on-environment-variables-360h</link>
      <guid>https://forem.com/muzafferjoya/bash-script-that-automating-the-process-of-updating-a-configuration-file-based-on-environment-variables-360h</guid>
      <description>&lt;p&gt;Certainly! Let's write a straightforward Bash script to show how changing a configuration file based on environment variables can be automated. &lt;/p&gt;

&lt;p&gt;For the purposes of this illustration, let's imagine you have a configuration file called app_config.conf that needs to be changed with various settings based on the environment (development, testing, production).&lt;/p&gt;

&lt;p&gt;Assume you have a configuration file named app_config.conf with the following content:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
app_config.conf
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;API_URL=
DB_HOST=
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash
config_file="app_config.conf"

if [ $# -ne 3 ]; then
    echo "Usage: $0 &amp;lt;environment&amp;gt; &amp;lt;api_url&amp;gt; &amp;lt;db_host&amp;gt;"
    exit 1
fi

ENVIRONMENT="$1"
api_url="$2"
db_host="$3"

echo "API_URL=$api_url" &amp;gt; "$config_file"
echo "DB_HOST=$db_host" &amp;gt;&amp;gt; "$config_file"

echo "Configuration updated for $ENVIRONMENT environment."

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How Do I Use This Script?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make it executable:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chmod +x update_config.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Run the script:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;./update_config.sh development http://dev.api.example.com dev-db.example.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
      <category>bash</category>
      <category>devops</category>
    </item>
    <item>
      <title>Bash script that helps you set up server configurations, create users, and set permissions</title>
      <dc:creator>Muzaffar khan</dc:creator>
      <pubDate>Thu, 31 Aug 2023 05:50:08 +0000</pubDate>
      <link>https://forem.com/muzafferjoya/bash-script-that-helps-you-set-up-server-configurations-create-users-and-set-permissions-5adg</link>
      <guid>https://forem.com/muzafferjoya/bash-script-that-helps-you-set-up-server-configurations-create-users-and-set-permissions-5adg</guid>
      <description>&lt;p&gt;Certainly! An example of a Bash script that may be used to configure servers, create users, and establish permissions is provided below. Please exercise caution when running scripts that create or edit user accounts or alter server configurations. Check the script again and make any necessary adjustments.&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h4&gt;
  
  
  Certainly! Here's an example of a Bash script that automates server provisioning using the ssh command.
&lt;/h4&gt;

&lt;p&gt;**&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

server_ip="your_server_ip"
server_user="your_username"
server_ssh_port=22


remote_commands=(
    "sudo apt update &amp;amp;&amp;amp; sudo apt upgrade -y"
    "sudo apt install -y nginx"
    "sudo systemctl start nginx"
    "sudo systemctl enable nginx"
)

for command in "${remote_commands[@]}"; do
    ssh "$server_user"@"$server_ip" -p "$server_ssh_port" "$command"
    if [ $? -eq 0 ]; then
        echo "Command executed successfully: $command"
    else
        echo "Command failed: $command"
        exit 1
    fi
done

echo "Server provisioning completed."
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;**&lt;/p&gt;

&lt;h4&gt;
  
  
  Certainly! Below is an example of a Bash script that helps you set up, create users, and set permissions.
&lt;/h4&gt;

&lt;p&gt;**&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;#!/bin/bash

create_user() {
    username=$1
    password=$2

    sudo useradd -m -s /bin/bash $username
    echo "$username:$password" | sudo chpasswd    
    echo "User $username created successfully."
}

setup_ssh() {
    username=$1

    sudo -u $username ssh-keygen -t rsa -b 4096 -f /home/$username/.ssh/id_rsa -N ""

    sudo -u $username sh -c "cat /home/$username/.ssh/id_rsa.pub &amp;gt;&amp;gt; /home/$username/.ssh/authorized_keys"

    sudo chmod 700 /home/$username/.ssh
    sudo chmod 600 /home/$username/.ssh/id_rsa
    sudo chmod 644 /home/$username/.ssh/id_rsa.pub
    sudo chmod 644 /home/$username/.ssh/authorized_keys

    sudo chown -R $username:$username /home/$username/.ssh

    echo "SSH access set up for user $username."
}

if [ "$(id -u)" -ne 0 ]; then
    echo "This script must be run as root or with sudo."
    exit 1
fi

read -p "Enter the username for the new user: " new_username
read -s -p "Enter the password for the new user: " new_password
echo

create_user $new_username $new_password
setup_ssh $new_username

echo "User account setup complete."


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>linux</category>
      <category>devops</category>
      <category>bash</category>
    </item>
  </channel>
</rss>
