Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View vadirajks's full-sized avatar

Vadiraj K.S vadirajks

View GitHub Profile
@vadirajks
vadirajks / certbot_install.sh
Created April 15, 2024 10:12
certbot_install.sh
sudo yum install epel-release
sudo yum install certbot-nginx
#if it is not working, follow the below steps:
sudo python3 -m venv /opt/certbot/
sudo /opt/certbot/bin/pip install --upgrade pip
sudo /opt/certbot/bin/pip install certbot certbot-nginx
sudo ln -s /opt/certbot/bin/certbot /usr/bin/certbot
sudo certbot --nginx
sudo systemctl reload nginx
@vadirajks
vadirajks / redis_cluster_prod_setup-step-1.sh
Last active March 19, 2024 08:53
redis cluster setup using bash
#!/bin/bash
# Get the hostname
host=$(hostname -i)
# Set the input variable based on the hostname
if [[ $host == *"172.16.25.137"* ]]; then
input="m1=172.16.25.137:8001, s-m2=172.16.25.138:7001, s-m3=172.16.25.139:6001"
elif [[ $host == *"172.16.25.138"* ]]; then
input="m2=172.16.25.138:8002, s-m1=172.16.25.137:7002, s-m3=172.16.25.139:6002"
@vadirajks
vadirajks / gcp_custom_vm.sh
Created February 14, 2024 15:44
gcp_custom_vm.sh
#!/bin/bash
function list_folders_recursive {
local folder="$1"
# Fetch folder names
local folders=$(gcloud resource-manager folders list --folder="$folder" --format="csv[no-heading](name)")
# Check if folders is empty
if [ -z "$folders" ]; then
return
@vadirajks
vadirajks / gke_workload_identity.sh
Created February 6, 2024 09:56
gke_workload_identity.sh
#!/bin/bash
#https://medium.com/@rakeshsaw/workload-identity-secured-way-to-access-google-cloud-apis-from-gke-workloads-44882ec5036a
#https://luandy-4171.medium.com/how-does-gke-workload-identify-work-with-iam-service-account-b996656284f8
#https://stackoverflow.com/questions/75948510/access-to-google-cloud-storage-from-an-autopilot-gke-cluster
#https://bijukunjummen.medium.com/gke-autopilot-and-workload-identity-a2732cf256de
#https://docs.ray.io/en/latest/cluster/kubernetes/user-guides/gke-gcs-bucket.html
# Set variables
CLUSTER_NAME="<YOUR_CLUSTER_NAME>"
PROJECT_ID="<YOUR_PROJECT_ID>"
NAMESPACE="default" # Change if your workloads are deployed in a different namespace
@vadirajks
vadirajks / bq_per_table_storage_billing_recommendation.sql
Created February 6, 2024 09:53
bq_per_table_storage_billing_recommendation.sql
DECLARE active_logical_price_per_gb NUMERIC DEFAULT 0.02;
DECLARE long_term_logical_price_per_gb NUMERIC DEFAULT 0.01;
DECLARE active_physical_price_per_gb NUMERIC DEFAULT 0.04;
DECLARE long_term_physical_price_per_gb NUMERIC DEFAULT 0.02;
WITH storage AS
(
SELECT DISTINCT
tb.table_schema AS dataset,
tb.table_name,
total_rows,
@vadirajks
vadirajks / magento+varnish+nginx setup
Created October 31, 2023 10:53
magento+varnish+nginx setup
upstream fastcgi_backend {
server unix:/run/php/php7.4-fpm.sock;
}
server {
server_name example.com;
listen 127.0.0.1:8080;
set $MAGE_ROOT /var/www/html/webfolder;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
@vadirajks
vadirajks / file etc-statsd-config.js
Created August 22, 2023 10:54
file etc-statsd-config.js
{
graphitePort: 2003,
graphiteHost: "graphite",
port: 8125,
mgmt_adress: "127.0.0.1",
mgmt_port: 8126,
backends: [ "./backends/graphite" ],
graphite: {
legacyNamespace: false,
globalPrefix: "stats",
@vadirajks
vadirajks / bigquery table details
Last active August 18, 2023 08:08
bigquery table details
#!/bin/bash
project_name="Project-ID"
echo -e "project_id,dataset_id,table_id,creation_time,last_modified_time,row_count,size_mb,size_gb,type,partiton,partition_expiration_days,cluster_key" > /tmp/bq_out.csv
for dataset in $(bq ls|tail -n +3); do
bq query --format=csv --use_legacy_sql=false '
SELECT
t1.project_id as project_id,
t1.dataset_id as dataset_id ,
t1.table_id as table_id,
TIMESTAMP_MILLIS(t1.creation_time) AS creation_time,
@vadirajks
vadirajks / gke-ingress-manged-tls.md
Created August 2, 2023 06:22 — forked from pydevops/gke-ingress-manged-tls.md
Create a GCP managed TLS certificate for the GKE ingress

GKE ingress in a nutshell

Solution #1 (ManagedCertificate CRD in GKE)

  • GKE with Google-managed SSL certificates
    • Use ManagedCertificate CRD to create a object.
    • Associate the ManagedCertificate object to an Ingress by adding an annotation networking.gke.io/managed-certificates to the Ingress. This annotation is a comma-separated list of ManagedCertificate resources, cert1,cert2,cert3 for example.

Solution #2 (Google Cloud SSL Certificate)

Assumption