]> git.parisson.com Git - teleforma.git/commitdiff
prepare docker composition
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 1 Jul 2016 10:58:49 +0000 (12:58 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Fri, 1 Jul 2016 10:58:49 +0000 (12:58 +0200)
Dockerfile [new file with mode: 0644]
app/__init__.py [new file with mode: 0644]
app/manage.py [new file with mode: 0755]
app/settings.py [new file with mode: 0644]
app/urls.py [new file with mode: 0644]
app/wsgi.py [new file with mode: 0644]
docker-compose.yml [new file with mode: 0644]
etc/nginx.conf [new file with mode: 0644]
requirements-dev.txt [new file with mode: 0644]
requirements-new.txt [new file with mode: 0644]
teleforma/scripts/translate.sh [new file with mode: 0755]

diff --git a/Dockerfile b/Dockerfile
new file mode 100644 (file)
index 0000000..12eb8cd
--- /dev/null
@@ -0,0 +1,31 @@
+# Copyright 2013 Thatcher Peskens
+# Copyright 2014-2015 Guillaume Pellerin
+# Copyright 2014-2015 Thomas Fillon
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+FROM parisson/telemeta:latest
+
+MAINTAINER Guillaume Pellerin <yomguy@parisson.com>
+
+RUN mkdir /srv/app
+RUN mkdir /srv/src
+RUN mkdir /srv/src/app
+
+COPY . /srv/src/app
+WORKDIR /srv/src/app
+RUN pip install -r requirements.txt
+RUN pip install -r requirements-dev.txt --src /srv/src
+WORKDIR /srv/app
+
+EXPOSE 8000
diff --git a/app/__init__.py b/app/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/app/manage.py b/app/manage.py
new file mode 100755 (executable)
index 0000000..c632a8a
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+import os, sys
+
+if __name__ == "__main__":
+    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+
+    from django.core.management import execute_from_command_line
+
+    execute_from_command_line(sys.argv)
diff --git a/app/settings.py b/app/settings.py
new file mode 100644 (file)
index 0000000..6ef8199
--- /dev/null
@@ -0,0 +1,202 @@
+# -*- coding: utf-8 -*-
+# Django settings for sandbox project.
+
+import os
+import sys
+from django.core.urlresolvers import reverse_lazy
+
+sys.dont_write_bytecode = True
+
+DEBUG = True
+TEMPLATE_DEBUG = DEBUG
+
+ADMINS = (
+    ('Guillaume Pellerin', 'webmaster@parisson.com'),
+    ('Lists', 'lists@parisson.com'),
+)
+
+MANAGERS = ADMINS
+
+DATABASES = {
+    'default': {
+        'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME': 'teleforma',                      # Or path to database file if using sqlite3.
+        'USER': 'teleforma',                      # Not used with sqlite3.
+        'PASSWORD': 'HMYsrZLEtYeBrvER',                  # Not used with sqlite3.
+        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
+        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
+    }
+}
+
+# Local time zone for this installation. Choices can be found here:
+# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
+# although not all choices may be available on all operating systems.
+# On Unix systems, a value of None will cause Django to use the same
+# timezone as the operating system.
+# If running in a Windows environment this must be set to the same as your
+# system time zone.
+TIME_ZONE = 'Europe/Paris'
+
+# Language code for this installation. All choices can be found here:
+# http://www.i18nguy.com/unicode/language-identifiers.html
+#LANGUAGE_CODE = 'fr_FR'
+LANGUAGES = [ ('fr', 'French'),
+              ('en', 'English'),
+]
+
+SITE_ID = 1
+
+# If you set this to False, Django will make some optimizations so as not
+# to load the internationalization machinery.
+USE_I18N = True
+
+# If you set this to False, Django will not format dates, numbers and
+# calendars according to the current locale
+USE_L10N = True
+
+# Absolute path to the directory that holds media.
+# Example: "/home/media/media.lawrence.com/"
+MEDIA_ROOT = os.path.join(os.path.dirname(__file__), 'media/')
+
+if not os.path.exists(MEDIA_ROOT):
+       os.mkdir(MEDIA_ROOT)
+
+# URL that handles the media served from MEDIA_ROOT. Make sure to use a
+# trailing slash if there is a path component (optional in other cases).
+# Examples: "http://media.lawrence.com", "http://example.com/media/"
+MEDIA_URL = 'http://localhost:8040/'
+
+# Absolute path to the directory static files should be collected to.
+# 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 = '/var/www/static/'
+
+# URL prefix for static files.
+# Example: "http://media.lawrence.com/static/"
+STATIC_URL = '/static/'
+
+# Additional locations of static files
+STATICFILES_DIRS = (
+    # Put strings here, like "/home/html/static" or "C:/www/django/static".
+    # Always use forward slashes, even on Windows.
+    # Don't forget to use absolute paths, not relative paths.
+)
+
+# List of finder classes that know how to find static files in
+# various locations.
+STATICFILES_FINDERS = (
+    'django.contrib.staticfiles.finders.FileSystemFinder',
+    'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
+)
+
+# Make this unique, and don't share it with anybody.
+SECRET_KEY = 'a8l7%06wr2k+3=%#*#@#rvop2mmzko)44%7k(zx%lls^ihm9^5'
+
+# List of callables that know how to import templates from various sources.
+#TEMPLATE_LOADERS = (
+#    ('django.template.loaders.cached.Loader', (
+#        'django.template.loaders.filesystem.Loader',
+#        'django.template.loaders.app_directories.Loader',
+#    )),
+#)
+
+
+MIDDLEWARE_CLASSES = (
+    'django.middleware.common.CommonMiddleware',
+    'django.contrib.sessions.middleware.SessionMiddleware',
+    'django.middleware.csrf.CsrfViewMiddleware',
+    'django.contrib.auth.middleware.AuthenticationMiddleware',
+    'django.contrib.messages.middleware.MessageMiddleware',
+    'django.middleware.locale.LocaleMiddleware',
+    'pagination.middleware.PaginationMiddleware',
+)
+
+ROOT_URLCONF = 'urls'
+
+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.
+    '/home/momo/dev/teleforma/teleforma/teleforma/templates/',
+)
+
+INSTALLED_APPS = (
+    'django.contrib.auth',
+    'django.contrib.contenttypes',
+    'django.contrib.sessions',
+    'django.contrib.sites',
+    'django.contrib.messages',
+    'django.contrib.staticfiles',
+    'django.contrib.admin',
+    'telemeta',
+    'jsonrpc',
+    'south',
+    'teleforma',
+    'sorl.thumbnail',
+    'django_extensions',
+    'pagination',
+    'postman',
+#    'private_files',
+    'markup_mixin',
+    'notes',
+#    'jquery',
+    'timezones',
+    'jqchat',
+#    'follow',
+     'googletools',
+     'telecaster',
+)
+
+TEMPLATE_CONTEXT_PROCESSORS = (
+    'django.core.context_processors.request',
+    'django.contrib.auth.context_processors.auth',
+    'postman.context_processors.inbox',
+    "django.core.context_processors.i18n",
+    "django.core.context_processors.media",
+    'django.core.context_processors.static',
+    "teleforma.context_processors.periods",
+)
+
+TELEMETA_ORGANIZATION = 'Pre-Barreau - CRFPA'
+TELEMETA_SUBJECTS = ('test', 'telemeta', 'sandbox')
+TELEMETA_DESCRIPTION = "Telemeta TEST sandbox"
+TELEMETA_GMAP_KEY = 'ABQIAAAArg7eSfnfTkBRma8glnGrlxRVbMrhnNNvToCbZQtWdaMbZTA_3RRGObu5PDoiBImgalVnnLU2yN4RMA'
+TELEMETA_CACHE_DIR = MEDIA_ROOT + 'cache'
+TELEMETA_EXPORT_CACHE_DIR = TELEMETA_CACHE_DIR + "/export"
+TELEMETA_DATA_CACHE_DIR = TELEMETA_CACHE_DIR + "/data"
+
+TELEMETA_DOWNLOAD_ENABLED = True
+TELEMETA_STREAMING_FORMATS = ('mp3', 'webm')
+TELEMETA_DOWNLOAD_FORMATS = ('wav', 'mp3', 'webm')
+TELEMETA_PUBLIC_ACCESS_PERIOD = 51
+TELEMETA_DEFAULT_GRAPHER_SIZES = ['360x130', '640x130']
+TELEMETA_DEFAULT_GRAPHER_ID = 'waveform_contour_wh'
+
+AUTH_PROFILE_MODULE = 'telemeta.userprofile'
+LOGIN_URL = '/login/'
+LOGIN_REDIRECT_URL = reverse_lazy('teleforma-desk')
+SESSION_EXPIRE_AT_BROWSER_CLOSE = False
+
+EMAIL_HOST = 'smtp.numericable.fr'
+DEFAULT_FROM_EMAIL = 'webmaster@parisson.com'
+SERVER_EMAIL = 'webmaster@parisson.com'
+EMAIL_SUBJECT_PREFIX = '[' + TELEMETA_ORGANIZATION.decode('utf8') + '] '
+
+POSTMAN_AUTO_MODERATE_AS = True
+
+TELECASTER_CONF = [{'type':'mp3','server_type':'icecast','conf':'/etc/telecaster/deefuzzer_mp3.xml', 'port':'8000'},
+                   {'type':'webm','server_type':'stream-m','conf':'/etc/telecaster/deefuzzer_webm.xml', 'port':'8080'}, ]
+
+TELECASTER_RSYNC_SERVER = 'telecaster@jimi.parisson.com:archives/'
+TELECASTER_RSYNC_LOG = '/var/log/telecaster/rsync.log'
+TELECASTER_MASTER_SERVER = 'angus.parisson.com'
+
+# CRFPA or AE or PRO
+TELEFORMA_E_LEARNING_TYPE = 'CRFPA'
+TELEFORMA_GLOBAL_TWEETER = False
+TELEFORMA_PERIOD_TWEETER = True
+
+JQCHAT_DISPLAY_COUNT = 50
+JQCHAT_DISPLAY_TIME  = 48
\ No newline at end of file
diff --git a/app/urls.py b/app/urls.py
new file mode 100644 (file)
index 0000000..8bacff0
--- /dev/null
@@ -0,0 +1,29 @@
+# -*- coding: utf-8 -*-
+from django.conf.urls.defaults import *
+
+# Uncomment the next two lines to enable the admin:
+from django.contrib import admin
+admin.autodiscover()
+
+js_info_dict = {
+    'packages': ('telemeta','telecaster'),
+}
+
+urlpatterns = patterns('',
+    # Example:
+    # (r'^sandbox/', include('sandbox.foo.urls')),
+
+    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
+    # to INSTALLED_APPS to enable admin documentation:
+    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),
+    url(r'^admin/django/', include(admin.site.urls)),
+
+    # TeleForma
+    (r'^', include('teleforma.urls')),
+    (r'^telecaster/', include('telecaster.urls')),
+
+    # Languages
+    (r'^i18n/', include('django.conf.urls.i18n')),
+    (r'^jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict),
+
+)
diff --git a/app/wsgi.py b/app/wsgi.py
new file mode 100644 (file)
index 0000000..d71b3b7
--- /dev/null
@@ -0,0 +1,8 @@
+import os
+
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")
+
+# This application object is used by the development server
+# as well as any WSGI server configured to use this file.
+from django.core.wsgi import get_wsgi_application
+application = get_wsgi_application()
diff --git a/docker-compose.yml b/docker-compose.yml
new file mode 100644 (file)
index 0000000..d85fdfe
--- /dev/null
@@ -0,0 +1,43 @@
+data:
+  image: debian:wheezy
+  volumes:
+     - ./data/media/:/srv/media
+     - ./data/static/:/srv/static
+     - ./data/backup/:/srv/backup
+  command: "true"
+
+db:
+  image: mysql
+  environment:
+    - MYSQL_ROOT_PASSWORD=mysecretpassword
+    - MYSQL_DATABASE=teleforma
+    - MYSQL_USER=teleforma
+    - MYSQL_PASSWORD=admin
+  volumes:
+    - ./data/var/lib/mysql/:/var/lib/mysql
+    - ./data/var/log/mysql/:/var/log/mysql
+
+app:
+  build: .
+  command: /bin/sh deploy/start_app.sh
+  volumes:
+    - ./app/:/srv/app
+    - ./teleforma/:/srv/src/teleforma
+  volumes_from:
+    - data
+  ports:
+    - "8000:8000"
+  links:
+    - db
+
+nginx:
+  image: nginx
+  ports:
+    - "80:80"
+  volumes:
+    - ./app/deploy/nginx-app.conf:/etc/nginx/conf.d/default.conf
+    - ./data/var/log/nginx/:/var/log/nginx
+  volumes_from:
+    - data
+  links:
+    - app
diff --git a/etc/nginx.conf b/etc/nginx.conf
new file mode 100644 (file)
index 0000000..251b89d
--- /dev/null
@@ -0,0 +1,37 @@
+# the upstream component nginx needs to connect to
+upstream django {
+    # server unix:///path/to/your/mysite/mysite.sock; # for a file socket
+    server unix:///var/run/teleforma.sock; # for a web port socket (we'll use this first)
+    }
+
+server {
+    # the port your site will be served on
+    listen      80;
+    # the domain name it will serve for
+    server_name 127.0.0.1; # substitute your machine's IP address or FQDN
+    charset     utf-8;
+
+    # max upload size
+    client_max_body_size 75M;   # adjust to taste
+
+    # Django media
+    location /media  {
+        alias /media/podcast/archives/;  # your Django project's media files - amend as required
+        #autoindex on;
+    }
+
+    location /static {
+        alias /var/www/static/; # your Django project's static files - amend as required
+    }
+
+    # Finally, send all non-media requests to the Django server.
+    location / {
+        uwsgi_pass  django;
+        include     /etc/nginx/uwsgi_params; # the uwsgi_params file you installed
+        #uwsgi_pass_request_body on;
+        }
+
+    error_log /var/log/nginx/teleforma-error.log;
+    access_log /var/log/nginx/teleforma-access.log;
+
+    }
diff --git a/requirements-dev.txt b/requirements-dev.txt
new file mode 100644 (file)
index 0000000..0fc31c2
--- /dev/null
@@ -0,0 +1 @@
+-e git+https://github.com/Parisson/django_quiz.git#egg=django_quiz-0.5.1
diff --git a/requirements-new.txt b/requirements-new.txt
new file mode 100644 (file)
index 0000000..d1b6364
--- /dev/null
@@ -0,0 +1,12 @@
+--index-url https://pypi.python.org/simple/
+
+setuptools
+uwsgi
+django==1.6.11
+telemeta
+south
+django-pagination
+django-postman
+django-extensions
+django-notes
+django-timezones
diff --git a/teleforma/scripts/translate.sh b/teleforma/scripts/translate.sh
new file mode 100755 (executable)
index 0000000..73f6d02
--- /dev/null
@@ -0,0 +1,7 @@
+#!/bin/sh
+
+cd teleforma
+django-admin makemessages -a
+django-admin makemessages -d djangojs -a
+django-admin compilemessages
+cd ..