Skip to content

Instantly share code, notes, and snippets.

@vans163
Last active February 13, 2017 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vans163/898c9d8a952c3787d13314b8f0d1d018 to your computer and use it in GitHub Desktop.
Save vans163/898c9d8a952c3787d13314b8f0d1d018 to your computer and use it in GitHub Desktop.
mkdir -p /srv/salt
#.bash_profile
#ulimit -n 63536
#top -aSCHIP
# sysctl dev.igb | grep -v ": 0"
# pfctl -si
#processor.max_cstate=1
#intel_idle.max_cstate=0
echo 0 > /proc/sys/kernel/numa_balancing
swapoff -a
echo -e "
base:
'*':
- dev
- monitor
- erlang
" > /srv/salt/top.sls
echo -e "
benchmark_packages:
pkg.installed:
- pkgs:
{% if grains['os'] == 'Fedora' %}
- httpd-tools
{% else %}
{% endif %}
wrk2_packages:
pkg.installed:
- pkgs:
- git
{% if grains['os'] == 'Fedora' %}
- openssl-devel
{% elif grains['os'] == 'Debian' %}
- libssl-dev
- build-essential
{% endif %}
benchmark_wrk2:
" > /srv/salt/benchmark.sls
echo -e "
dev_packages:
pkg.installed:
- pkgs:
- git
{% if grains['os'] == 'Fedora' %}
- vim-enhanced
{% else %}
- vim
{% endif %}
" > /srv/salt/dev.sls
echo -e "
monitor_packges:
pkg.installed:
- pkgs:
- iotop
- iftop
- htop
- byobu
- tcpdump
{% if grains['os'] == 'Fedora' %}
- lm_sensors
{% else %}
{% endif %}
" > /srv/salt/monitor.sls
echo -e "
erlang_packages:
pkg.installed:
- pkgs:
- git
- inotify-tools
https://github.com/erlang/otp:
git.latest:
- rev: OTP-19.1
- target: /src_code/otp
- require:
- pkg: erlang_packages
erlang_R19_compile:
cmd.run:
- unless: if ! [ \$(command -v erl) ]; then do_error; else if [ \$(erl -noshell -eval '{ok, Version} = file:read_file(filename:join([code:root_dir(), \"releases\", erlang:system_info(otp_release), \"OTP_VERSION\"])), io:fwrite(\"~s\", [Version]), halt().') != '19.1' ]; then do_error; fi fi
- cwd: /src_code/otp
- name: |
{% if grains['os'] == 'Fedora' %}
dnf install -y @development-tools m4 sed autoconf openssl-devel ncurses-devel
{% elif grains['os'] == 'Debian' %}
apt-get install -y build-essential m4 sed autoconf libssl-dev ncurses-dev libwxgtk3.0-dev
{% else %}
{% endif %}
export HOME=~
export MAKEFLAGS=-j4
export ERL_TOP=\`pwd\`
./otp_build autoconf
./configure
make && make install
erlang_rebar3_compile:
cmd.run:
- unless: if ! [ \$(command -v rebar3) ]; then do_error; else if [ \$(rebar3 -v | awk '{print \$2}') != '3.3.1' ]; then do_error; fi fi
- cwd: /tmp
- name: |
export HOME=~
wget https://github.com/erlang/rebar3/releases/download/3.3.1/rebar3
chmod +x rebar3
./rebar3 local install
ln -f -s ~/.cache/rebar3/bin/rebar3 /usr/bin/rebar3
mkdir -p ~/.config/rebar3/
echo '{plugins, [rebar3_auto]}.' > ~/.config/rebar3/rebar.config
" > /srv/salt/erlang.sls
echo -e "
{% if grains['os'] == 'Fedora' %}
rc-local:
service.running:
- enable: True
/etc/rc.d/rc.local:
{% elif grains['os'] == 'Debian' %}
/etc/rc.local:
{% else %}
/etc/rc.local:
{% endif %}
file.managed:
- user: root
- group: root
- mode: 755
- contents:
- #!/bin/bash
- /usr/bin/echo 0 > /sys/kernel/mm/ksm/run
- /usr/bin/echo 0 > /sys/kernel/mm/ksm/merge_across_nodes
/etc/selinux/config:
file.managed:
- contents:
- SELINUX=disabled
- SELINUXTYPE=targeted
/etc/sysctl.conf:
file.managed:
- contents:
# 20m open file descriptors
- fs.nr_open = 20000000
- fs.file-max = 20000000
# tcp tuning
- net.ipv4.tcp_rmem = 1024 4096 16384
- net.ipv4.tcp_wmem = 1024 4096 16384
- net.ipv4.tcp_moderate_rcvbuf = 0
# send redirects (not a router, disable it)
- net.ipv4.conf.all.send_redirects = 0
" > /srv/salt/kernel.sls
# /etc/security/limits.conf
# * soft nofile 20000000
# * hard nofile 20000000
# root soft nofile 20000000
# root hard nofile 20000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment