Mesos cluster with Marathon running Docker

Hi So for hosting docker in large scale i have tested mesos cluster.  Here is a guide for setting up 3 nodes in mesos running Centos 7. And the adding Marathon to controll the dockers running. The network mesos-master 172.0.0.10 mesos-slave1 172.0.0.11 mesos-slave2 172.0.0.12   The node also have on nic connect to the network with internet access.   Security… Read more →

Elasticsearch controller

So we uses alot of easticsearch. And here is i small script to get status and do some simple task with es server. You can get cluster status and cron for index deletions.   import urllib2 # # # Clean up elastich search index by removing old stuff. #The defult ip to es server dhost=’10.101.1.31′ #The index name you are… Read more →

Python DOS protection (iptables,dos)

here are a small script I use to have some sort of dos protection on my webservers.   import subprocess whitelist=[‘192.168.1.2’] blockvalue=2 alertvalue=1 proc = subprocess.Popen(“netstat -ntu | awk ‘{print $5}’ | cut -d: -f1 | sort | uniq -c | sort -n”, shell=True,stdout=subprocess.PIPE) running = proc.stdout.read() runing_sorted = running.split(‘\n’) for r in runing_sorted: con =r.split() if len(con) ==2: #If… Read more →

Build Openvpn centos 7

Here is how i build and setup openvpn on my centos 7 box. 1. Download and install openvpn latest Some yum packages   yum install openssl-devel lzo-devel pam-devel     https://openvpn.net/index.php/open-source/downloads.html   wget https://swupdate.openvpn.org/community/releases/openvpn-2.3.7.tar.gz tar zxvf openvpn-2.3.7.tar.gz cd openvpn-2.3.7 ./configure make make install # /usr/local/sbin/openvpn –version     So now we have the latest version setup and lets create some cert… Read more →

Python3 and rabbitmq

Im using rabbitmq in some of my python apps. Here is a small guide to get pyton3 to send and recive data from rabbitmq   I uses the code from https://code.google.com/p/py-amqplib/ And read some guide from http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/ from 2009 !!!!   Get the pip you need to connect sudo pip3 install amqp     My python code for sending and reciving… Read more →

Setup SPI on Raspberry pi (mcp3008, Adafruit)

Im building my own watering system and to that I will have some sensores.. They are connected to my pi over SFI and a mcp3008 from Adafruit.   The gear http://www.adafruit.com/products/1989 http://www.adafruit.com/products/856 http://www.kjell.com/sortiment/el/elektronik/elektroniklab/kopplingsplatta-lodfri-p87886 http://www.elecfreaks.com/store/octopus-soil-moisture-sensor-brick-p-422.html   Setup the cables Use this guide and se how the you should connect the mcp3008 and the sensore. http://www.raspberrypi-spy.co.uk/2013/10/analogue-sensors-on-the-raspberry-pi-using-an-mcp3008/   Get the Pi ready  … Read more →