refine packaging one step further
authorThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 27 Nov 2013 09:07:29 +0000 (10:07 +0100)
committerThierry Parmentelat <thierry.parmentelat@inria.fr>
Wed, 27 Nov 2013 09:07:29 +0000 (10:07 +0100)
name generic stuff as unfold instead of myslice
--
db installed in /var/unfold and permissions reviewed - no insane chmod 777 !?!?!
wsgi in /usr/share/unfold/apache/unfold.wsgi
conf in /etc/apache2/sites-available/unfold.conf
— not tested

Makefile
apache/unfold.conf [moved from apache/myslice.conf with 68% similarity]
apache/unfold.wsgi [moved from myslice/wsgi.py with 100% similarity]
debian/unfold.install
debian/unfold.postinst
myslice/settings.py
setup.py

index 473e3d7..e3449bb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -148,7 +148,7 @@ ifeq (,$(MYSLICEBOX))
        @echo "  $(MAKE) MYSLICEBOX=debian04.pl.sophia.inria.fr "$@""
        @exit 1
 else
-       +$(RSYNC) ./apache/myslice.conf $(SSHURL)/$(INSTALLED_APACHE)/
+       +$(RSYNC) ./apache/unfold.conf $(SSHURL)/$(INSTALLED_APACHE)/
        +$(RSYNC) ./apache/unfold-init-ssl.sh $(SSHURL)/$(bindir)/
 endif
 
similarity index 68%
rename from apache/myslice.conf
rename to apache/unfold.conf
index 8ee84d0..61bb49f 100644 (file)
@@ -1,15 +1,11 @@
-# xxx it might be smarter to install wsgi.py in some other location 
-# so we don't have to hard-wire these paths here
-# xxx it might also be helpful to set up a specific log channel for this
-# e.g. in /var/log/myslice.log
 <VirtualHost *:80>
-       WSGIDaemonProcess myslice processes=2 threads=25
-       WSGIProcessGroup myslice
-       CustomLog ${APACHE_LOG_DIR}/myslice-access.log common
-       ErrorLog ${APACHE_LOG_DIR}/myslice-error.log
-        WSGIScriptAlias / /usr/lib/python2.7/dist-packages/myslice/wsgi.py
-        <Directory /usr/share/unfold/myslice>
-        <Files wsgi.py>
+       WSGIDaemonProcess unfold processes=2 threads=25
+       WSGIProcessGroup unfold
+       CustomLog ${APACHE_LOG_DIR}/unfold-access.log common
+       ErrorLog ${APACHE_LOG_DIR}/unfold-error.log
+        WSGIScriptAlias / /usr/share/unfold/apache/unfold.wsgi
+        <Directory /usr/share/unfold/apache/>
+        <Files unfold.wsgi>
         Order deny,allow
         Allow from all
         </Files>
@@ -33,9 +29,9 @@
        WSGIProcessGroup myslice-ssl
        CustomLog ${APACHE_LOG_DIR}/myslice-ssl-access.log common
        ErrorLog ${APACHE_LOG_DIR}/myslice-ssl-error.log
-        WSGIScriptAlias / /usr/lib/python2.7/dist-packages/myslice/wsgi.py
-        <Directory /usr/share/unfold/apache>
-        <Files myslice.wsgi>
+        WSGIScriptAlias / /usr/share/unfold/apache/unfold.wsgi
+        <Directory /usr/share/unfold/apache/>
+        <Files unfold.wsgi>
         Order deny,allow
         Allow from all
         </Files>
similarity index 100%
rename from myslice/wsgi.py
rename to apache/unfold.wsgi
index 5bf0af9..9730d70 100644 (file)
@@ -8,5 +8,7 @@ usr/lib*/python*/dist-packages/myslice
 usr/lib*/python*/dist-packages/sample
 usr/share/unfold/static
 usr/share/unfold/templates
+apache/unfold.wsgi /usr/share/unfold/apache/
+apache/unfold.conf /etc/apache2/sites-available
 manage.py usr/share/unfold/
-apache/myslice.conf /etc/apache2/sites-available
+usr/bin/unfold-init-ssl.sh
index de85dd3..77a479e 100644 (file)
@@ -1,10 +1,11 @@
 #!/bin/bash
 # if this requires a service to be running, add something like this
 # update-rc.d unfold defaults
+[ -d /var/unfold ] || mkdir /var/unfold
+chown -R www-data.www-data /var/unfold
 /usr/share/unfold/manage.py syncdb
 /usr/share/unfold/manage.py migrate
-chmod 777 /usr/share/unfold/myslice.sqlite3
-chmod 777 /usr/share/unfold
+chmod 700 /var/unfold/unfold.sqlite3
 a2dissite default
-a2ensite myslice.conf
+a2ensite unfold.conf
 service apache2 restart
index 4df98e2..c51010a 100644 (file)
@@ -1,4 +1,4 @@
-# Django settings for myslice project.
+# Django settings for unfold project.
 
 import os.path
 
@@ -19,17 +19,20 @@ except:
     import traceback
     traceback.print_exc()
 
-# find out DATAROOT, which is different from ROOT 
+# find out HTTPROOT, which is different from ROOT 
 # when deployed from a package
 # this code is run by collectstatic too, so we cannot
 # assume we have ./static present already
-DATAROOT="/usr/share/unfold"
+HTTPROOT="/usr/share/unfold"
+# the place to store local data, like e.g. the sqlite db
+DATAROOT="/var/unfold"
 # if not there, then we assume it's from a devel tree
-if not os.path.isdir (os.path.join(DATAROOT,"static")):
+if not os.path.isdir (os.path.join(HTTPROOT,"static")):
+    HTTPROOT=ROOT
     DATAROOT=ROOT
 
-if not os.path.isdir(ROOT): raise Exception,"Cannot find ROOT %s for myslice"%ROOT
-if not os.path.isdir(DATAROOT): raise Exception,"Cannot find DATAROOT %s for myslice"%DATAROOT
+if not os.path.isdir(ROOT): raise Exception,"Cannot find ROOT %s for unfold"%ROOT
+if not os.path.isdir(HTTPROOT): raise Exception,"Cannot find HTTPROOT %s for unfold"%HTTPROOT
 
 ####################
 ADMINS = (
@@ -49,7 +52,7 @@ EMAIL_USE_TLS = False
 DATABASES = {
     'default': {
         'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': os.path.join(DATAROOT,'myslice.sqlite3'), # Or path to database file if using sqlite3.
+        'NAME': os.path.join(DATAROOT,'unfold.sqlite3'), # Or path to database file if using sqlite3.
         'USER': '',                      # Not used with sqlite3.
         'PASSWORD': '',                  # Not used with sqlite3.
         'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
@@ -93,7 +96,7 @@ MEDIA_URL = ''
 # Don't put anything in this directory yourself; store your static files
 # in apps' "static/" subdirectories and in STATICFILES_DIRS.
 # Example: "/home/media/media.lawrence.com/static/"
-STATIC_ROOT = os.path.join(DATAROOT,'static')
+STATIC_ROOT = os.path.join(HTTPROOT,'static')
 
 # URL prefix for static files.
 # Example: "http://media.lawrence.com/static/"
@@ -157,13 +160,13 @@ MIDDLEWARE_CLASSES = (
 ROOT_URLCONF = 'myslice.urls'
 
 # Python dotted path to the WSGI application used by Django's runserver.
-WSGI_APPLICATION = 'myslice.wsgi.application'
+WSGI_APPLICATION = 'unfold.wsgi.application'
 
 TEMPLATE_DIRS = (
     # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
     # Always use forward slashes, even on Windows.
     # Don't forget to use absolute paths, not relative paths.
-    os.path.join(DATAROOT,"templates"),
+    os.path.join(HTTPROOT,"templates"),
 )
 
 INSTALLED_APPS = (
index 99b077d..e7ab6a5 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
 #!/usr/bin/python
 #
-# Setup script for myslice
+# Setup script for myslice+unfold
 #
 # Thierry Parmentelat <thierry.parmentelat@inria.fr>
 # INRIA (c) 2013
@@ -21,5 +21,5 @@ setup(packages = packages,
         ( '/usr/share/unfold/static/img', glob ('static/img/*')),
         ( '/usr/share/unfold/static/fonts', glob ('static/fonts/*')),
         ( '/usr/share/unfold/templates', glob ('templates/*')),
-        ( 'apache', [ 'apache/myslice.conf' ]),
+        ( 'apache', [ 'apache/unfold.conf', 'apache/unfold.wsgi' ]),
         ])