Skip to content

Instantly share code, notes, and snippets.

@geeky-sh
geeky-sh / kube.sh
Last active October 23, 2019 08:01
kubernetes commands
minikube start # start the kubernetes cluster
minikube dashboard # start the server that helps manage k8s cluster
kubectl create deployment hello-node --image=gcr.io/hello-minikube-zero-install/hello-node # create deployment
kubectl get deployments # get deployments
kubectl get pods # get pods
kubectl get events # log of all the events created. Events are created whenever the command is run (more or less)
kubectl config view # view the kubectl configuration
kubectl expose deployment hello-node --type=LoadBalancer --port=8080 # expose the pod to the public internet
kubectl get services # view the service just created by the above command
minikube service hello-node # maps some external random port to 8080 and exposes the service to finally get used
@geeky-sh
geeky-sh / test_fixture.py
Created September 18, 2019 07:17
Use external Django server for testing - fixture
import pytest
import os
import sys
import subprocess
@pytest.fixture(autouse=True)
def core_server_url():
host = 'localhost'
port = '8003'
core_url = "http:{}:{}".format(host, port)
@geeky-sh
geeky-sh / additional.config
Last active July 2, 2019 02:12
EBExtensions db config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: main/wsgi.py
aws:elasticbeanstalk:application:environment:
STAGING: 1
DJANGO_SETTINGS_MODULE: main.settings
container_commands:
01_migrate:
command: "source /opt/python/current/env && source /opt/python/run/venv/bin/activate && cd /opt/python/current/app && ./manage.py migrate"
leader_only: true
@geeky-sh
geeky-sh / additional.config
Created March 31, 2019 10:22
EBExtensions db config
container_commands:
01_migrate:
command: "django-admin.py migrate"
leader_only: true
02_collecttatic:
command: "./manage.py collectstatic"
leader_only: true
option_settings:
aws:elasticbeanstalk:application:environment:
STAGING: 1
@geeky-sh
geeky-sh / django.config
Created March 31, 2019 10:19
EbExtensions - Django config
option_settings:
aws:elasticbeanstalk:container:python:
WSGIPath: main/wsgi.py
aws:elasticbeanstalk:application:environment:
STAGING: 1
@geeky-sh
geeky-sh / vscode-language-configuration.json
Last active February 22, 2019 10:41
Language configuration for VS Code
"[python]": {
"editor.insertSpaces": true,
"editor.tabSize": 4
},
"[elixir]": {
"editor.insertSpaces": true,
"editor.tabSize": 2
}
@geeky-sh
geeky-sh / learn20180215.md
Created February 18, 2019 06:36
Learning
# stack - group of interrelated services dependent on each other
@geeky-sh
geeky-sh / awsgyan.txt
Created January 16, 2019 14:37
DNS and AWS
1. Each VPC has it's own DNS server. Each subnet also has it's DNS server
2. When you use VPC's DNS, it will first try to resolve the names, using the private hosted zones defined in Route53.
If not found, it will using the public DNS for name resolution
3. Buying Name and Hosting Name are two different things.
4. How DNS works:
There are dns servers for every domain.
It will start from last entry to the first entry. So if I want to resolve www.coverfox.com. It will first ask .com servers for
the entry corresponding to coverfox.com. In this case, it will find the godaddy server. Now godaddy has it's own nameservers
which routes ip address based on the records defined.
4. Every time, I define a public hosted zone in Route53, aws will assign specific set of name servers for name resolution for that zone.
@geeky-sh
geeky-sh / docker-p3.sh
Last active January 16, 2019 09:52
How to work with docker swarms
# to create virtualmachines via docker
docker-machine create --driver virtualbox myvm1
docker-machine create --driver virtualbox myvm2
# to make one of the docker machines as swarm manager
docker-machine ssh myvm1 "docker swarm init --advertise-addr <myvm1 ip>"
# to make the other machine join the swarm
# this command is already provided in the output of docker swarm init
docker-machine ssh myvm2 "docker swarm join --token SWMTKN-1-04dj1n2u3r2ryipbw7s78jix3l9hpe9gsnpzisoavdydn0izol-b2biwtctehmshjbjr0e5asnwf 192.168.99.100:2377"