Skip to content

Instantly share code, notes, and snippets.

View puttpotsawee's full-sized avatar

Potsawee Vechpanich puttpotsawee

View GitHub Profile
@puttpotsawee
puttpotsawee / dockerinstall_xenial.sh
Last active June 29, 2017 09:26 — forked from indykish/dockerinstall_xenial.sh
Install Docker 1.12 on Ubuntu Xenial 16.04.1 x64
# Install Docker on Xenial 16.04.1 x64
# Ref https://docs.docker.com/engine/installation/linux/ubuntulinux/
# No interactive for now.
export DEBIAN_FRONTEND=noninteractive
# Update your APT package index.
sudo apt-get -y update
# Update package information, ensure that APT works with the https method, and that CA certificates are installed.
sudo apt-get -y install apt-transport-https ca-certificates
# Add the new GPG key.
sudo apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
@puttpotsawee
puttpotsawee / elastic-2.yaml
Last active September 7, 2018 09:03
Existing elastic2 cluster
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: logging-elastic
spec:
replicas: 1
serviceName: logging-elastic
template:
metadata:
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: logging-kibana
spec:
replicas: 1
strategy: {}
template:
metadata:
@puttpotsawee
puttpotsawee / elastic-2-with-backup.yaml
Last active September 7, 2018 10:17
elasticsearch 2 with backup
---
apiVersion: apps/v1beta1
kind: StatefulSet
metadata:
name: logging-elastic
spec:
replicas: 1
serviceName: logging-elastic
template:
#!/bin/bash
OLD_CLUSTER=localhost:9201
NEW_CLUSTER=localhost:9202
OLD_CLUSTER_SERVICE=logging-elastic-service-old:9200
indices=$(curl $OLD_CLUSTER/_cat/indices | awk '{ print $3 }')
for index in $indices ; do
# get your indices prefix, write this regex to grasp your indices but skip .kibana index
if ! [[ $index =~ ^log.*$ ]]; then
continue
fi
@puttpotsawee
puttpotsawee / remote-reindex.sh
Created September 21, 2018 13:10
Create Remote Reindex from existing indices
#!/bin/bash
OLD_CLUSTER=localhost:9201
NEW_CLUSTER=localhost:9202
OLD_CLUSTER_SERVICE=logging-elastic-service-old:9200
indices=$(curl $OLD_CLUSTER/_cat/indices | awk '{ print $3 }')
printf "\n\n+++++reindexing those index+++++++\n"
for index in $indices; do
@puttpotsawee
puttpotsawee / elastic-tmp-service.yaml
Created September 24, 2018 14:11
The temp service using for Elasticsearch v2
---
apiVersion: v1
kind: Service
metadata:
name: logging-elastic-service-old
labels:
name: logging-elastic-service-old
spec:
clusterIP: None
ports:
@puttpotsawee
puttpotsawee / elastic-6.yaml
Last active September 24, 2018 14:18
The elasticsearch 6 cluster
---
apiVersion: v1
kind: Service
metadata:
name: logging-elastic-service
labels:
service: logging-elastic
spec:
clusterIP: None
ports:
@puttpotsawee
puttpotsawee / kibana-6.yaml
Created September 24, 2018 14:15
the kibana 6
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: logging-kibana
spec:
replicas: 1
strategy: {}
template:
metadata:
@puttpotsawee
puttpotsawee / reverse-proxy.conf.d
Created October 16, 2018 10:30
Nginx Reverse proxy to another server
upstream node {
# THIS IS THE IP ADDRESS TO PROXY TO
server 35.222.33.12:80 max_fails=2 fail_timeout=2s;
}
server {
listen 80;
server_name _;
root /usr/share/nginx/html;
location / {
proxy_set_header X-Real-IP $remote_addr;