Skip to content

Instantly share code, notes, and snippets.

View worldofprasanna's full-sized avatar
🔥
Game is on

Prasanna worldofprasanna

🔥
Game is on
View GitHub Profile
@worldofprasanna
worldofprasanna / sidecar-containers-kubernetes-v1.28.yaml
Created July 3, 2024 08:01
Sidecar Containers introduced in Kubernetes v1.28
apiVersion: v1
kind: Pod
metadata:
name: pod-with-sidecar-container
spec:
initContainers:
# Normal Init Container
- name: database-initializer
image: db-init:v1.34.0
# Sidecar Container
@worldofprasanna
worldofprasanna / create-postgres-db.sh
Created June 7, 2020 14:38
create postgresql database
# Install postgres plugin
dokku plugin:install https://github.com/dokku/dokku-postgres.git postgres
# Create postgres database
dokku postgres:create my-database
# Link the postgres with the app
dokku postgres:link <DB_NAME> <APP_NAME>
# eg: dokku postgres:link my-database getting-started-with-dokku
@worldofprasanna
worldofprasanna / add-team-mates-to-dokku.sh
Created June 7, 2020 03:54
Adding team mates to dokku application
# SSH into the virtual machine
ssh root@<vm-public-ip-address>
# Add their public keys to the authorized keys
vi ~/.ssh/authorised_keys
# Add their public keys to the dokku application
dokku ssh-keys:add <user> <path-to-public-key>
# eg: dokku ssh-keys:add prasanna /root/pub-keys/prasanna.pub
# List the users who have permission
dokku ssh-keys:list
@worldofprasanna
worldofprasanna / deploy_dokku_app.sh
Created June 7, 2020 03:03
Deploy dokku application
# Push the changes to remote(dokku) origin
git push dokku master
# List the apps in dokku
dokku apps:list
@worldofprasanna
worldofprasanna / setup_remote_origin_dokku.sh
Last active June 7, 2020 03:01
Create new application in dokku
# Clone the repo
git clone [email protected]:worldofprasanna/getting-started-with-dokku.git
# cd into the repo
cd getting-started-with-dokku
# Install dokku client locally
brew install dokku/repo/dokku
# Create dokku app
dokku apps:create getting-started-with-dokku
# Add a git remote to point to dokku app
git remote add dokku dokku@<vm-public-ip-address>:getting-started-with-dokku
@worldofprasanna
worldofprasanna / install_dokku.sh
Last active June 7, 2020 02:53
Installation of dokku
ssh root@<vm-public-ip-address>
# Inside VM
wget https://raw.githubusercontent.com/dokku/dokku/v0.20.4/bootstrap.sh
sudo DOKKU_TAG=v0.20.4 bash bootstrap.sh
@worldofprasanna
worldofprasanna / blog_staticwebsite_s3.tf
Last active May 3, 2020 10:20
Create S3 bucket to hold static assets
resource "aws_s3_bucket" "main" {
...
policy = data.aws_iam_policy_document.bucket_policy.json
website {
index_document = var.index_document
}
...
data "aws_iam_policy_document" "bucket_policy" {
...
actions = [
@worldofprasanna
worldofprasanna / main.tf
Last active May 3, 2020 11:39
Terraform script to serve your static assets
module "staticwebsite" {
source = "worldofprasanna/staticwebsite/aws"
version = "1.0.0"
domain = "yourdomain.com"
}
# To create the resource,
terraform apply
# To upload the static assests,
aws s3 sync build/ s3://yourdomain.com
@worldofprasanna
worldofprasanna / terraform_issue_aws_s3_object.log
Last active May 2, 2020 14:26
Terraform issue when creating aws_s3_object
2020/05/02 19:50:54 [INFO] Terraform version: 0.12.24
2020/05/02 19:50:54 [INFO] Go runtime version: go1.13.8
2020/05/02 19:50:54 [INFO] CLI args: []string{"/usr/local/bin/terraform", "apply"}
2020/05/02 19:50:54 [DEBUG] Attempting to open CLI config file: /Users/prasanna/.terraformrc
2020/05/02 19:50:54 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2020/05/02 19:50:54 [INFO] CLI command args: []string{"apply"}
2020/05/02 19:50:54 [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2020/05/02 19:50:54 [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2020/05/02 19:50:54 [DEBUG] New state was assigned lineage "39f352e1-5d2f-f7a4-b2ff-273d5267b668"
2020/05/02 19:50:54 [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
@worldofprasanna
worldofprasanna / download_apk.py
Created November 22, 2019 11:06
Download APK files from google play store
import sys
import os
from gpapi.googleplay import GooglePlayAPI
def main():
server = GooglePlayAPI('en_US', 'America/New York', 'bacon')
try:
server.login(email="<gmail userid>", password="<gmail password>")
storagepath = '/tmp/'
download = server.download('com.whatsapp', expansion_files=False)