diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | .gitlab-ci.yml | 2 | ||||
-rw-r--r-- | debian/changelog | 395 | ||||
-rw-r--r-- | debian/control | 17 | ||||
-rw-r--r-- | debian/python-django-ishtar.install | 2 | ||||
-rw-r--r-- | debian/python-django-ishtar.postinst | 70 | ||||
-rwxr-xr-x | debian/rules | 20 | ||||
-rw-r--r-- | django-simple-history/debian/changelog | 5 | ||||
-rw-r--r-- | django-simple-history/debian/compat | 1 | ||||
-rw-r--r-- | django-simple-history/debian/control | 17 | ||||
-rw-r--r-- | django-simple-history/debian/copyright | 42 | ||||
-rwxr-xr-x | django-simple-history/debian/rules | 4 | ||||
-rw-r--r-- | example_project/settings.py | 2 | ||||
-rw-r--r-- | install/local_settings.py.sample | 2 | ||||
-rw-r--r-- | install/nginx.conf.template | 6 | ||||
-rw-r--r-- | install/uwsgi.ini.template | 2 | ||||
-rwxr-xr-x | ishtar-prepare-instance | 193 |
17 files changed, 769 insertions, 12 deletions
diff --git a/.gitignore b/.gitignore index bfc61f6ac..a65aef6c1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,6 @@ *.pyc *.mo *~ -django-simple-history/* django-formwizard/* ishtar-docs ishtar-logo diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 14f80da21..23ff230cf 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -67,7 +67,7 @@ debian: - wget -O - http://deb.iggdrasil.net/contact@iggdrasil.net.gpg.key | apt-key add - - apt-get update - apt-get install -q -y --force-yes python-django-ishtar locales-all - - INSTANCE=my_ishtar URL=localhost ishtar-prepare-instance + - INSTANCE=my_ishtar URL=localhost DB_HOST=iggdrasil-postgis-1.5 DB_PASSWORD=gis DB_NAME=gis ishtar-prepare-instance - dpkg -i python-django-ishtar_*.deb services: - iggdrasil/postgis-1.5 diff --git a/debian/changelog b/debian/changelog index 385a7355c..41b8f5b88 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,398 @@ +python-django-ishtar (0.99.26) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Wed, 26 Jul 2017 15:06:49 +0200 + +python-django-ishtar (0.99.25) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 20 Jul 2017 17:46:54 +0200 + +python-django-ishtar (0.99.24) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Wed, 12 Jul 2017 12:52:10 +0200 + +python-django-ishtar (0.99.23) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 11 Jul 2017 14:50:59 +0200 + +python-django-ishtar (0.99.22) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 30 Jun 2017 17:01:31 +0200 + +python-django-ishtar (0.99.21) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Wed, 14 Jun 2017 00:13:19 +0200 + +python-django-ishtar (0.99.20) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 01 Jun 2017 20:28:48 +0200 + +python-django-ishtar (0.99.19) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 16 May 2017 12:30:51 +0200 + +python-django-ishtar (0.99.18) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + * ishtar-prepare-instance: change media owner + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 11 Apr 2017 18:58:55 +0200 + +python-django-ishtar (0.99.17) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 07 Apr 2017 12:22:42 +0200 + +python-django-ishtar (0.99.16.1) UNRELEASED; urgency=low + + * Fix bad migration name + + -- Étienne Loks <etienne.loks@iggdrasil.net> Wed, 22 Mar 2017 00:27:27 +0100 + +python-django-ishtar (0.99.16) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Wed, 22 Mar 2017 00:01:26 +0100 + +python-django-ishtar (0.99.15) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 09 Mar 2017 23:38:03 +0100 + +python-django-ishtar (0.99.14) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 06 Mar 2017 17:02:18 +0100 + +python-django-ishtar (0.99.13.1) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 20 Feb 2017 13:17:30 +0100 + +python-django-ishtar (0.99.13) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 17 Feb 2017 21:29:18 +0100 + +python-django-ishtar (0.99.12.2) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 10 Feb 2017 09:21:15 +0100 + +python-django-ishtar (0.99.12.1) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 10 Feb 2017 09:03:52 +0100 + +python-django-ishtar (0.99.12) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 10 Feb 2017 00:50:58 +0100 + +python-django-ishtar (0.99.11) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 06 Feb 2017 20:11:30 +0100 + +python-django-ishtar (0.99.10) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sat, 04 Feb 2017 18:19:19 +0100 + +python-django-ishtar (0.99.9) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 3 Feb 2017 16:54:42 +0200 + +python-django-ishtar (0.99.8) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + * Suffix displayed version in the footer with "deb" + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 2 Feb 2017 17:42:42 +0200 + +python-django-ishtar (0.99.7.2) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 30 Jan 2017 15:59:42 +0200 + +python-django-ishtar (0.99.7.1) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 30 Jan 2017 15:15:42 +0200 + +python-django-ishtar (0.99.7) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 30 Jan 2017 14:06:42 +0200 + +python-django-ishtar (0.99.6) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sun, 29 Jan 2017 17:54:42 +0200 + +python-django-ishtar (0.99.5) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 24 Jan 2017 19:33:42 +0200 + +python-django-ishtar (0.99.4) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 24 Jan 2017 11:20:42 +0200 + +python-django-ishtar (0.99.3) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 20 Jan 2017 20:09:42 +0200 + +python-django-ishtar (0.99.2) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 12 Jan 2017 22:44:42 +0200 + +python-django-ishtar (0.99-1-1) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Wed, 11 Jan 2017 17:11:42 +0200 + +python-django-ishtar (0.99-1) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 10 Jan 2017 02:31:42 +0200 + +python-django-ishtar (0.99-0) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 10 Jan 2017 01:19:42 +0200 + +python-django-ishtar (0.98-10) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 3 Nov 2016 15:55:42 +0200 + +python-django-ishtar (0.98-9) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sun, 23 Oct 2016 18:12:42 +0200 + +python-django-ishtar (0.98-8) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sat, 22 Oct 2016 13:52:42 +0200 + +python-django-ishtar (0.98-7) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 17 Oct 2016 19:28:42 +0200 + +python-django-ishtar (0.98-6) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 11 Oct 2016 19:05:42 +0200 + +python-django-ishtar (0.98-5) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 24 Sep 2016 16:22:42 +0200 + +python-django-ishtar (0.98-4) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 22 Sep 2016 10:53:42 +0200 + +python-django-ishtar (0.98-3) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 15 Sep 2016 17:44:42 +0200 + +python-django-ishtar (0.98-2) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 13 Sep 2016 12:36:42 +0200 + +python-django-ishtar (0.98-1) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sun, 11 Sep 2016 23:42:42 +0200 + +python-django-ishtar (0.98-0) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sun, 11 Sep 2016 11:43:42 +0200 + +python-django-ishtar (0.97-8) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 08 Sep 2016 10:10:42 +0200 + +python-django-ishtar (0.97-7) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 06 Sep 2016 16:12:42 +0200 + +python-django-ishtar (0.97-6) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 05 Sep 2016 20:48:42 +0200 + +python-django-ishtar (0.97-5) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 05 Sep 2016 20:14:42 +0200 + +python-django-ishtar (0.97-4) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 02 Sep 2016 10:45:42 +0200 + +python-django-ishtar (0.97-3) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Mon, 29 Aug 2016 17:50:42 +0200 + +python-django-ishtar (0.97-2) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + * ishtar-prepare-instance: collectstatic and compilemessages after + local_settings copy + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 23 Aug 2016 14:13:42 +0200 + +python-django-ishtar (0.97-1) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + * ishtar-prepare-instance: fix bad link creation of settings.py + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 24 Aug 2016 12:56:42 +0200 + +python-django-ishtar (0.97-0) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.md. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 23 Aug 2016 11:56:42 +0200 + +python-django-ishtar (0.96-3) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.txt. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 19 July 2016 11:50:00 +0200 + +python-django-ishtar (0.96-2) UNRELEASED; urgency=low + + * Upstream: cf CHANGES.txt. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sun, 17 July 2016 23:23:00 +0200 + +python-django-ishtar (0.96-1) UNRELEASED; urgency=low + + * Add media/upload, media/imported directory with corrected permissions + * Symbolic link of settings.py to example_project + * Upstream: cf CHANGES.txt. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Sat, 15 July 2016 19:27:00 +0200 + +python-django-ishtar (0.96-0) UNRELEASED; urgency=low + + * Debian installer: fix DB_PORT + * Debian installer: fix fixtures installation + * Upstream: cf CHANGES.txt. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Thu, 14 July 2016 19:22:00 +0200 + +python-django-ishtar (0.95-2) UNRELEASED; urgency=low + + * Upstream improvements - cf CHANGES.txt. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 09 Jun 2016 12:12:00 +0200 + +python-django-ishtar (0.95-1) UNRELEASED; urgency=low + + * Upstream improvements - cf CHANGES.txt. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 08 Jun 2016 18:43:29 +0200 + +python-django-ishtar (0.94-2) UNRELEASED; urgency=low + + * Fix a bad migration script. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 03 Jun 2016 22:59:29 +0200 + +python-django-ishtar (0.94-1) UNRELEASED; urgency=low + + * Upstream improvments - cf CHANGELOG.txt. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Fri, 03 Jun 2016 22:27:29 +0200 + +python-django-ishtar (0.93-1) UNRELEASED; urgency=low + + [ Étienne Loks ] + * Upstream improvments. + + [ Cyril Brulebois ] + * Keep track of created instances in the INSTANCES file under + /var/lib/python-django-ishtar and make postinst script loop over + it to update instances, and restart uwsgi/nginx if appropriate. + * Fix ishtar-prepare-instance: compilemessages wasn't called in + ishtar_common/, only in archaeological_*/. + + -- Étienne Loks <etienne.loks@iggdrasil.net> Tue, 19 Apr 2016 22:39:29 +0200 + python-django-ishtar (0.9-1) UNRELEASED; urgency=low * Initial release. diff --git a/debian/control b/debian/control index eaa0d9fc8..fb4ce26e5 100644 --- a/debian/control +++ b/debian/control @@ -24,7 +24,22 @@ Depends: ${misc:Depends}, python-tidylib, python-lxml, python-html5lib, - python-memcache + python-memcache, + python-oook-replace, + python-django-extra-views, + python-django-simple-history, + python-unicodecsv, + python-markdown, +# DB + postgresql-9.1, + postgresql-9.1-postgis, +# Web: + nginx, + uwsgi, + uwsgi-plugin-python, +# Extra: + apg, + gettext, Recommends: javascript-common, libjs-jquery, libjs-jquery-ui, diff --git a/debian/python-django-ishtar.install b/debian/python-django-ishtar.install new file mode 100644 index 000000000..14d90d1e6 --- /dev/null +++ b/debian/python-django-ishtar.install @@ -0,0 +1,2 @@ +/var/lib/python-django-ishtar +ishtar-prepare-instance usr/sbin diff --git a/debian/python-django-ishtar.postinst b/debian/python-django-ishtar.postinst new file mode 100644 index 000000000..5efd25548 --- /dev/null +++ b/debian/python-django-ishtar.postinst @@ -0,0 +1,70 @@ +#!/bin/sh + +set -e +set -x + +DATA_DIR=/var/lib/python-django-ishtar +INSTANCES_FILE=$DATA_DIR/INSTANCES + +case "$1" in + configure) + instances="$( (cat $INSTANCES_FILE 2>/dev/null || true) | xargs )" + if [ -n "$instances" ]; then + echo "updading instances found in $INSTANCES_FILE: $instances" + for instance in $instances; do + # The upgrade procedure below was built from the "update" + # target and its dependencies in the upstream Makefile: + echo "updating $instance" + cd $DATA_DIR/$instance + + # from "syncdb" target: + python manage.py syncdb --noinput + python manage.py migrate + + # from "compilemessages" target: + # + # NOTE: Instead of hardcoding an "apps" variable here, let's + # look at candidates with find, and check whether each of + # them indeed contains PO files as a second check: + maybe_localized=$(cd $DATA_DIR; find -maxdepth 2 -name 'locale') + for candidate in $maybe_localized; do + if find $DATA_DIR/$candidate -name '*.po' >/dev/null 2>&1; then + # Really looks like a valid app, let's strip the last + # directory, cd into it, and compile messages using + # the instance's manage.py script: + app=${candidate%%/locale} + (cd $DATA_DIR/$app; python $DATA_DIR/$instance/manage.py compilemessages) + fi + done + # XXX: Doing this only once is likely sufficient, so + # we could remember having performed that update while + # taking care of the first instance, to avoid + # extraneous reruns? + + # from "collectstatic" target: + python manage.py collectstatic --noinput + + echo "updating $instance: OK" + done + echo "updating all instances: OK" + + # the assumption is that nginx and uwsgi were configured + # through ishtar-prepare-instance, so let's restart them + # unconditionally: + invoke-rc.d uwsgi restart + invoke-rc.d nginx restart + echo "restarting uwsgi and nginx: OK" + else + echo "found no instances to upgrade in $INSTANCES_FILE" + fi + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac diff --git a/debian/rules b/debian/rules index dd12cc51f..903fa0919 100755 --- a/debian/rules +++ b/debian/rules @@ -10,9 +10,23 @@ PYTHON2=$(shell pyversions -vr) export http_proxy = http://127.0.9.1:9 %: - dh $@ --with python2 + dh $@ + +override_dh_auto_build: + echo "Building does nothing" + +override_dh_auto_configure: + echo "Configuring does nothing" + +override_dh_auto_install: + git ls-files \ + | grep -v ^debian \ + | grep -v ^django-simple-history \ + | grep -v ^doc \ + > install.list + mkdir -p debian/tmp/var/lib/python-django-ishtar + rsync -av --files-from install.list . debian/tmp/var/lib/python-django-ishtar override_dh_auto_clean: dh_auto_clean - rm -rf build - rm -rf *.egg-info + rm -f install.list diff --git a/django-simple-history/debian/changelog b/django-simple-history/debian/changelog new file mode 100644 index 000000000..719616a5f --- /dev/null +++ b/django-simple-history/debian/changelog @@ -0,0 +1,5 @@ +python-django-simple-history (0~0) wheezy; urgency=medium + + * Initial release. + + -- Cyril Brulebois <cyril@debamax.com> Wed, 06 Apr 2016 22:44:50 +0200 diff --git a/django-simple-history/debian/compat b/django-simple-history/debian/compat new file mode 100644 index 000000000..45a4fb75d --- /dev/null +++ b/django-simple-history/debian/compat @@ -0,0 +1 @@ +8 diff --git a/django-simple-history/debian/control b/django-simple-history/debian/control new file mode 100644 index 000000000..44608d14a --- /dev/null +++ b/django-simple-history/debian/control @@ -0,0 +1,17 @@ +Source: python-django-simple-history +Section: python +Priority: optional +Maintainer: Cyril Brulebois <cyril@debamax.com> +Build-Depends: debhelper (>= 9.0.0), + python | python-all | python-dev | python-all-dev, + python-setuptools +Standards-Version: 3.9.3 +Homepage: http://pypi.python.org/pypi/ishtar + +Package: python-django-simple-history +Architecture: all +Depends: ${misc:Depends}, + ${python:Depends}, + python-django (>= 1.4), + python-django (<< 1.5), +Description: TBD diff --git a/django-simple-history/debian/copyright b/django-simple-history/debian/copyright new file mode 100644 index 000000000..f5ec3b221 --- /dev/null +++ b/django-simple-history/debian/copyright @@ -0,0 +1,42 @@ +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: ishtar +Source: XXX + +Files: * +Copyright: 2013 Étienne Loks <etienne.loks@peacefrogs.net> +License: AGPL-3.0+ + +Files: debian/* +Copyright: 2016 Cyril Brulebois <cyril@debamax.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". + +License: AGPL-3.0 + This program is free software: you can use, redistribute, and/or modify + this code under the terms of the GNU Affero General Public License + version 3. + . + This program 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 Affero General Public License for more details. + . + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + diff --git a/django-simple-history/debian/rules b/django-simple-history/debian/rules new file mode 100755 index 000000000..2d33f6ac8 --- /dev/null +++ b/django-simple-history/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ diff --git a/example_project/settings.py b/example_project/settings.py index c7880d8c8..1d29106c7 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -29,7 +29,7 @@ STATIC_URL = '/static/' STATIC_ROOT = ROOT_PATH + 'static/' BASE_URL = "/" URL_PATH = "" -EXTRA_VERSION = 'git' +EXTRA_VERSION = 'deb' ODT_TEMPLATE = ROOT_PATH + "../ishtar_common/static/template.odt" diff --git a/install/local_settings.py.sample b/install/local_settings.py.sample index 459828c00..857249613 100644 --- a/install/local_settings.py.sample +++ b/install/local_settings.py.sample @@ -15,7 +15,7 @@ LOGFILE = "/var/log/django/ishtar-#APP_NAME#.log" MEDIA_ROOT = "#APP_DIR#/media/" -ODT_TEMPLATE = "#INSTALL_PATH#/ishtar/ishtar_common/static/template.odt" +ODT_TEMPLATE = "#INSTALL_PATH#/ishtar_common/static/template.odt" ADMINS = ( # ('Your Name', 'your_email@domain.com'), diff --git a/install/nginx.conf.template b/install/nginx.conf.template index 673135c0e..9711ac261 100644 --- a/install/nginx.conf.template +++ b/install/nginx.conf.template @@ -1,18 +1,18 @@ server { listen #NGINX_PORT#; server_name #URL#; - root #INSTALL_PREFIX#/#DB_NAME#/ishtar/; + root #INSTALL_PREFIX#/#APP_NAME#/; access_log /var/log/django/#APP_NAME#-access.log; error_log /var/log/django/#APP_NAME#-error.log; client_max_body_size 20M; location /static-#DATE#/ { # STATIC_URL - alias #INSTALL_PREFIX#/#DB_NAME#/ishtar/#APP_NAME#/static/; # STATIC_ROOT + alias #INSTALL_PREFIX#/#APP_NAME#/static/; # STATIC_ROOT expires 30d; } location /media/ { # MEDIA_URL - alias #INSTALL_PREFIX#/#DB_NAME#/ishtar/#APP_NAME#/media/; # MEDIA_ROOT + alias #INSTALL_PREFIX#/#APP_NAME#/media/; # MEDIA_ROOT expires 30d; } diff --git a/install/uwsgi.ini.template b/install/uwsgi.ini.template index dd8f00480..51a4c5b7f 100644 --- a/install/uwsgi.ini.template +++ b/install/uwsgi.ini.template @@ -2,7 +2,7 @@ # variables projectname = #APP_NAME# projectdomain = #URL# -base = #INSTALL_PREFIX#/#DB_NAME#/ishtar/ +base = #INSTALL_PREFIX# # config plugins = python diff --git a/ishtar-prepare-instance b/ishtar-prepare-instance new file mode 100755 index 000000000..f91dbd9db --- /dev/null +++ b/ishtar-prepare-instance @@ -0,0 +1,193 @@ +#!/bin/sh +# +# Stripped-down version of the install.sh script, only dealing with +# customizing files shipped through a Debian package which also pulls +# a bunch of dependencies. +set -e +set -u + +# Instance then project names: +INSTANCE=${INSTANCE-iggdrasil} +PROJECT=${PROJECT-$INSTANCE} +URL=${URL-localhost} +DEST=/var/lib/python-django-ishtar +INSTANCES_FILE=$DEST/INSTANCES + +echo "*** Preparing ishtar (instance: $INSTANCE, project: $PROJECT) under $DEST ***" + +export LANG=fr_FR.UTF-8 +if [ "$(locale 2>&1 >/dev/null|wc -l)" != 0 ]; then + echo "Unable to set LANG=$LANG properly" + echo "Try: 'dpkg-reconfigure locales' or install the 'locales-all' package" + exit 1 +fi + +# XXX: Should probably ship those from the package, and make them +# either ishtar or python-django-ishtar, or django/ishtar +# alternatively: +mkdir -p /var/log/django +chown root:www-data /var/log/django +touch "/var/log/django/ishtar-$INSTANCE.log" +chown root:www-data "/var/log/django/ishtar-$INSTANCE.log" +chmod g+w "/var/log/django/ishtar-$INSTANCE.log" + + +# Duplicate example_project into our instance: +cd $DEST +if [ -d "$INSTANCE" ]; then + echo "Sorry, $INSTANCE already exists, not going further" + exit 1 +fi +cp -ra example_project $INSTANCE + +rm $INSTANCE/settings.py +ln -s $DEST/example_project/settings.py $DEST/$INSTANCE/settings.py + +# Preparing DB: +PG_VERSION=9.1 +DB_HOST=${DB_HOST-127.0.0.1} +DB_PORT=${DB_PORT-5432} +DB_PASSWORD=${DB_PASSWORD-''} +DB_NAME="ishtar-$INSTANCE" + +# Generate a password on the fly if none was specified: +if [ -z "$DB_PASSWORD" ]; then + DB_PASSWORD=$(apg -a 0 -M ncl -n 1 -x 10 -m 10) +fi + +export PG_VERSION DB_HOST DB_PORT DB_PASSWORD DB_NAME PROJECT +su postgres <<'EOF' + echo "Checking template_postgis" + if ! psql -l | grep -qs template_postgis; then + echo " - not present, creating" + createdb template_postgis + psql -q -d template_postgis -f /usr/share/postgresql/$PG_VERSION/contrib/postgis-1.5/postgis.sql + psql -q -d template_postgis -f /usr/share/postgresql/$PG_VERSION/contrib/postgis-1.5/spatial_ref_sys.sql + else + echo " - already present" + fi + + echo "Checking $DB_NAME" + if ! psql -l | grep -qs "$DB_NAME"; then + echo " - not present, creating" + createuser --echo --adduser --createdb --encrypted $DB_NAME + psql --command "ALTER USER \""$DB_NAME"\" with password '"$DB_PASSWORD"';" + createdb -T template_postgis --echo --owner $DB_NAME --encoding UNICODE $DB_NAME "$PROJECT" + else + echo " - already present" + fi +EOF + + +# Permissions: +mkdir -p -m 755 "$INSTANCE/media" +mkdir -p -m 755 "$INSTANCE/media/imported" +mkdir -p -m 755 "$INSTANCE/media/upload" +chown -R www-data:www-data "$INSTANCE/media" + +### LOCAL SETTINGS + +# Set some variables to avoid changing sed calls too much compared to +# the initial install/install.sh script: +INSTALL_PATH=$DEST +INSTALL_PREFIX=$DEST +APP_DIR="$DEST/$INSTANCE" +DATE=`date +%F` +SECRET_KEY=$(apg -a 0 -M ncl -n 1 -x 10 -m 40) + +# Declare these in advance, at least the port is needed: +UWSGI_PORT=${UWSGI_PORT-8891} +UWSGI_AVAILABLE_PATH='/etc/uwsgi/apps-available' +UWSGI_ENABLE_PATH='/etc/uwsgi/apps-enabled' + +sed -s "s|#APP_NAME#|$INSTANCE|g;\ + s|#INSTALL_PATH#|$INSTALL_PATH|g;\ + s|#DATE#|$DATE|g;\ + s|#PROJECT_NAME#|$PROJECT|g;\ + s|#DB_HOST#|$DB_HOST|g;\ + s|#DB_NAME#|$DB_NAME|g;\ + s|#DB_PORT#|$DB_PORT|g;\ + s|#APP_DIR#|$APP_DIR|g;\ + s|#SECRET_KEY#|$SECRET_KEY|g;\ + s|#DB_PASSWORD#|$DB_PASSWORD|g;\ + s|#UWSGI_PORT#|$UWSGI_PORT|g;" \ + "install/local_settings.py.sample" > \ + "$INSTANCE/local_settings.py" + +# Collect static data: +cd $INSTANCE +./manage.py collectstatic --noinput +cd - + +# Only language available: +LOCALE=fr +for d in archaeological_* ishtar_common; do + cd $d + ../$INSTANCE/manage.py compilemessages -l $LOCALE + cd - +done + +### DB feeding +cd $INSTANCE +./manage.py syncdb --noinput +./manage.py migrate +./manage.py flush --noinput + +FIXTURES="$DEST/fixtures/initial_data-auth-fr.json $DEST/ishtar_common/fixtures/initial_data-fr.json $DEST/ishtar_common/fixtures/initial_importtypes-fr.json $DEST/archaeological_operations/fixtures/initial_data-fr.json $DEST/archaeological_context_records/fixtures/initial_data-fr.json $DEST/archaeological_files/fixtures/initial_data-fr.json $DEST/archaeological_finds/fixtures/initial_data-fr.json $DEST/archaeological_warehouse/fixtures/initial_data-fr.json" +for data in $FIXTURES; do + echo $data; + ./manage.py loaddata $data; +done + +./manage.py createsuperuser +./manage.py migrate --fake +cd - + +echo "*** DB all done ***" + + +### UWSGI + +sed -s "s|#APP_NAME#|$INSTANCE|g;\ + s|#DB_NAME#|$DB_NAME|g;\ + s|#INSTALL_PREFIX#|$INSTALL_PREFIX|g;\ + s|#URL#|$URL|g;\ + s|#UWSGI_PORT#|$UWSGI_PORT|g;" \ + "install/uwsgi.ini.template" > \ + "$INSTANCE/uwsgi.ini" + +# XXX: Generation of django.wsgi was entirely dropped. + +# XXX: Using -f might be a bit too aggressive +ln -sf "$DEST/$INSTANCE/uwsgi.ini" \ + "$UWSGI_AVAILABLE_PATH/ishtar-$INSTANCE.ini" +ln -sf "$UWSGI_AVAILABLE_PATH/ishtar-$INSTANCE.ini" \ + "$UWSGI_ENABLE_PATH/ishtar-$INSTANCE.ini" + + +### NGINX + +NGINX_PORT=${NGINX_PORT-80} +NGINX_AVAILABLE_PATH='/etc/nginx/sites-available' +NGINX_ENABLE_PATH='/etc/nginx/sites-enabled' + +sed -s "s|#APP_NAME#|$INSTANCE|g;\ + s|#UWSGI_PORT#|$UWSGI_PORT|g;\ + s|#DB_NAME#|$DB_NAME|g;\ + s|#DATE#|$DATE|g;\ + s|#NGINX_PORT#|$NGINX_PORT|g;\ + s|#INSTALL_PREFIX#|$INSTALL_PREFIX|g;\ + s|#URL#|$URL|g;" \ + "install/nginx.conf.template" > \ + "$INSTANCE/nginx.conf" + +ln -sf "$DEST/$INSTANCE/nginx.conf" \ + "$NGINX_AVAILABLE_PATH/ishtar-$INSTANCE.conf" +ln -sf "$NGINX_AVAILABLE_PATH/ishtar-$INSTANCE.conf" \ + "$NGINX_ENABLE_PATH/ishtar-$INSTANCE.conf" + +echo "*** uwsgi and nginx configured, restart them and you're done ***" +printf "\n /etc/init.d/uwsgi restart\n /etc/init.d/nginx restart\n\n Enjoy ishtar!\n" + +# Register instance: +echo "$INSTANCE" >> $INSTANCES_FILE |