Skip to content

Instantly share code, notes, and snippets.

View electric380v's full-sized avatar

Sergii Kh electric380v

  • UA
  • 13:44 (UTC +03:00)
View GitHub Profile
@electric380v
electric380v / delete-dockerhub-images.sh
Created December 26, 2019 09:55
delete-dockerhub-images
#!/bin/bash
# Based on kizbitz/dockerhub-v2-api-organization.sh at https://gist.github.com/kizbitz/175be06d0fbbb39bc9bfa6c0cb0d4721
# Example for the Docker Hub V2 API
# Returns all images and tags associated with a Docker Hub organization account.
# Requires 'jq': https://stedolan.github.io/jq/
# set username, password, and organization
UNAME=""
UPASS=""
@electric380v
electric380v / envoy.json
Last active November 13, 2019 13:12
envoy.json
{
"listeners": [
{
"address": "tcp://0.0.0.0:1010",
"filters": [
{
"type": "read",
"name": "http_connection_manager",
"config": {
"access_log": [
@electric380v
electric380v / nomad_sample_job.sublime-snippet
Created October 22, 2019 09:49
nomad_sample_job.sublime-snippet
<snippet>
<tabTrigger>nomad-docker-service</tabTrigger>
<content><![CDATA[
# https://www.nomadproject.io/docs/job-specification/job.html
job "${1:service-name}" {
datacenters = [${2:"public-services"}]
type = "service"
# https://www.nomadproject.io/docs/job-specification/reschedule.html
@electric380v
electric380v / nginx-tuning.md
Created July 3, 2019 13:27 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@electric380v
electric380v / consul-bind
Created April 10, 2019 21:18
consul-bind
sudo apt-get install bind9 bind9utils bind9-doc
wget https://dl.bintray.com/mitchellh/consul/0.5.2_linux_amd64.zip
/etc/bind/named.conf.options:
options {
directory "/var/cache/bind";
recursion yes;
allow-query { localhost; };
forwarders {
job "logs" {
region = "eu-north"
datacenters = ["eu-north-1a"]
constraint {
attribute = "${attr.kernel.name}"
value = "linux"
}
job "nginx" {
datacenters = ["dc1"]
type = "service"
group "nginx" {
count = 3
task "nginx" {
driver = "docker"
config {
image = "nginx"
port_map {
FROM node:latest as builder
ENV APP_HOST=0.0.0.0
ENV APP_PORT=3001
ENV APP_HOME /app
WORKDIR /app
@electric380v
electric380v / go-elasticsearch
Created March 20, 2019 14:16
go-elasticsearch
job "search" {
datacenters = ["dc1"]
# region = "us"
type = "service"
update {
stagger = "10s"
max_parallel = 1
@electric380v
electric380v / elasticsearch.nomad
Created March 20, 2019 14:16
elasticsearch.nomad
job "es-cluster" {
type = "service"
datacenters = ["ltech-main"]
update {
max_parallel = 1
health_check = "checks"
min_healthy_time = "180s"
healthy_deadline = "15m"
}