Commits

Anonymous committed 08057ba

add local_settings

  • Participants
  • Parent commits 060d842

Comments (0)

Files changed (1)

-from fabric.api import * 
+from fabric.api import *
 from fabric.contrib.files import *
 from fabric.operations import put
 
 from lib.init import *
 from lib.cube import *
 
-# To quiet all interactive 
+from local_settings import *
+
+# To quiet all interactive
 #DEBIAN_FRONTEND=noninteractive
 
 env.hosts = [
-    #"cube0.tuijianbao.net", 
-    #"cube1.tuijianbao.net", 
-    #"cube2.tuijianbao.net", 
-    #"cube10.tuijianbao.net", 
-    "linode.sunliwen.com", 
+    #"cube0.tuijianbao.net",
+    #"cube1.tuijianbao.net",
+    #"cube2.tuijianbao.net",
+    #"cube10.tuijianbao.net",
+    "linode.sunliwen.com",
     #"ec2-175-41-224-146.ap-northeast-1.compute.amazonaws.com",
-    #"cube11.tuijianbao.net", 
-    #"cube12.tuijianbao.net", 
+    #"cube11.tuijianbao.net",
+    #"cube12.tuijianbao.net",
     #"cube13.tuijianbao.net",
-    
+
     #"ydhd01.tuijianbao.net",
     #"chinacache1.tuijianbao.net",
     #"hichina1.tuijianbao.net",
     #"cube1",
     #"cube2",
     #"cube3"
-    
+
     #"sunliwen.com"
 ]
 
 
 def host_type():
     run('uname -a')
-    
+
 def init_all():
     init_sys()
     init_nmp()
     init_app(url="i.sunliwen.com")
     init_app(url="pi.sunliwen.com")
     init_app(url="m.sunliwen.com")
-    
-def init_sys(): 
-    install_screen()   
+
+def init_sys():
+    install_screen()
     set_locale()
     #set_apt_cacher()  # not all site need this.
     apt_get_update()
     install_add_apt_repository()
     install_general_packages()
-    
-def init_apt_cacher():    
+
+def init_apt_cacher():
     set_locale()
     install_apt_cacher()
     enable_apt_cacher()
     start_apt_cacher()
     set_apt_cacher()
     apt_get_update()
-    
+
 def init_java():
     add_jdk_source()
     apt_get_update()
     install_php()
     install_pymysql()
     init_phpfpm()
-    
+
 def install_php():
     sudo("apt-get -y -q --force-yes install php5-cli php5-cgi php5-mysql php5-curl")
     sudo("apt-get -y -q --force-yes install php5-mcrypt libmcrypt4 mcrypt")
     # phpmyadmin have to be interactive
-    
+
 def install_mysql():
     sudo("yes 'yes' | DEBIAN_FRONTEND=readline apt-get -y -q install mysql-server mysql-server-5.1")
-    
+
 def install_pymysql():
     sudo("yes 'yes' | DEBIAN_FRONTEND=readline apt-get install libmysqlclient16 libmysqlclient16-dev python-dev")
-    
+
 def install_nginx():
     sudo("add-apt-repository ppa:nginx/stable")
     sudo("apt-get update")
     sudo("apt-get -y -q install php5-fpm")
     # GOTCHA: post_max_size = 8M
     # /etc/php5/fpm/php.ini
-    
+
 
 # deprecated, use php-fpm instead
 def init_fastcgi():
         remote_path="/tmp/php-fastcgi")
     sudo("mv /tmp/php-fastcgi /etc/init.d/php-fastcgi")
     sudo("chmod +x /etc/init.d/php-fastcgi")
-    sudo("update-rc.d php-fastcgi defaults") 
+    sudo("update-rc.d php-fastcgi defaults")
     if exists("/var/run/php-fastcgi/php-fastcgi.pid"):
-        sudo("/etc/init.d/php-fastcgi restart") 
+        sudo("/etc/init.d/php-fastcgi restart")
     else:
-        sudo("/etc/init.d/php-fastcgi start") 
+        sudo("/etc/init.d/php-fastcgi start")
     sudo("/etc/init.d/nginx restart")
-    
+
 def init_hg():
     init_pip()
     sudo("apt-get -q -y install mercurial")
     sudo("apt-add-repository ppa:bchesneau/gunicorn")
     sudo("apt-get update")
     sudo("apt-get -q -y install gunicorn")
-    
+
 def init_pip():
     sudo("apt-get -q -y install python-dev python-pip")
     sudo("pip install --upgrade pip")
     sudo("apt-get -y upgrade")
 
 def install_uwsgi():
-    cmds = ["add-apt-repository ppa:uwsgi/release",  
-            "apt-get update",  
+    cmds = ["add-apt-repository ppa:uwsgi/release",
+            "apt-get update",
             "apt-get -q -y install uwsgi-python libxml2-dev",
             "pip install --upgrade uwsgi"]
     for cmd in cmds:
     sudo("mv /tmp/10gen.list /etc/apt/sources.list.d/")
     sudo("apt-get update")
     sudo("apt-get install mongodb-10gen")
-    
+
 def init_py():
     install_pymongo()
     install_pyredis()
     sudo("apt-get -q -y install python-dev")
     sudo("pip install --upgrade pymongo") # c extension to promote performance
     #sudo("pip install --upgrade pymongo")
-    
+
 def install_pyredis():
     sudo("pip install --upgrade redis") # c extension to promote performance
 
         sudo("mkdir -p /cube/service/"+name+"/work")
         #sudo("cd /cube/service/"+name)
         #sudo("hg clone http://i.tuijianbao.net/hg/server")
-        
+
 def install_ufw():
     sudo("apt-get -q -y install ufw")
-        
+
 def enable_ufw():
     # allow 22 first, then enable
     sudo("ufw allow 22")
     sudo("ufw allow 8000")
     sudo("ufw allow from 192.168.0.0/24")
     sudo("yes 'Y' | ufw enable")
-
-