vitalygusev | 507dfdb | 2019-05-28 12:53:55 +0400 | [diff] [blame^] | 1 | #!/bin/sh |
| 2 | |
| 3 | export SIMPLE_SETTINGS=${SIMPLE_SETTINGS:-sf_notifier.settings.production} |
| 4 | export SF_NOTIFIER_ALERT_ID_HASH_FUNC=${SF_NOTIFIER_ALERT_ID_HASH_FUNC:-sha256} |
| 5 | |
| 6 | WORKERS=${SF_NOTIFIER_WORKERS:-4} |
| 7 | BUFFER=${SF_NOTIFIER_BUFFER_SIZE:-32768} |
| 8 | PORT=${SF_NOTIFIER_APP_PORT:-5000} |
| 9 | CACHE_ITEMS=${SF_NOTIFIER_CACHE_ITEMS:-300} |
| 10 | CACHE_FILE=${SF_NOTIFIER_CACHE_FILE:-/tmp/cachefile} |
| 11 | |
| 12 | mkdir -p /var/log/sf-notifier |
| 13 | chown -R 999:999 /var/log/sf-notifier |
| 14 | |
| 15 | MULES=$(for _ in $(seq 1 $WORKERS); do |
| 16 | echo "--mule " |
| 17 | done) |
| 18 | |
| 19 | uwsgi -p 4 \ |
| 20 | --uid 999 \ |
| 21 | --gid 999 \ |
| 22 | --http 0.0.0.0:${PORT} \ |
| 23 | --wsgi-file sf_notifier/server.py \ |
| 24 | --callable app_dispatch \ |
| 25 | --buffer-size=${BUFFER} \ |
| 26 | --max-worker-lifetime 300 \ |
| 27 | --cache2 name=mycache,items=${CACHE_ITEMS},store=${CACHE_FILE},store_sync=10 \ |
| 28 | ${MULES} \ |
| 29 | --master |