basic debianization

This commit is contained in:
Vladimir Eremin 2014-03-19 14:49:04 +04:00
parent 259400cc92
commit 24c54efcda
11 changed files with 124 additions and 2 deletions

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
stacktach (1.0) unstable; urgency=low
* Initial
-- Vladimir Eremin <yottatsa@yandex-team.ru> Wed, 19 Mar 2014 12:52:15 +0400

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
8

14
debian/control vendored Normal file
View File

@ -0,0 +1,14 @@
Source: stacktach
Section: admin
Priority: extra
Maintainer: Vladimir Eremin <yottatsa@yandex-team.ru>
Build-Depends: debhelper (>= 7.0.0), cdbs
Standards-Version: 3.9.2
Package: stacktach
Architecture: all
XB-Python-Version: ${python:Versions}
Depends: ${python:Depends},
nginx, python-mysqldb,
python-django (>= 1.4.2), python-django-south, python-kombu
Description: OpenStack Tachometer

5
debian/default vendored Normal file
View File

@ -0,0 +1,5 @@
export STACKTACH_INSTALL_DIR="/usr/share/stacktach/"
export STACKTACH_DEPLOYMENTS_FILE="/etc/stacktach/stacktach_worker_config.json"
export STACKTACH_VERIFIER_CONFIG="/etc/stacktach/stacktach_verifier_config.json"
export DJANGO_SETTINGS_MODULE="settings"

10
debian/install vendored Normal file
View File

@ -0,0 +1,10 @@
static usr/share/stacktach/
templates usr/share/stacktach/
manage.py usr/share/stacktach/
urls.py usr/share/stacktach/
settings.py usr/share/stacktach/
worker usr/share/stacktach/
etc/*.py etc/stacktach/
etc/*.json etc/stacktach/
etc/nginx/stacktach etc/nginx/sites-available/
etc/init/stacktach.conf etc/init/

43
debian/postinst vendored Normal file
View File

@ -0,0 +1,43 @@
#!/bin/sh
# postinst script for yabs-setupserver-environment
#
# see: dh_installdeb(1)
set -e
# 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
case "$1" in
configure)
addgroup --system stacktach ||:
adduser --system stacktach --ingroup stacktach ||:
mkdir -p /var/log/stacktach
chown stacktach. /var/log/stacktach
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

15
debian/rules vendored Executable file
View File

@ -0,0 +1,15 @@
#!/usr/bin/make -f
DEB_PYTHON_SYSTEM=pysupport
DEB_PYTHON_INSTALL_ARGS_ALL += --install-layout=deb
DEB_PYTHON_DESTDIR = $(CURDIR)/debian/stacktach
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/python-distutils.mk
install/stacktach::
rm -f $(CURDIR)/debian/stacktach/usr/share/stacktach/local_settings.py
mkdir -p $(CURDIR)/debian/stacktach/usr/share/stacktach/stacktach
ln -s /etc/stacktach/local_settings.py $(CURDIR)/debian/stacktach/usr/share/stacktach/local_settings.py
mkdir -p $(CURDIR)/debian/stacktach/etc/init.d
mv $(CURDIR)/debian/stacktach/usr/share/stacktach/worker/stacktach.sh $(CURDIR)/debian/stacktach/etc/init.d/stacktach-worker

3
etc/init/stacktach.conf Normal file
View File

@ -0,0 +1,3 @@
respawn
exec sudo -u stacktach bash -c 'source /etc/default/stacktach; $STACKTACH_INSTALL_DIR/manage.py runserver --insecure'

12
etc/nginx/stacktach Normal file
View File

@ -0,0 +1,12 @@
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://127.0.0.1:8000/;
}
location /static {
root /usr/share/stacktach/;
}
}

View File

@ -0,0 +1,9 @@
import os
STACKTACH_DB_ENGINE = 'django.db.backends.mysql'
STACKTACH_DB_NAME = 'stacktach'
STACKTACH_DB_HOST = 'localhost'
STACKTACH_DB_USERNAME = 'stacktach'
STACKTACH_DB_PASSWORD = ''
STACKTACH_DB_PORT = '3306'
STACKTACH_INSTALL_DIR = os.environ.get('STACKTACH_INSTALL_DIR', '')
STACKTACH_DEPLOYMENTS_FILE = os.environ.get('STACKTACH_DEPLOYMENTS_FILE', '')

View File

@ -10,12 +10,17 @@
. /lib/lsb/init-functions
WORKDIR=/srv/www/stacktach/app
if [ -f /etc/default/stacktach ]
then
. /etc/default/stacktach
fi
WORKDIR=${STACKTACH_INSTALL_DIR:-/srv/www/stacktach/app}
DAEMON=/usr/bin/python
ARGS=$WORKDIR/worker/start_workers.py
PIDFILE=/var/run/stacktach.pid
export DJANGO_SETTINGS_MODULE="settings"
export DJANGO_SETTINGS_MODULE="${DJANGO_SETTINGS_MODULE:-settings}"
case "$1" in
start)