Skip to content

Instantly share code, notes, and snippets.

View richardsonlima's full-sized avatar
:octocat:
Focusing

Richardson Lima richardsonlima

:octocat:
Focusing
View GitHub Profile
#!/bin/env bash
# Created by Richardson Lima - contatorichardsonlima at gmail dot com
# set -x
Nat='' # NAT IP
Timeout='15' # Seconds
File='./EnvFile.txt'
User='' # Username for ssh connection
function CreateEnvFile(){
#!/bin/env bash
# Created by Richardson Lima - contatorichardsonlima at gmail dot com
# set -x
Timeout='15'
VlanHosts="/home/user/SrvList/VlanID01" # File that contains Servers ipaddr
User='' # SSH User
Port='' # SSH port
function CreateCollect(){
# Rename this file to Dockerfile
FROM scratch
MAINTAINER The CentOS Project <cloud-ops@centos.org>
ADD centos-7.2.1511-docker.tar.xz /
LABEL name="CentOS Base Image"
LABEL vendor="CentOS"
LABEL license=GPLv2
# Volumes for systemd
- Using Dockerfiles to Automate Building
- Building your Centos7.2 image
$ mkdir Docker_Env && cd Docker_Env && mkdir Centos7.2 && cd Centos7.2
$ wget https://gist.github.com/richardsonlima/6125b332ae68d97899b6 && mv mv 6125b332ae68d97899b6 Dockerfile
$ wget https://github.com/CentOS/sig-cloud-instance-images/blob/a3c59bd4e98a7f9c063d993955c8ec19c5b1ceff/docker/centos-7.2.1511-docker.tar.xz .
$ sudo docker build -t centos72:Centos72-mybuild01 .
- List your image
$ sudo docker images| grep Centos72-mybuild01
$ cat << EOF > Dockerfile
FROM scratch
MAINTAINER The CentOS Project <cloud-ops@centos.org> - ami_creator
ADD centos-7.1503-20150330_1749-docker.tar.xz /
CMD ["/bin/bash"]
EOF
$ wget https://github.com/CentOS/sig-cloud-instance-images/blob/bc561dfdd671d612dbb9f92e7e17dd8009befc44/docker/centos-7.1503-20150330_1749-docker.tar.xz
$ sudo docker build -t centos71_build01:Centos71-build01 .
$ sudo docker run -i -t 0766e111527f ps
* CentOS Dockerfiles for various common implementations
https://github.com/CentOS/CentOS-Dockerfiles
[+] Centos 7.2
- Pull an image
$ sudo docker pull centos
- List images
$ sudo docker images
#!/bin/bash
echo -e "\033[33;1;34m [*] \033[0m \033[33;1;32m Calculando MaxClients dividindo maior Apache Thread pela memoria livre \033[0m";
if [ -e /etc/debian_version ]; then
APACHE="apache2"
elif [ -e /etc/redhat-release ]; then
APACHE="httpd"
fi
APACHEMEM=$(ps -aylC $APACHE |grep "$APACHE" |awk '{print $8'} |sort -n |tail -n 1)
APACHEMEM=$(expr $APACHEMEM / 1024)
SQLMEM=$(ps -aylC mysqld |grep "mysqld" |awk '{print $8'} |sort -n |tail -n 1)
#!/bin/bash
# set -x
# save the script in /usr/local/bin/fw-rules-websrv-02 and make it executable
# chmod +x /usr/local/bin/fw-rules-websrv-02
# run --> fw-rules-websrv-02
IPTABLES=/sbin/iptables
IFACE_EXT="eth0"
IFACE_INT="eth1"
WEBSRV_01_INT_ADDR=""
- SysCtl Conf (kernel)
http://blog.richardsonlima.com.br/post/138189026200/coping-with-the-tcp-time-wait-state-on-busy-linux
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_tw_recycle = 0
net.ipv4.ip_local_port_range = 1024 65023
net.ipv4.tcp_max_syn_backlog = 10240
net.ipv4.tcp_max_tw_buckets = 400000
net.ipv4.tcp_max_orphans = 60000
net.ipv4.tcp_synack_retries = 3
# Layer7 [mode http]
global
log /dev/log local0
log 127.0.0.1 local1 notice
maxconn 4096
user haproxy
group haproxy
daemon
defaults