mirror of https://github.com/sipwise/repoapi.git
* remove uwsgi configs for them * manage secret_key and virtualenv on postinst * restart uwsgi on postinst * add missing uwsgi as dependency Change-Id: I40a85e75d3961c7e84d49fce5e3026064cac1d56changes/41/7541/7
parent
89b15cf497
commit
75e7f0eb87
@ -1,27 +0,0 @@
|
||||
[uwsgi]
|
||||
|
||||
# Django-related settings
|
||||
# django 1.8 needs python >= 2.7
|
||||
plugin = python27
|
||||
# the base directory (full path)
|
||||
chdir = /usr/share/repoapi
|
||||
# Django's wsgi file
|
||||
module = repoapi.wsgi:application
|
||||
# the virtualenv (full path)
|
||||
home = /var/lib/repoapi/venv_prod
|
||||
# django setting
|
||||
env = DJANGO_SETTINGS_MODULE=repoapi.settings.prod
|
||||
|
||||
no-default-app = true
|
||||
|
||||
# Better process names
|
||||
auto-procname = true
|
||||
procname-prefix-spaced = [%n]
|
||||
|
||||
# Ensure correct signal is sent to processes on stop/restart
|
||||
die-on-term = true
|
||||
touch-reload = %p
|
||||
|
||||
# celery
|
||||
workerpid = /var/lib/repoapi/celery-worker.pid
|
||||
smart-attach-daemon = %(workerpid) %(home)/bin/python %(chdir)/manage.py celery worker --pidfile=%(workerpid) -l info
|
@ -0,0 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
USR_DIR=/usr/share/repoapi
|
||||
LIB_DIR=/var/lib/repoapi
|
||||
|
||||
# summary of how this script can be called:
|
||||
# * <postinst> `configure' <most-recently-configured-version>
|
||||
# * <old-postinst> `abort-upgrade' <new version>
|
||||
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
||||
# <new-version>
|
||||
# * <postinst> `abort-remove'
|
||||
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
||||
# <failed-install-package> <version> `removing'
|
||||
# <conflicting-package> <version>
|
||||
# for details, see http://www.debian.org/doc/debian-policy/ or
|
||||
# the debian-policy package
|
||||
|
||||
mk_dj_secret() {
|
||||
python -c "import random,string;print '%s'%''.join([random.SystemRandom().choice(\"{}{}{}\".format(string.ascii_letters, string.digits, string.punctuation)) for i in range(63)])" ;
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
configure)
|
||||
if ! [ -f "${LIB_DIR}/.secret_key" ] ; then
|
||||
mk_dj_secret > "${LIB_DIR}/.secret_key"
|
||||
chmod 600 "${LIB_DIR}/.secret_key"
|
||||
chown www-data:www-data "${LIB_DIR}/.secret_key"
|
||||
echo "generated secret_key"
|
||||
fi
|
||||
cd "${USR_DIR}" && make venv_prod
|
||||
service uwsgi restart repoapi || true
|
||||
;;
|
||||
|
||||
abort-upgrade|abort-remove|abort-deconfigure)
|
||||
exit 0
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "postinst called with unknown argument \`$1'" >&2
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
#DEBHELPER#
|
||||
|
||||
exit 0
|
@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Celery Flower Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=www-data
|
||||
Group=www-data
|
||||
Environment=DJANGO_SETTINGS_MODULE=repoapi.settings.prod
|
||||
WorkingDirectory=/usr/share/repoapi
|
||||
ExecStart=/var/lib/repoapi/venv_prod/bin/python ./manage.py celery flower \
|
||||
--db=/var/lib/repoapi/flower.db --persistent --xheaders \
|
||||
--url_prefix=flower --unix_socket=/var/lib/repoapi/celery-flower.socket
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Celery Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=www-data
|
||||
Group=www-data
|
||||
Environment=DJANGO_SETTINGS_MODULE=repoapi.settings.prod
|
||||
PIDFile=/var/lib/repoapi/celery-worker.pid
|
||||
WorkingDirectory=/usr/share/repoapi
|
||||
ExecStart=/var/lib/repoapi/venv_prod/bin/python ./manage.py celery worker \
|
||||
--pidfile=/var/lib/repoapi/celery-worker.pid --loglevel=INFO
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -1,26 +0,0 @@
|
||||
[uwsgi]
|
||||
|
||||
# Django-related settings
|
||||
# django 1.8 needs python >= 2.7
|
||||
plugin = python27
|
||||
# the base directory (full path)
|
||||
chdir = /usr/share/repoapi
|
||||
# the virtualenv (full path)
|
||||
home = /var/lib/repoapi/venv_prod
|
||||
# django setting
|
||||
env = DJANGO_SETTINGS_MODULE=repoapi.settings.prod
|
||||
|
||||
no-default-app = true
|
||||
|
||||
# Better process names
|
||||
auto-procname = true
|
||||
procname-prefix-spaced = [%n]
|
||||
|
||||
# Ensure correct signal is sent to processes on stop/restart
|
||||
die-on-term = true
|
||||
touch-reload = %p
|
||||
|
||||
# monitor celery
|
||||
flower_socket = /var/lib/repoapi/celery-flower.socket
|
||||
flower_db = /var/lib/repoapi/flower.db
|
||||
attach-daemon = %(home)/bin/python %(chdir)/manage.py celery flower --db=%(flower_db) --persistent --xheaders --url_prefix=flower --unix_socket=%(flower_socket)
|
Loading…
Reference in new issue