aboutsummaryrefslogtreecommitdiff
path: root/rpkid/portal-gui
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/portal-gui')
-rw-r--r--rpkid/portal-gui/Makefile.in14
-rwxr-xr-xrpkid/portal-gui/scripts/dumpdata.py43
-rw-r--r--rpkid/portal-gui/settings.py.in30
3 files changed, 66 insertions, 21 deletions
diff --git a/rpkid/portal-gui/Makefile.in b/rpkid/portal-gui/Makefile.in
index fa4e1e46..4c3882eb 100644
--- a/rpkid/portal-gui/Makefile.in
+++ b/rpkid/portal-gui/Makefile.in
@@ -17,16 +17,11 @@ libexecdir=@libexecdir@
sysconfdir=@sysconfdir@
WEBUSER=@WEBUSER@
-DJANGO_ADMIN=@DJANGO_ADMIN@
-PYTHON=@PYTHON@
-DJANGO_DIR=@DJANGO_DIR@
INSTALL = @INSTALL@
CONFDIR=${DESTDIR}$(localstatedir)/rpki/conf
-DATABASE_PATH=${DESTDIR}$(localstatedir)/rpki/gui.db
INSTDIR=${DESTDIR}$(datarootdir)/rpki/gui
-STATIC_DIR=${INSTDIR}/static
PYTHONPATH=${DESTDIR}${sysconfdir}/rpki
# automatically built sources
@@ -42,9 +37,7 @@ distclean: clean
rm -f Makefile
edit = sed \
- -e 's|@DJANGO_DIR[@]|$(DJANGO_DIR)|g' \
- -e 's|@INSTDIR[@]|$(INSTDIR)|g' \
- -e 's|@STATIC_DIR[@]|$(STATIC_DIR)|g'
+ -e 's|@INSTDIR[@]|$(INSTDIR)|g'
apache/rpki.conf: $(srcdir)/apache/rpki.conf.in Makefile
$(edit) $@.in > $@
@@ -52,8 +45,6 @@ apache/rpki.conf: $(srcdir)/apache/rpki.conf.in Makefile
.PHONY: install-perms install-data install
install-perms:
- chown $(WEBUSER) `dirname $(DATABASE_PATH)`
- chown $(WEBUSER) $(DATABASE_PATH)
mkdir -p $(CONFDIR)
chown -R $(WEBUSER) $(CONFDIR)
@@ -63,7 +54,6 @@ install-apache:
${INSTALL} -m 644 apache/rpki.wsgi $(INSTDIR)/apache
install-data: $(BUILD) install-apache
- mkdir -p `dirname $(DATABASE_PATH)`
mkdir -p ${PYTHONPATH}
# FIXME should eventually try to merge new settings?
@if [ ! -f ${PYTHONPATH}/settings.py ]; then \
@@ -72,8 +62,6 @@ install-data: $(BUILD) install-apache
echo "${PYTHONPATH}/settings.py already exists, installing settings.py as ${PYTHONPATH}/settings.py.new"; \
${INSTALL} -m 644 settings.py ${PYTHONPATH}/settings.py.new; \
fi
- $(DJANGO_ADMIN) syncdb --pythonpath ${PYTHONPATH} --settings settings
- #$(DJANGO_ADMIN) collectstatic --noinput --pythonpath ${PYTHONPATH} --settings settings
if [ ! -f $(INSTDIR)/rpki.conf.template ]; then ${INSTALL} -m 644 ../examples/rpki.conf $(INSTDIR)/rpki.conf.template; fi
install: install-data install-perms
diff --git a/rpkid/portal-gui/scripts/dumpdata.py b/rpkid/portal-gui/scripts/dumpdata.py
new file mode 100755
index 00000000..dcf23666
--- /dev/null
+++ b/rpkid/portal-gui/scripts/dumpdata.py
@@ -0,0 +1,43 @@
+#!/usr/bin/env python
+# $Id$
+#
+# Copyright (C) 2012 SPARTA, Inc. a Parsons Company
+#
+# Permission to use, copy, modify, and distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND SPARTA DISCLAIMS ALL WARRANTIES WITH
+# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+# AND FITNESS. IN NO EVENT SHALL SPARTA BE LIABLE FOR ANY SPECIAL, DIRECT,
+# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+# PERFORMANCE OF THIS SOFTWARE.
+#
+# This is a helper script which will dump the rpki.gui.app models from
+# the old sqlite3 database, forcing the output order to the primary key in
+# order to avoid forward references for the AddressRange table.
+
+from django.conf import settings
+settings.configure(DEBUG=True,
+ DATABASES={
+ 'default': {
+ 'ENGINE': 'django.db.backends.sqlite3',
+ 'NAME': '/usr/local/var/rpki/gui.db',
+ }
+ })
+
+from django.core import serializers
+import django.db.models
+
+from rpki.gui.app import models
+from django.contrib.auth import models as auth_models
+
+data = []
+for v in (auth_models.User, models.Conf, models.Parent, models.Child, models.AddressRange, models.Asn, models.ResourceCert, models.Roa, models.RoaRequest, models.Ghostbuster):
+ data.extend(list(v.objects.all().order_by('id')))
+
+print serializers.serialize('json', data, use_natural_keys=True)
+
+# vim:sw=4 ts=8 expandtab
diff --git a/rpkid/portal-gui/settings.py.in b/rpkid/portal-gui/settings.py.in
index 2800bc24..baa9197c 100644
--- a/rpkid/portal-gui/settings.py.in
+++ b/rpkid/portal-gui/settings.py.in
@@ -6,13 +6,33 @@
# DO NOT EDIT! This file is automatically generated from
# settings.py.in
+import rpki.config
+
DEBUG = True
TEMPLATE_DEBUG = DEBUG
+# needs to be set prior to the call to rpki.config.parser so it knows
+# where to find the system rpki.conf
+rpki.config.default_dirname = '%(AC_SYSCONFDIR)s'
+
+# load the sql authentication bits from the system rpki.conf
+rpki_config = rpki.config.parser(section='web_portal')
+
DATABASES = {
'default' : {
- 'ENGINE': 'django.db.backends.sqlite3',
- 'NAME' : '%(AC_DATABASE_PATH)s'
+ 'ENGINE' : 'django.db.backends.mysql',
+ 'NAME' : rpki_config.get('sql-database'),
+ 'USER' : rpki_config.get('sql-username'),
+ 'PASSWORD': rpki_config.get('sql-password'),
+
+ # Ensure the default storage engine is InnoDB since we need
+ # foreign key support. The Django documentation suggests
+ # removing this after the syncdb is performed as an optimization,
+ # but there isn't an easy way to do this automatically.
+
+ 'OPTIONS' : {
+ 'init_command': 'SET storage_engine=INNODB'
+ }
}
}
@@ -54,7 +74,6 @@ INSTALLED_APPS = (
'django.contrib.admindocs',
'django.contrib.contenttypes',
'django.contrib.sessions',
-# 'django.contrib.staticfiles',
'rpki.gui.app',
'rpki.gui.cacheview'
)
@@ -67,8 +86,3 @@ TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request"
)
-
-#STATIC_URL = '/static/'
-#STATIC_ROOT = '%(AC_DATAROOTDIR)s/rpki/gui/static'
-#STATICFILES_DIRS = (("admin", "%(AC_DJANGO_DIR)s/contrib/admin/media"),)
-#STATICFILES_FINDERS = ("django.contrib.staticfiles.finders.FileSystemFinder",)