Arborescence des pages

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.
Commentaire: désactive uwsgi limit-as

...

Au final, voici le contenu du fichier custom/settings_local.py :

Bloc de code
languagetextpy
titleServeur(s) Pod / Fichier custom/settinssettings_local.py
# -*- coding: utf-8 -*-
from django.utils.translation import ugettext_lazy as _

##
# DEBUG mode activation
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#debug
#
# SECURITY WARNING: MUST be set to False when deploying into production.
DEBUG = False

SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxx'

# Droit des fichiers uploadés
FILE_UPLOAD_PERMISSIONS = 0o644

##
# A list of strings representing the host/domain names
# that this Django site is allowed to serve.
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['162.38.xx.xx', 'xxxxx.umontpellier.fr']

##
# A tuple that lists people who get code error notifications
#   when DEBUG=False and a view raises an exception.
#
# https://docs.djangoproject.com/fr/1.11/ref/settings/#std:setting-ADMINS
#
ADMINS = (
    ('Admin Pod', 'xxx.xxx@umontpellier.fr'),
)
##
# A dictionary containing the settings for all databases
# to be used with Django.
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#databases
"""
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': '/data/www/podtest/django_projects/podv2/db.sqlite',
    }
}
"""

# MySQL settings
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': 'xxx',
        'USER': 'xxx',
        'PASSWORD': 'xxx',
        'HOST': 'xxxxx.umontpellier.fr',
        'PORT': '',
        'OPTIONS': {'init_command':"SET storage_engine=INNODB, sql_mode='STRICT_TRANS_TABLES', innodb_strict_mode=1;"}
        #'OPTIONS': {'init_command':"SET storage_engine=INNODB;"}
    }
}

RESTRICT_EDIT_VIDEO_ACCESS_TO_STAFF_ONLY = True

VIDEO_MAX_UPLOAD_SIZE = 4

FILE_ALLOWED_EXTENSIONS = ( 'doc', 'docx', 'odt', 'pdf', 'xls', 'xlsx', 'ods', 'ppt', 'pptx', 'txt', 'html', 'htm', 'vtt', 'srt', 'webm', 'ts', )
IMAGE_ALLOWED_EXTENSIONS = ( 'jpg', 'jpeg', 'bmp', 'png', 'gif', 'tiff', )
FILE_MAX_UPLOAD_SIZE = 20

##
# THIRD PARTY APPS OPTIONNAL
#
USE_PODFILE = True
THIRD_PARTY_APPS = ['live', 'enrichment']

# Nouveaute v2
AUTH_TYPE = (('local', ('local')), ('CAS', 'CAS'))

USE_CAS = True
CAS_SERVER_URL = 'https://xxx.umontpellier.fr/cas/'
CAS_GATEWAY = False
POPULATE_USER = 'LDAP'
AUTH_CAS_USER_SEARCH = 'user'

CREATE_GROUP_FROM_AFFILIATION = False
AFFILIATION_STAFF = ('faculty', 'employee', 'researcher', 'affiliate')

LDAP_SERVER = {'url': 'xxxxx.umontpellier.fr', 'port': 389, 'use_ssl': False}
AUTH_LDAP_BIND_DN = 'xxx'
AUTH_LDAP_BIND_PASSWORD =  'xxx'
AUTH_LDAP_BASE_DN = 'ou=people,dc=umontpellier,dc=fr'
AUTH_LDAP_USER_SEARCH = (AUTH_LDAP_BASE_DN, "(uid=%(uid)s)")

##
# Internationalization and localization.
#
#   https://docs.djangoproject.com/en/1.8/ref/settings/#globalization-i18n-l10n
#
LANGUAGE_CODE = 'fr'
LANGUAGES = (
    ('fr', 'Fran?§ais'),
    ('en', 'English')
)
MODELTRANSLATION_DEFAULT_LANGUAGE = 'fr'
MODELTRANSLATION_FALLBACK_LANGUAGES = ('fr', 'en')

##
# A string representing the time zone for this installation.
#
#   https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
#
TIME_ZONE = 'Europe/Paris'

##
# Dynamic files (user managed content: videos, subtitles, documents, etc...)
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#media-url
# https://docs.djangoproject.com/en/1.11/ref/settings/#media-root
#
# WARNING: this folder must have previously been created.
MEDIA_URL = '/media/'
MEDIA_ROOT = '/data/www/%userpod%/media'

FILE_UPLOAD_TEMP_DIR = '/var/tmp'

##
# eMail settings
#
# https://docs.djangoproject.com/en/1.11/ref/settings/#email-host
# https://docs.djangoproject.com/en/1.11/ref/settings/#email-port
# https://docs.djangoproject.com/en/1.11/ref/settings/#default-from-email
#
#   username: EMAIL_HOST_USER
#   password: EMAIL_HOST_PASSWORD
#
EMAIL_HOST = 'smtp-xxx.umontpellier.fr'
EMAIL_PORT = 25
DEFAULT_FROM_EMAIL = 'xxx.xxx@umontpellier.fr'

# https://docs.djangoproject.com/fr/1.11/ref/settings/#std:setting-SERVER_EMAIL
SERVER_EMAIL = 'xxx.xxx@umontpellier.fr'

MENUBAR_SHOW_STAFF_OWNERS_ONLY = True
HOMEPAGE_SHOWS_RESTRICTED = True
##
# List of Elasticsearch urls, like ['host1', 'host2', ...].
#
#   http://elasticutils.readthedocs.io/en/latest/django.html#django.conf.settings.ES_URLS
#
ES_URL = ['http://162.38.xx.xx:9200/']

FFMPEG = '/opt/ffmpeg/ffmpeg/ffmpeg'
FFPROBE = '/opt/ffmpeg/ffmpeg/ffprobe'

# Encode with Celery
CELERY_TO_ENCODE = True
CELERY_NAME = "pod_project"
CELERY_BACKEND = "amqp"
CELERY_BROKER = "amqp://pod:xxxx@162.38.xx.xx//"

# Template Settings
TEMPLATE_VISIBLE_SETTINGS = {
     'TITLE_SITE': 'Vidéo - Université de Montpellier',
     'TITLE_ETB': 'Université de Montpellier',
     'LOGO_SITE': 'custom/um_pod.png',
     'LOGO_COMPACT_SITE': 'custom/logo_black_compact.png',
     'LOGO_ETB': 'custom/um.png',
     'LOGO_PLAYER': 'custom/logo_player.png',
     'FOOTER_TEXT': (
         '163 rue Auguste Broussonnet',
         '34090 Montpellier',
         ('<a href="https://goo.gl/maps/RHsfxME59Fp"'
          ' target="_blank">Google maps</a>')
     ),
     'LINK_PLAYER': 'https://www.umontpellier.fr',
     'CSS_OVERRIDE': 'custom/um.css',
     'FAVICON': 'custom/favicon.png'
}

SUBJECT_CHOICES = ( ('', '-----'), ('info', _('Request more information')), ('request_password', _('Password request for a video')), ('inappropriate_content', _('Report inappropriate content')),
('bug', _('Correction or bug report')), ('other', _('Other (please specify)')) )

# Templates spécifiques UM
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': ['/data/www/%userpod%/django_projects/podv2/pod/custom/templates'],
        'APP_DIRS': True,
        'OPTIONS': {
            'context_processors': [
                'django.template.context_processors.debug',
                'django.template.context_processors.request',
                'django.contrib.auth.context_processors.auth',
                'django.contrib.messages.context_processors.messages',
                # Local contexts
                'pod.main.context_processors.context_settings',
                'pod.main.context_processors.context_navbar'
            ],
        },
    },
]

DEFAULT_THUMBNAIL = 'custom/default.png'

# Utile pour la reprise de l'existant (adresse de Pod v1 en production)
FROM_URL = 'https://video.umontpellier.fr/media/'

...

Bloc de code
languagetext
titleServeur(s) Pod / Fichier pod_uwsgi.ini
# pod_uwsgi.ini file
[uwsgi]

# Django-related settings
# the base directory (full path)
chdir           = /data/www/%userpod%/django_projects/podv2
# Django's wsgi file
module          = pod.wsgi
#module          = pod.wsgi:application
# the virtualenv (full path)
home            = /data/www/%userpod%/.virtualenvs/django_pod
# process-related settings
# The master uWSGI process is necessary to gracefully re-spawn and pre-fork workers, consolidate logs, and manage many other features.
master          = true
# maximum number of worker processes
processes       = 10
# the socket (use the full path to be safe)
socket          = /data/www/%userpod%/django_projects/podv2/uwsgi/podv2.sock
chown-socket    = %userpod%:nginx
# http		= podtest:nginx8000
# ... with appropriate permissions - may be needed
#chmod-socket    = 666
chmod-socket    = 666
# clear environment on exit
vacuum          = true
#
daemonize		       = /data/www/%userpod%/django_projects/podv2/uwsgi/uwsgi-pod.log

#
die-on-term		= true
limit-as 		= 5120
max-requests	= 5000 recommended params by https://www.techatbloomberg.com/blog/configuring-uwsgi-production-deployment/
strict          = true  ; This option tells uWSGI to fail to start if any parameter in the configuration file isn’t explicitly understood. 
die-on-term     = true  ; Shutdown when receiving SIGTERM (default is respawn)
need-app        = true  ; This parameter prevents uWSGI from starting if it is unable to find or load your application module.

# Limit process address space (vsz) (in megabytes).
# Limits the address space usage of each uWSGI (worker) process using POSIX/UNIX setrlimit(). For example, limit-as 256 will disallow uWSGI processes to grow over 256MB of address space. Address space is the virtual memory a process has access to. It does not correspond to physical memory. Read and understand this page before enabling this option: http://en.wikipedia.org/wiki/Virtual_memory
# limit-as        = 5120
# max-requests    = 5000

Démarrage manuel des workers uWSGI 

...