Skip to content

Instantly share code, notes, and snippets.

@innovia
innovia / ElasticSearch Unassigned Shards Reassigner
Created June 30, 2015 11:32
ElasticSaerch unassigned shards reassign
#!/usr/bin/env ruby
require 'json'
es_cluster = 'http://localhost:9200'
master_node = "Howard the Duck" # sey your master node name here
unassigned_shards_info = `curl -s -XGET #{es_cluster}/_cat/shards | grep UNASSIGNED `.split("\n")
shard_indexes = []
@innovia
innovia / kubernetes_add_service_account_kubeconfig.sh
Last active January 29, 2024 23:00
Create a service account and generate a kubeconfig file for it - this will also set the default namespace for the user
#!/bin/bash
set -e
set -o pipefail
# Add user to k8s using service account, no RBAC (must create RBAC after this script)
if [[ -z "$1" ]] || [[ -z "$2" ]]; then
echo "usage: $0 <service_account_name> <namespace>"
exit 1
fi
@innovia
innovia / tiller_role_service_account_rbac.yaml
Last active March 12, 2019 12:19
Tiller service account per namespace
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: tiller-manager
namespace: stg
rules:
- apiGroups: ["", "extensions", "apps"]
resources: ["*"]
verbs: ["*"]
@innovia
innovia / service_account_role_and_role_binding.yaml
Last active March 12, 2019 12:19
Role for serviceacocunt bound to namespace
---
kind: Role
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
namespace: services-stg
name: deploy-stg
rules:
- apiGroups: ["", "extensions", "apps"] # "" indicates the core API group
resources: ["*"]
verbs: ["*"]
@innovia
innovia / setup_confg.yaml
Created September 9, 2017 09:02
Basic setup_config file
---
name: "MyProject"
description: "Some Django App"
manifest:
graft: "location/to/Django/staticfiles"
prune: "some-un-needed folder"
@innovia
innovia / setup.py
Last active October 23, 2022 13:22
from setuptools import find_packages, setup
from package import Package
setup(
author="Ami Mahloof",
author_email="author@email.com",
packages=find_packages(),
include_package_data=True,
cmdclass={
"package": Package
@innovia
innovia / package.py
Last active December 21, 2022 06:52
from setuptools import Command
import shlex
import subprocess
import os
WHEELHOUSE = "wheelhouse"
class Package(Command):
"""Package Code and Dependencies into wheelhouse"""
# Manifest syntax https://docs.python.org/2/distutils/sourcedist.html
graft wheelhouse
recursive-exclude __pycache__ *.pyc *.pyo *.orig
exclude *.js*
exclude *.git*
exclude *.coveragerc
exclude *.sh
exclude proc*
@innovia
innovia / oauth2_proxy.cfg
Last active November 25, 2019 05:56
Bit.ly ouath2 proxy configuration
# IP address and port on which the proxy should listen for requests
http_address = "127.0.0.1:4181"
upstreams = [ "http://127.0.0.1:8080" ]
request_logging = true
client_id = "GOOGLE CLIENT ID"
client_secret = "GOOGLE CLIENT SECRET"
cookie_secret = "COOKIE SECRET"
pass_host_header=true
email_domains = [ "domain.com" ]
# nginx proxy for Elasticsearch + Kibana
server {
listen 127.0.0.1:8080;
server_name your.domain.com;
# AWS DNS resolver (if you're running on AWS EC2, else use google DNS 8.8.8.8)
resolver 172.31.0.2;
# Fix nginx resolving url only on config load (AWS can change the endpoint IP at anytime)