Commits

Yann Malet committed a0c4b9c

Move the shell scripts into a fabfile to group all the command in a single place

Comments (0)

Files changed (4)

 # glob syntax.
 syntax: glob
 
-uwsgi-tip/*
+ve/*
 vassal-sites/*/ve/*
+from fabric.api import local
+
+
+def create_virtualenvs():
+    """
+    Creates the virtualenvs for the emperor and the 2 vassal sites
+    """
+    local("pip install -E ve -r requirements.pip")
+    local("pip install -E vassal-sites/site1/ve -r requirements.pip")
+    local("pip install -E vassal-sites/site2/ve -r requirements.pip")
+    
+    
+def delete_virtualenvs():
+    """
+    Delete the virtualenvs the emperor and the 2 vassal sites
+    """
+    local("rm -rf ve vassal-sites/*/ve")
+    
+def delete_emperor_log():
+    """
+    deletes the uwsgi.log
+    """
+    local("rm uwsgi.log")
+    
+def delete_emperor_pid():
+    """
+    Deletes the uwsgi.pid
+    """
+    local("rm uwsgi.pid")
+    
+def clean():
+    """
+    Stop the emperor, delete the pid and the log
+    """
+    stop_emperor()
+    delete_emperor_pid()
+    delete_emperor_log()
+    
+def start_emperor():
+    """
+    Starts the uwsgi instance in emperor mode
+    """
+    #Create the folder where we are storing the socket
+    try:
+        local("mkdir /tmp/sockets")
+    except:
+        pass
+    local('. ve/bin/activate; uwsgi --emperor "vassal-sites/*/*.xml" --pidfile uwsgi.pid --daemon uwsgi.log --fastrouter :3031 --fastrouter-use-cache --cache 100 --socket :3032')
+       
+def stop_emperor():
+    """
+    Stops the uwsgi emperor
+    """
+    local("kill -9 `cat uwsgi.pid`")

start-uwsgi.sh

-#!/bin/bash
-
-BASEDIR=$(dirname $0)
-echo $BASEDIR
-cd $BASEDIR
-. uwsgi-tip/bin/activate
-echo `which uwsgi`
-uwsgi --emperor "$BASEDIR/vassal-sites/*/*.xml" --pidfile $BASEDIR/uwsgi.pid --daemon $BASEDIR/uwsgi.log --fastrouter :3031 --fastrouter-use-cache --cache 100 --socket :3032

stop-uwsgi.sh

-#!/bin/bash
-
-BASEDIR=$(dirname $0)
-kill -9 `cat $BASEDIR/uwsgi.pid`
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.