FastHandle - IT Operations Examples

FastHandle is fast operation tools for infrastructure configurations and tests.

User Tools

Site Tools


Sidebar


Top     SiteMap

Manager Server

Target Server

$FHHOME/bin/xxx.sh | xxxx.exp













.

middleware:nginx:index.html



This is an old revision of the document!


Top#Middleware Management

Nginx (nginx.py)

Operation

$ fab -l |grep nginx

$ H=test-server-1,test-server-2
$ fab  -H $H auth.pro  nginx.install_yum

Ref. Remote Shell Commands

$ H=test-server-1,test-server-2

$ fab  -H $H auth.pro  -- sudo systemctl status nginx
$ fab  -H $H auth.pro  -- sudo systemctl restart nginx

$ fab  -H $H auth.pro  -- "ps aux |grep nginx"
$ fab  -H $H auth.pro  -- "netstat -an |grep 80"


nginx.py

$FHHOME/fabfile/nginx.py

import sys
from fabric.api import *
from fabric.contrib import files
 
#----------------------------------------------------------------------
# Installing Nginx
#----------------------------------------------------------------------
# nginx.install_yum
@task
def install_yum():
    sudo("rpm -q nginx        > /dev/null 2>&1 || yum -y install nginx")

# nginx.install_apt
@task
def install_apt():
    sudo("dpkg -l |grep nginx > /dev/null 2>&1 || apt update && apt install -y nginx")



#----------------------------------------------------------------------
# Check Configuration Files
#----------------------------------------------------------------------
# nginx.check_files_etc_nginx
@task
def check_files_etc_nginx():
    '''tree -Dpuga  /etc/nginx'''
    run("tree -Dpuga  /etc/nginx")


#----------------------------------------------------------------------
# Check Header
#----------------------------------------------------------------------
@task
def check_header():
    '''curl -I http://localhost/'''
    run("curl -I http://localhost/")



Nginx Configuration Examples



middleware/nginx/index.html.1518013391.txt.gz ยท Last modified: 2018/02/07 23:23 by kurihara