MT#12487 debian packaging

Change-Id: Ifedb26186ae7c167172398f1c3d1536c48a37350
changes/77/1777/10
Victor Seva 10 years ago
parent 07986a3e73
commit 1eef581123

@ -29,18 +29,9 @@ test: venv_test
./manage.py jenkins --settings="repoapi.settings.dev"
deploy: venv_prod
mkdir -p ./venv_prod/etc/uwsgi/vassals/
[ -L ./venv_prod/etc/uwsgi/vassals/repoapi_uwsgi.ini ] || \
ln -s $(shell pwd)/repoapi/repoapi_uwsgi.ini \
./venv_prod/etc/uwsgi/vassals/
touch ./venv_prod/etc/uwsgi/vassals/repoapi_uwsgi.ini
chown jenkins:www-data -R ./venv_prod/etc/uwsgi
source ./venv_prod/bin/activate && \
./manage.py collectstatic --noinput --settings="repoapi.settings.prod"
chown jenkins:www-data -R ./static_media/ && chmod 660 -R ./static_media/
touch /var/log/uwsgi-repoapi.log && \
chown jenkins:www-data /var/log/uwsgi-repoapi.log && \
chmod 664 /var/log/uwsgi-repoapi.log
chown www-data:www-data -R ./static_media/
###################################
@ -48,17 +39,11 @@ run_dev: venv_dev
source ./venv_dev/bin/activate && \
./manage.py runserver_plus --settings="repoapi.settings.dev"
run: deploy
mkdir -p ./venv_prod/run
chown jenkins:www-data ./venv_prod/run && chmod 770 ./venv_prod/run
source ./venv_prod/bin/activate && \
uwsgi --emperor ./venv_prod/etc/uwsgi/vassals/ \
--uid www-data --gid www-data
###################################
# get rid of test files
clean:
find . -type f -name '*.pyc' -exec rm {} \;
rm -rf reports install.log
# also get rid of virtual environments

5
debian/changelog vendored

@ -0,0 +1,5 @@
repoapi (0.1.0) unstable; urgency=low
* Initial Release.
-- Victor Seva <vseva@sipwise.com> Wed, 29 Apr 2015 12:57:17 +0200

1
debian/compat vendored

@ -0,0 +1 @@
9

19
debian/control vendored

@ -0,0 +1,19 @@
Source: repoapi
Priority: extra
Maintainer: Sipwise Development Team <support@sipwise.com>
Build-Depends: debhelper (>= 8~), python-virtualenv, python-dev
Standards-Version: 3.9.6
Section: python
Homepage: http://sipwise.com/
Package: repoapi
Section: python
Architecture: all
Depends: make,
uwsgi-plugin-python,
python,
python-virtualenv,
sqlite3,
${misc:Depends}
Description: REST API webapp
This package provides repoapi webapp.

28
debian/copyright vendored

@ -0,0 +1,28 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: repoapi
Source: git://git.mgm.sipwise.com/repoapi
Files: *
Copyright: 2015 Sipwise GmbH, Austria
License: GPL-3.0+
Files: debian/*
Copyright: 2015 SipWise Team <development@sipwise.com>
License: GPL-3.0+
License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".

3
debian/dirs vendored

@ -0,0 +1,3 @@
/usr/share/repoapi
/etc/uwsgi/apps-available
/var/lib/repoapi

5
debian/install vendored

@ -0,0 +1,5 @@
Makefile usr/share/repoapi
manage.py usr/share/repoapi
repoapi usr/share/repoapi
requirements usr/share/repoapi
static_media usr/share/repoapi

1
debian/links vendored

@ -0,0 +1 @@
/usr/share/repoapi/repoapi/repoapi_uwsgi.ini /etc/uwsgi/apps-available/repoapi.ini

25
debian/rules vendored

@ -0,0 +1,25 @@
#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
%:
dh $@
override_dh_auto_test:
override_dh_auto_install:
echo "fakesecretkey" > .secret_key
make deploy
make clean
override_dh_fixperms:
dh_fixperms
chmod 4750 debian/repoapi/var/lib/repoapi
chown www-data:www-data debian/repoapi/var/lib/repoapi

@ -0,0 +1 @@
3.0 (native)

@ -2,22 +2,25 @@
# Django-related settings
# the base directory (full path)
chdir = /srv/repoapi
chdir = /usr/share/repoapi
# Django's wsgi file
module = repoapi.wsgi
module = repoapi.wsgi:application
# the virtualenv (full path)
home = /srv/repoapi/venv_prod
home = /usr/share/repoapi/venv_prod
# django setting
env = DJANGO_SETTINGS_MODULE=repoapi.settings.prod
# This is defined by default on uwsgi
# process-related settings
# master
master = true
#master = true
# maximum number of worker processes
processes = 5
#processes = 5
# the socket (use the full path to be safe
socket = /srv/repoapi/venv_prod/run/repoapi.sock
#socket = /usr/share/repoapi/venv_prod/run/repoapi.sock
# ... with appropriate permissions - may be needed
# chmod-socket = 664
# clear environment on exit
vacuum = true
logto = /var/log/uwsgi-repoapi.log
env = DJANGO_SETTINGS_MODULE=repoapi.settings.prod
#vacuum = true
#logto = /var/log/uwsgi-repoapi.log

@ -16,7 +16,7 @@
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
# Quick-start development settings - unsuitable for production

@ -16,15 +16,18 @@
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
BASE_DIR = '/srv/repoapi'
BASE_DIR = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
VAR_DIR = '/var/lib/repoapi'
if not os.path.exists(VAR_DIR):
VAR_DIR = BASE_DIR
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
# read it from external file
SECRET_KEY = open(os.path.join(BASE_DIR, '.secret_key')).read().strip()
SECRET_KEY = open(os.path.join(VAR_DIR, '.secret_key')).read().strip()
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
@ -89,7 +92,7 @@ WSGI_APPLICATION = 'repoapi.wsgi.application'
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
'NAME': os.path.join(VAR_DIR, 'db.sqlite3'),
}
}

@ -25,6 +25,6 @@ import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "repoapi.settings")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "repoapi.settings.prod")
application = get_wsgi_application()

@ -6,3 +6,5 @@ djangorestframework
django-rest-swagger
markdown
django-filter
six
webassets

@ -1,2 +1 @@
-r common.txt
uwsgi

@ -2,6 +2,5 @@
django-nose
git+https://github.com/linuxmaniac/django-jenkins.git@vseva/nose#egg=django-jenkins
flake8
six
pylint
coverage

Loading…
Cancel
Save