Created
September 9, 2018 00:57
-
-
Save alex2006hw/888f6ddf03e7b82b5362f8174f951ea9 to your computer and use it in GitHub Desktop.
cloud-init script for new development vm with /dev/sdb mounted as swap and /netdisk using gvm as version management for golang with fail2ban whitelisting and glances process monitoring
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Tested on ubuntu16 - 18 | |
# | |
#[ -f $HOME/.secrets ] && source "$HOME/.secrets" | |
ID=`id -nu` | |
# | |
# increase file handles | |
# | |
echo "fs.inotify.max_user_watches=524288" | tee -a /etc/sysctl.conf && sysctl -p | |
echo "fs.file-max = 131072" | tee /etc/sysctl.conf && sysctl -p | |
echo "session required pam_unix.so" | tee -a /etc/pam.d/common-session | |
echo "session optional pam_systemd.so" | tee -a /etc/pam.d/common-session | |
echo "session required pam_limits.so" | tee -a /etc/pam.d/common-session | |
# | |
echo "* soft nproc 131072" | tee -a /etc/security/limits.conf | |
echo "* hard nproc 131072" | tee -a /etc/security/limits.conf | |
echo "* soft nofile 131072" | tee -a /etc/security/limits.conf | |
echo "* hard nofile 131072" | tee -a /etc/security/limits.conf | |
echo "root soft nproc 131072" | tee -a /etc/security/limits.conf | |
echo "root hard nproc 131072" | tee -a /etc/security/limits.conf | |
echo "root soft nofile 131072" | tee -a /etc/security/limits.conf | |
echo "root hard nofile 131072" | tee -a /etc/security/limits.conf | |
# | |
echo "DefaultLimitNOFILE=20000" | tee -a /etc/systemd/system.conf | |
echo "DefaultLimitNOFILE=20000" | tee -a /etc/systemd/user.conf | |
echo "GatewayPorts clientspecified" | tee -a /etc/ssh/sshd_config | |
# | |
# install development packages | |
# | |
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
curl -fsSL https://download.docker.com/linux/$(. /etc/os-release; echo "$ID")/gpg | apt-key add - | |
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | |
# | |
apt-get update && apt-get -y upgrade | |
# | |
apt-get install -y libreadline6 libreadline6-dev \ | |
apt-utils screen htop sysstat nmap zsh wamerican python3-pip \ | |
libreadline-dev bison apt-transport-https ca-certificates curl software-properties-common \ | |
spell ispell pandoc python-pip build-essential python-dev lm-sensors libnotify-bin ccache libevent-dev \ | |
fail2ban bison zip unzip libdb-dev libleveldb-dev libsodium-dev zlib1g-dev libtinfo-dev libffi-dev \ | |
golang-go libxss1 libgconf-2-4 docker-ce parallel rpm fakeroot libkrb5-dev \ | |
restic s3fs libboost-python-dev libboost-thread-dev libbluetooth-dev libglib2.0-dev \ | |
libusb-1.0-0-dev libudev-dev autoconf libpng-dev libssl-dev libasound2 libgmp3-dev \ | |
postgresql-client-common postgresql-client | |
pip install --upgrade pip | |
usermod -aG docker $(whoami) | |
# | |
# glances | |
# | |
pip install psutil logutils bottle batinfo zeroconf netifaces pymdstat influxdb \ | |
elasticsearch potsdb statsd pystache docker-py pysnmp pika py-cpuinfo bernhard glances \ | |
tahoe-lafs | |
pip install https://bitbucket.org/gleb_zhulik/py3sensors/get/tip.tar.gz | |
# | |
# docker-compose | |
# | |
curl -L https://github.com/docker/compose/releases/download/1.22.0/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose | |
chmod +x /usr/local/bin/docker-compose | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
to use:
curl -o- https://gist.githubusercontent.com/alex2006hw/888f6ddf03e7b82b5362f8174f951ea9/raw/e9157f90bb681c8dedd8bbd61acb1417765a0171/ubuntu-golang-devserver-with-scratchdisk | bash