summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rwxr-xr-xpy-fake-service/fake-user-agent-deamon33
-rw-r--r--py-fake-service/requirements.txt2
-rw-r--r--service/requirements.txt2
-rwxr-xr-xservice/user-agent-deamon33
5 files changed, 71 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 6a8b6332..e3d77a7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,3 +27,5 @@ fake-service/data/mail-sets/
.vagrant/
__pycache__/
.virtualenv
+gunicorn.pid
+gunicorn.log
diff --git a/py-fake-service/fake-user-agent-deamon b/py-fake-service/fake-user-agent-deamon
new file mode 100755
index 00000000..621f463e
--- /dev/null
+++ b/py-fake-service/fake-user-agent-deamon
@@ -0,0 +1,33 @@
+#!/bin/bash
+export PYTHONPATH=`pwd`/app:$PYTHONPATH
+
+USER_AGENT_PORT=4567
+
+function do_stop() {
+ test -e gunicorn.pid && (kill -9 $(cat gunicorn.pid) && rm gunicorn.pid && echo "Stopped User Agent") || echo "User Agent is not running"
+}
+
+function do_start() {
+ echo "gunicorn pixelated_user_agent:app -b 0.0.0.0:$USER_AGENT_PORT -D -p gunicorn.pid --log-file=gunicorn.log"
+ gunicorn pixelated_user_agent:app -b 0.0.0.0:$USER_AGENT_PORT -D -p gunicorn.pid --log-file=gunicorn.log
+}
+
+case $1 in
+ restart)
+ do_stop && do_start
+ ;;
+ start)
+ do_start
+ ;;
+ stop)
+ do_stop
+ ;;
+ killall)
+ pgrep -f gunicorn | xargs kill -9
+ rm -rf gunicorn.pid
+ ;;
+ *)
+ echo "usage: start|stop|restart|killall"
+ ;;
+esac
+
diff --git a/py-fake-service/requirements.txt b/py-fake-service/requirements.txt
index 8f4785c6..cb34951c 100644
--- a/py-fake-service/requirements.txt
+++ b/py-fake-service/requirements.txt
@@ -1,4 +1,4 @@
flask==0.10.1
scanner==0.0.5
requests==2.3.0
-
+gunicorn==19.1.1
diff --git a/service/requirements.txt b/service/requirements.txt
index 37df8a34..4087387a 100644
--- a/service/requirements.txt
+++ b/service/requirements.txt
@@ -17,3 +17,5 @@ leap.keymanager==0.3.8
leap.soledad.common==0.5.2
leap.soledad.client==0.5.2
leap.mail==0.3.9-1-gc1f9c92
+gunicorn==19.1.1
+
diff --git a/service/user-agent-deamon b/service/user-agent-deamon
new file mode 100755
index 00000000..84493d2d
--- /dev/null
+++ b/service/user-agent-deamon
@@ -0,0 +1,33 @@
+#!/bin/bash
+export PYTHONPATH=`pwd`/app:$PYTHONPATH
+
+USER_AGENT_PORT=3333
+
+function do_stop() {
+ test -e gunicorn.pid && (kill -9 $(cat gunicorn.pid) && rm gunicorn.pid && echo "Stopped User Agent") || echo "User Agent is not running"
+}
+
+function do_start() {
+ echo "gunicorn pixelated_user_agent:app -b 0.0.0.0:$USER_AGENT_PORT -D -p gunicorn.pid --log-file=gunicorn.log"
+ gunicorn pixelated_user_agent:app -b 0.0.0.0:$USER_AGENT_PORT -D -p gunicorn.pid --log-file=gunicorn.log
+}
+
+case $1 in
+ restart)
+ do_stop && do_start
+ ;;
+ start)
+ do_start
+ ;;
+ stop)
+ do_stop
+ ;;
+ killall)
+ pgrep -f gunicorn | xargs kill -9
+ rm -rf gunicorn.pid
+ ;;
+ *)
+ echo "usage: start|stop|restart|killall"
+ ;;
+esac
+