Skip to content

Instantly share code, notes, and snippets.

View muresan's full-sized avatar

Catalin Muresan muresan

  • Broadwing
  • Scotland
View GitHub Profile
# limit the number of connections to 1 per second and allow to burst to 10
limit_req_zone $http_x_forwarded_for zone=application:10m rate=1r/s; # For Load Balanced environments
#limit_req_zone $remote_addr zone=application:10m rate=1r/s; # For Single Instance environments
limit_req zone=application burst=10 nodelay;
limit_req_status 429;
limit_conn_status 429;
# pass real IP from client to NGINX
real_ip_header X-Forwarded-For;
set_real_ip_from 0.0.0.0/0;
@muresan
muresan / ansible.cfg
Created February 13, 2019 14:44
Enable much better debugging for ansible
[defaults]
stdout_callback=debug
stderr_callback=debug
FROM lsiobase/alpine.python:3.8
# set version label
ARG BUILD_DATE
ARG VERSION
LABEL build_version="Linuxserver.io version:- ${VERSION} Build-date:- ${BUILD_DATE}"
LABEL maintainer="sparklyballs"
# set python to use utf-8 rather than ascii
ENV PYTHONIOENCODING="UTF-8"
vars:
es_nodes:
elastic1:
es_port: 9200
elastic2:
es_port: 9201
elastic3:
es_port: 9202
elastic4:
es_port: 9203
@muresan
muresan / Dockerfile
Last active August 7, 2018 12:04
ElasticSearch + fluentd deployment
FROM fluent/fluentd
RUN apk add --update --virtual .build-deps \
sudo build-base ruby-dev \
&& sudo gem install \
fluent-plugin-elasticsearch \
&& sudo gem sources --clear-all \
&& apk del .build-deps \
&& rm -rf /var/cache/apk/* \
/home/fluent/.gem/ruby/2.4.0/cache/*.gem
# resize /var/www/server.name/pics/image.jpg?h=100&w=100 to /var/www/server.name/pics/100x100/image.jpg
server {
listen 80;
server_name server.name;
root /var/www/server.name;
location /media/ {
alias /var/www/server.name/pics/;
@muresan
muresan / unnamed.txt
Created October 30, 2017 17:58
Bonnie++ in host and then in container.
[root@lemon bonnie]# mkdir /root/bonnie && cd /root/bonnie
[root@lemon bonnie]# bonnie++ -c 16 -s 16384 -d . -u 0:0
Using uid:0, gid:0.
Writing a byte at a time...done
Writing intelligently...done
Rewriting...done
Reading a byte at a time...done
Reading intelligently...done
start 'em...done...done...done...done...done...
Create files in sequential order...done.
@muresan
muresan / helloworld-compose.yml
Last active October 9, 2017 10:55
Traefik on rancher
version: '2'
services:
helloworld:
image: muresan/node-helloworld:1.2
labels:
traefik.frontend.rule: Host:www.helloworld.com,helloworld.com
traefik.port: '3000'
traefik.enable: 'true'
traefik.protocol: 'http'
traefik.frontend.entryPoints: 'http'
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
# Increase size of file handles and inode cache
fs.file-max = 2097152
# Do less swapping
vm.swappiness = 10
# format table
$ docker ps -a --format 'table {{.ID}}\t{{.Image}}\t{{.Command}}\t{{.CreatedAt}}\t{{.Status}}'
# filter
# until (<timestamp>) - only remove containers created before given timestamp
# label (label=<key>, label=<key>=<value>, label!=<key>, or label!=<key>=<value>)
# - only remove containers with (or without, in case label!=... is used) the specified labels.
$ docker run -ti -l keep=yes -d alpine sleep 1h
$ docker container prune --filter='label!=keep=yes'