From f1f20ec00a0ca79b2b3afc5cb535c26b3cc892e8 Mon Sep 17 00:00:00 2001 From: vapao Date: Wed, 8 Jan 2020 00:25:18 +0800 Subject: [PATCH] U api update --- spug_api/logs/.gitkeep | 0 spug_api/tools/start-api.sh | 5 +++++ spug_api/tools/start-monitor.sh | 5 +++++ spug_api/tools/start-scheduler.sh | 5 +++++ spug_api/tools/start-worker.sh | 5 +++++ spug_api/tools/start-ws.sh | 5 +++++ spug_api/tools/supervisor-spug.ini | 29 +++++++++++++++++++++++++++++ 7 files changed, 54 insertions(+) create mode 100644 spug_api/logs/.gitkeep create mode 100644 spug_api/tools/start-api.sh create mode 100644 spug_api/tools/start-monitor.sh create mode 100644 spug_api/tools/start-scheduler.sh create mode 100644 spug_api/tools/start-worker.sh create mode 100644 spug_api/tools/start-ws.sh create mode 100644 spug_api/tools/supervisor-spug.ini diff --git a/spug_api/logs/.gitkeep b/spug_api/logs/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/spug_api/tools/start-api.sh b/spug_api/tools/start-api.sh new file mode 100644 index 0000000..cb1857d --- /dev/null +++ b/spug_api/tools/start-api.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# start api service +cd $(dirname $(dirname $0)) +source ./venv/bin/activate +exec gunicorn -b :9001 -w 2 --threads 8 --access-logfile - spug.wsgi \ No newline at end of file diff --git a/spug_api/tools/start-monitor.sh b/spug_api/tools/start-monitor.sh new file mode 100644 index 0000000..dbe7837 --- /dev/null +++ b/spug_api/tools/start-monitor.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# start monitor service +cd $(dirname $(dirname $0)) +source ./venv/bin/activate +exec python manage.py runmonitor \ No newline at end of file diff --git a/spug_api/tools/start-scheduler.sh b/spug_api/tools/start-scheduler.sh new file mode 100644 index 0000000..e379eae --- /dev/null +++ b/spug_api/tools/start-scheduler.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# start schedule service +cd $(dirname $(dirname $0)) +source ./venv/bin/activate +exec python manage.py runscheduler \ No newline at end of file diff --git a/spug_api/tools/start-worker.sh b/spug_api/tools/start-worker.sh new file mode 100644 index 0000000..0e6a9b4 --- /dev/null +++ b/spug_api/tools/start-worker.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# start worker service +cd $(dirname $(dirname $0)) +source ./venv/bin/activate +exec python manage.py runworker ssh_exec \ No newline at end of file diff --git a/spug_api/tools/start-ws.sh b/spug_api/tools/start-ws.sh new file mode 100644 index 0000000..8e6b904 --- /dev/null +++ b/spug_api/tools/start-ws.sh @@ -0,0 +1,5 @@ +#!/bin/bash +# start websocket service +cd $(dirname $(dirname $0)) +source ./venv/bin/activate +exec daphne -p 9002 spug.asgi:application \ No newline at end of file diff --git a/spug_api/tools/supervisor-spug.ini b/spug_api/tools/supervisor-spug.ini new file mode 100644 index 0000000..946a348 --- /dev/null +++ b/spug_api/tools/supervisor-spug.ini @@ -0,0 +1,29 @@ +[program:spug-api] +command = bash /data/spug/spug_api/tools/start-api.sh +autostart = true +stdout_logfile = /data/spug/spug_api/logs/api.log +redirect_stderr = true + +[program:spug-ws] +command = bash /data/spug/spug_api/tools/start-ws.sh +autostart = true +stdout_logfile = /data/spug/spug_api/logs/ws.log +redirect_stderr = true + +[program:spug-worker] +command = bash /data/spug/spug_api/tools/start-worker.sh +autostart = true +stdout_logfile = /data/spug/spug_api/logs/worker.log +redirect_stderr = true + +[program:spug-monitor] +command = bash /data/spug/spug_api/tools/start-monitor.sh +autostart = true +stdout_logfile = /data/spug/spug_api/logs/monitor.log +redirect_stderr = true + +[program:spug-scheduler] +command = bash /data/spug/spug_api/tools/start-scheduler.sh +autostart = true +stdout_logfile = /data/spug/spug_api/logs/scheduler.log +redirect_stderr = true \ No newline at end of file