forked from ScoDoc/ScoDoc
Reorganisation des fichiers, scripts d'install et doc installation
This commit is contained in:
parent
fb8f6641f8
commit
c2d89799f0
69
README.md
69
README.md
@ -42,18 +42,41 @@ On peut installer à partir de zéro, ou sur une machine ayant déjà un ScoDoc
|
|||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
|
|
||||||
|
#### Arrêter et renommer ScoDoc7
|
||||||
|
**Important**: si vous avez un ScoDoc7 installé sur ce serveur, le mettre à jour, l'arrêter et renommer son répertoire avant de commencer l'installation de ScoDoc 8:
|
||||||
|
|
||||||
|
1. S'assurer que l'installation ScoDoc 7 est à jour
|
||||||
|
|
||||||
|
sudo su
|
||||||
|
cd /opt/scodoc/Products/ScoDoc/config
|
||||||
|
./upgrade.sh
|
||||||
|
|
||||||
|
2. Arrêter le service ScoDoc 7
|
||||||
|
|
||||||
|
systemctl stop scodoc7
|
||||||
|
|
||||||
|
S'assurer qu'il est bien stoppé (`ps auxw`, ...), sans qui la migration va échouer.
|
||||||
|
|
||||||
|
3. Renommer le répertoire de ScoDoc 7:
|
||||||
|
|
||||||
|
sudo su
|
||||||
|
mv /opt/scodoc /opt/scodoc7
|
||||||
|
|
||||||
|
Les données pourront être migrées après installation la nouvelle evrsion, voir plus loin.
|
||||||
|
|
||||||
|
#### Installer ScoDoc
|
||||||
Sur un système Linux Debian 10, en tant que `root`:
|
Sur un système Linux Debian 10, en tant que `root`:
|
||||||
|
|
||||||
- Charger la dernière release depuis https://scodoc.org/git/viennet/ScoDoc/releases
|
- Charger la dernière release depuis https://scodoc.org/git/viennet/ScoDoc/releases
|
||||||
|
|
||||||
- Déplacer ou copier le fichier `scodoc-v8.x.y.tgz` dans `/opt` et le décomprimer:
|
- Déplacer ou copier le fichier `scodoc-x.y.z.tgz` dans `/opt` et le décomprimer:
|
||||||
|
|
||||||
sudo su
|
sudo su
|
||||||
cd /opt; tar xf - scodoc-v8.x.y.tgz # remplacer x et y par votre version
|
cd /opt; tar xf - scodoc-x.y.z.tgz # remplacer x.y.z par votre version
|
||||||
|
|
||||||
- Lancer le script d'installation:
|
- Lancer le script d'installation:
|
||||||
|
|
||||||
cd /opt/scodoc8/tools
|
cd /opt/scodoc/tools
|
||||||
./install_debian10.sh
|
./install_debian10.sh
|
||||||
|
|
||||||
ce script crée un compte utilisateur "scodoc".
|
ce script crée un compte utilisateur "scodoc".
|
||||||
@ -71,7 +94,7 @@ via `sqlalchemy`.
|
|||||||
Lancer le script:
|
Lancer le script:
|
||||||
|
|
||||||
su postgres
|
su postgres
|
||||||
cd /opt/scodoc8/tools
|
cd /opt/scodoc/tools
|
||||||
./create_database.sh
|
./create_database.sh
|
||||||
|
|
||||||
Ce script crée une base nommée `SCO8USERS`, appartenant à l'utilisateur (role) postgres `scodoc`.
|
Ce script crée une base nommée `SCO8USERS`, appartenant à l'utilisateur (role) postgres `scodoc`.
|
||||||
@ -115,23 +138,11 @@ Le script `migrate_from_scodoc7.sh` va déplacer les donneés et reconfigurer le
|
|||||||
de votre installation ScoDoc 7 pour passer à ScoDoc 8 (*ne pas utiliser en production !*).
|
de votre installation ScoDoc 7 pour passer à ScoDoc 8 (*ne pas utiliser en production !*).
|
||||||
**Les modifications effectuées sont sans retour: ScoDoc 7 ne fonctionnera plus !**
|
**Les modifications effectuées sont sans retour: ScoDoc 7 ne fonctionnera plus !**
|
||||||
|
|
||||||
1. S'assurer que l'installation ScoDoc 7 est à jour
|
1. Lancer le script de migration
|
||||||
|
|
||||||
sudo su
|
|
||||||
cd /opt/scodoc/Products/ScoDoc/config
|
|
||||||
./upgrade.sh
|
|
||||||
|
|
||||||
2. Arrêter le service ScoDoc 7
|
|
||||||
|
|
||||||
systemctl stop scodoc7
|
|
||||||
|
|
||||||
S'assurer qu'il est bien stoppé (`ps auxw`, ...), sans qui la migration va échouer.
|
|
||||||
|
|
||||||
3. Lancer le script de migration
|
|
||||||
ScoDoc 8 doit avoir été installé comme expliqué plus haut.
|
ScoDoc 8 doit avoir été installé comme expliqué plus haut.
|
||||||
|
|
||||||
sudo su
|
sudo su
|
||||||
cd /opt/scodoc8/tools
|
cd /opt/scodoc/tools
|
||||||
./migrate_from_scodoc7.sh
|
./migrate_from_scodoc7.sh
|
||||||
|
|
||||||
|
|
||||||
@ -149,6 +160,28 @@ En tant qu'utilisateur `scodoc` (pour avoir accès aux bases départements de Sc
|
|||||||
export FLASK_ENV=development
|
export FLASK_ENV=development
|
||||||
flask run --host=0.0.0.0
|
flask run --host=0.0.0.0
|
||||||
|
|
||||||
|
## Organisation des fichiers
|
||||||
|
|
||||||
|
L'installation comporte les fichiers de l'application, sous `/opt/scodoc/`, et les fichiers locaux (archives, photos, configurations, logs) sous `/opt/scodoc-data`. Par ailleurs, il y a évidemment les bases de données postgresql et la configuration du système.
|
||||||
|
|
||||||
|
### Fichiers locaux
|
||||||
|
Sous `/opt/scodoc-data`, fichiers et répertoires appartienant à l'utilisateur `scodoc`.
|
||||||
|
Ils ne doivent pas être modifiés à la main, sauf certains fichiers de configuration sous
|
||||||
|
`/opt/scodoc-data/config`.
|
||||||
|
|
||||||
|
Le répertoire `/opt/scodoc-data` doit être régulièrement sauvegardé.
|
||||||
|
|
||||||
|
Principaux contenus:
|
||||||
|
|
||||||
|
/opt/scodoc-data
|
||||||
|
/opt/scodoc-data/log # Fichiers de log ScoDoc
|
||||||
|
/opt/scodoc-data/config # Fichiers de configuration
|
||||||
|
.../config/logos # Logos de l'établissement
|
||||||
|
.../config/depts # un fichier par département
|
||||||
|
/opt/scodoc-data/photos # Photos des étudiants
|
||||||
|
/opt/scodoc-data/archives # Archives: PV de jury, maquettes Apogée, fichiers étudiants
|
||||||
|
|
||||||
|
|
||||||
## Tests unitaires
|
## Tests unitaires
|
||||||
|
|
||||||
pytest tests/unit
|
pytest tests/unit
|
||||||
|
@ -445,13 +445,11 @@ def get_templates_from_distrib(template="avis"):
|
|||||||
|
|
||||||
if template in ["avis", "footer"]:
|
if template in ["avis", "footer"]:
|
||||||
# pas de preference pour le template: utilise fichier du serveur
|
# pas de preference pour le template: utilise fichier du serveur
|
||||||
p = os.path.join(scu.SCO_SRC_DIR, pe_local_tmpl)
|
if os.path.exists(pe_local_tmpl):
|
||||||
if os.path.exists(p):
|
template_latex = get_code_latex_from_modele(pe_local_tmpl)
|
||||||
template_latex = get_code_latex_from_modele(p)
|
|
||||||
else:
|
else:
|
||||||
p = os.path.join(scu.SCO_SRC_DIR, pe_default_tmpl)
|
if os.path.exists(pe_default_tmpl):
|
||||||
if os.path.exists(p):
|
template_latex = get_code_latex_from_modele(pe_default_tmpl)
|
||||||
template_latex = get_code_latex_from_modele(p)
|
|
||||||
else:
|
else:
|
||||||
template_latex = "" # fallback: avis vides
|
template_latex = "" # fallback: avis vides
|
||||||
return template_latex
|
return template_latex
|
||||||
|
@ -62,11 +62,14 @@ else:
|
|||||||
# Generated LaTeX files are encoded as:
|
# Generated LaTeX files are encoded as:
|
||||||
PE_LATEX_ENCODING = "utf-8"
|
PE_LATEX_ENCODING = "utf-8"
|
||||||
|
|
||||||
REP_DEFAULT_AVIS = "config/doc_poursuites_etudes/"
|
# /opt/scodoc/tools/doc_poursuites_etudes
|
||||||
|
REP_DEFAULT_AVIS = os.path.join(scu.SCO_TOOLS_DIR, "doc_poursuites_etudes/")
|
||||||
|
REP_LOCAL_AVIS = os.path.join(scu.SCODOC_CFG_DIR, "doc_poursuites_etudes/")
|
||||||
|
|
||||||
PE_DEFAULT_AVIS_LATEX_TMPL = REP_DEFAULT_AVIS + "distrib/modeles/un_avis.tex"
|
PE_DEFAULT_AVIS_LATEX_TMPL = REP_DEFAULT_AVIS + "distrib/modeles/un_avis.tex"
|
||||||
PE_LOCAL_AVIS_LATEX_TMPL = REP_DEFAULT_AVIS + "local/modeles/un_avis.tex"
|
PE_LOCAL_AVIS_LATEX_TMPL = REP_LOCAL_AVIS + "local/modeles/un_avis.tex"
|
||||||
PE_DEFAULT_FOOTER_TMPL = REP_DEFAULT_AVIS + "distrib/modeles/un_footer.tex"
|
PE_DEFAULT_FOOTER_TMPL = REP_DEFAULT_AVIS + "distrib/modeles/un_footer.tex"
|
||||||
PE_LOCAL_FOOTER_TMPL = REP_DEFAULT_AVIS + "local/modeles/un_footer.tex"
|
PE_LOCAL_FOOTER_TMPL = REP_LOCAL_AVIS + "local/modeles/un_footer.tex"
|
||||||
|
|
||||||
# ----------------------------------------------------------------------------------------
|
# ----------------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -176,15 +179,14 @@ def add_pe_stuff_to_zip(context, zipfile, ziproot):
|
|||||||
|
|
||||||
Also copy logos
|
Also copy logos
|
||||||
"""
|
"""
|
||||||
PE_AUX_DIR = os.path.join(scu.SCO_SRC_DIR, "config/doc_poursuites_etudes")
|
distrib_dir = os.path.join(REP_DEFAULT_AVIS, "distrib")
|
||||||
distrib_dir = os.path.join(PE_AUX_DIR, "distrib")
|
|
||||||
distrib_pathnames = list_directory_filenames(
|
distrib_pathnames = list_directory_filenames(
|
||||||
distrib_dir
|
distrib_dir
|
||||||
) # eg /opt/scodoc/Products/ScoDoc/config/doc_poursuites_etudes/distrib/modeles/toto.tex
|
) # eg /opt/scodoc/tools/doc_poursuites_etudes/distrib/modeles/toto.tex
|
||||||
l = len(distrib_dir)
|
l = len(distrib_dir)
|
||||||
distrib_filenames = {x[l + 1 :] for x in distrib_pathnames} # eg modeles/toto.tex
|
distrib_filenames = {x[l + 1 :] for x in distrib_pathnames} # eg modeles/toto.tex
|
||||||
|
|
||||||
local_dir = os.path.join(PE_AUX_DIR, "local")
|
local_dir = os.path.join(REP_LOCAL_AVIS, "local")
|
||||||
local_pathnames = list_directory_filenames(local_dir)
|
local_pathnames = list_directory_filenames(local_dir)
|
||||||
l = len(local_dir)
|
l = len(local_dir)
|
||||||
local_filenames = {x[l + 1 :] for x in local_pathnames}
|
local_filenames = {x[l + 1 :] for x in local_pathnames}
|
||||||
|
@ -29,8 +29,8 @@
|
|||||||
|
|
||||||
|
|
||||||
Archives are plain files, stored in
|
Archives are plain files, stored in
|
||||||
<INSTANCE_HOME>/var/scodoc/archives/<deptid>
|
<SCODOC_VAR_DIR>/archives/<deptid>
|
||||||
(where <INSTANCE_HOME> is usually /opt/scodoc/instance, and <deptid> a departement id)
|
(where <SCODOC_VAR_DIR> is usually /opt/scodoc-data, and <deptid> a departement id)
|
||||||
|
|
||||||
Les PV de jurys et documents associés sont stockées dans un sous-repertoire de la forme
|
Les PV de jurys et documents associés sont stockées dans un sous-repertoire de la forme
|
||||||
<archivedir>/<dept>/<formsemestre_id>/<YYYY-MM-DD-HH-MM-SS>
|
<archivedir>/<dept>/<formsemestre_id>/<YYYY-MM-DD-HH-MM-SS>
|
||||||
@ -72,7 +72,7 @@ from app.scodoc import sco_pvpdf
|
|||||||
|
|
||||||
class BaseArchiver(object):
|
class BaseArchiver(object):
|
||||||
def __init__(self, archive_type=""):
|
def __init__(self, archive_type=""):
|
||||||
dirs = [Config.INSTANCE_HOME, "var", "scodoc", "archives"]
|
dirs = [Config.SCODOC_VAR_DIR, "archives"]
|
||||||
if archive_type:
|
if archive_type:
|
||||||
dirs.append(archive_type)
|
dirs.append(archive_type)
|
||||||
self.root = os.path.join(*dirs)
|
self.root = os.path.join(*dirs)
|
||||||
|
@ -87,7 +87,10 @@ class ScoDocCache:
|
|||||||
"""Store value"""
|
"""Store value"""
|
||||||
key = cls._get_key(oid)
|
key = cls._get_key(oid)
|
||||||
log(f"CACHE key={key}, timeout={cls.timeout}")
|
log(f"CACHE key={key}, timeout={cls.timeout}")
|
||||||
return CACHE.set(key, value, timeout=cls.timeout)
|
status = CACHE.set(key, value, timeout=cls.timeout)
|
||||||
|
if not status:
|
||||||
|
log("Error: cache set failed")
|
||||||
|
return status
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def delete(cls, oid):
|
def delete(cls, oid):
|
||||||
@ -205,9 +208,7 @@ class NotesTableCache(ScoDocCache):
|
|||||||
nt = notes_table.NotesTable(None, formsemestre_id)
|
nt = notes_table.NotesTable(None, formsemestre_id)
|
||||||
dt = time.time() - t0
|
dt = time.time() - t0
|
||||||
log("caching formsemestre_id=%s (%gs)" % (formsemestre_id, dt))
|
log("caching formsemestre_id=%s (%gs)" % (formsemestre_id, dt))
|
||||||
s = cls.set(formsemestre_id, nt)
|
_ = cls.set(formsemestre_id, nt)
|
||||||
if not s:
|
|
||||||
log("Warning: cache.set failed")
|
|
||||||
return nt
|
return nt
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,8 +89,8 @@ CONFIG.CUSTOM_HTML_FOOTER_CNX = CONFIG.CUSTOM_HTML_FOOTER
|
|||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
|
|
||||||
# Fichier de correspondance codelycee -> noms
|
# Fichier de correspondance codelycee -> noms
|
||||||
# (chemin relatif au repertoire d'install des sources)
|
# (dans tools/)
|
||||||
CONFIG.ETABL_FILENAME = "config/etablissements.csv"
|
CONFIG.ETABL_FILENAME = "etablissements.csv"
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
# -------------- Divers:
|
# -------------- Divers:
|
||||||
|
@ -124,7 +124,6 @@ def _report_request(context, REQUEST, fmt="txt"):
|
|||||||
HTTP_USER_AGENT=HTTP_USER_AGENT,
|
HTTP_USER_AGENT=HTTP_USER_AGENT,
|
||||||
form=REQUEST.form,
|
form=REQUEST.form,
|
||||||
HTTP_X_FORWARDED_FOR="?",
|
HTTP_X_FORWARDED_FOR="?",
|
||||||
svn_version=scu.get_svn_version(scu.SCO_SRC_DIR),
|
|
||||||
SCOVERSION=VERSION.SCOVERSION,
|
SCOVERSION=VERSION.SCOVERSION,
|
||||||
)
|
)
|
||||||
txt = (
|
txt = (
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
# Ancien module "scolars"
|
# Ancien module "scolars"
|
||||||
|
import os
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from flask import url_for, g
|
from flask import url_for, g
|
||||||
@ -811,7 +811,7 @@ appreciations_edit = _appreciationsEditor.edit
|
|||||||
|
|
||||||
# -------- Noms des Lycées à partir du code
|
# -------- Noms des Lycées à partir du code
|
||||||
def read_etablissements():
|
def read_etablissements():
|
||||||
filename = scu.SCO_SRC_DIR + "/" + scu.CONFIG.ETABL_FILENAME
|
filename = os.path.join(scu.SCO_TOOLS_DIR, scu.CONFIG.ETABL_FILENAME)
|
||||||
log("reading %s" % filename)
|
log("reading %s" % filename)
|
||||||
f = open(filename)
|
f = open(filename)
|
||||||
L = [x[:-1].split(";") for x in f]
|
L = [x[:-1].split(";") for x in f]
|
||||||
|
@ -28,10 +28,10 @@
|
|||||||
""" Importation des etudiants à partir de fichiers CSV
|
""" Importation des etudiants à partir de fichiers CSV
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import time
|
|
||||||
import collections
|
import collections
|
||||||
|
import os
|
||||||
import re
|
import re
|
||||||
|
import time
|
||||||
|
|
||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
import app.scodoc.notesdb as ndb
|
import app.scodoc.notesdb as ndb
|
||||||
@ -59,8 +59,8 @@ from app.scodoc import sco_groups_view
|
|||||||
from app.scodoc import sco_news
|
from app.scodoc import sco_news
|
||||||
from app.scodoc import sco_preferences
|
from app.scodoc import sco_preferences
|
||||||
|
|
||||||
# format description (relative to Product directory))
|
# format description (in tools/)
|
||||||
FORMAT_FILE = "misc/format_import_etudiants.txt"
|
FORMAT_FILE = "format_import_etudiants.txt"
|
||||||
|
|
||||||
# Champs modifiables via "Import données admission"
|
# Champs modifiables via "Import données admission"
|
||||||
ADMISSION_MODIFIABLE_FIELDS = (
|
ADMISSION_MODIFIABLE_FIELDS = (
|
||||||
@ -109,7 +109,7 @@ ADMISSION_MODIFIABLE_FIELDS = (
|
|||||||
def sco_import_format(with_codesemestre=True):
|
def sco_import_format(with_codesemestre=True):
|
||||||
"returns tuples (Attribut, Type, Table, AllowNulls, Description)"
|
"returns tuples (Attribut, Type, Table, AllowNulls, Description)"
|
||||||
r = []
|
r = []
|
||||||
for l in open(scu.SCO_SRC_DIR + "/" + FORMAT_FILE):
|
for l in open(os.path.join(scu.SCO_TOOLS_DIR, FORMAT_FILE)):
|
||||||
l = l.strip()
|
l = l.strip()
|
||||||
if l and l[0] != "#":
|
if l and l[0] != "#":
|
||||||
fs = l.split(";")
|
fs = l.split(";")
|
||||||
|
@ -70,8 +70,8 @@ import app.scodoc.notesdb as ndb
|
|||||||
import app.scodoc.sco_utils as scu
|
import app.scodoc.sco_utils as scu
|
||||||
|
|
||||||
# Full paths on server's filesystem. Something like "/opt/scodoc/var/scodoc/photos"
|
# Full paths on server's filesystem. Something like "/opt/scodoc/var/scodoc/photos"
|
||||||
PHOTO_DIR = os.path.join(Config.INSTANCE_HOME, "var", "scodoc", "photos")
|
PHOTO_DIR = os.path.join(Config.SCODOC_VAR_DIR, "photos")
|
||||||
ICONS_DIR = os.path.join(scu.SCO_SRC_DIR, "app", "static", "icons")
|
ICONS_DIR = os.path.join(Config.SCODOC_DIR, "app", "static", "icons")
|
||||||
UNKNOWN_IMAGE_PATH = os.path.join(ICONS_DIR, "unknown.jpg")
|
UNKNOWN_IMAGE_PATH = os.path.join(ICONS_DIR, "unknown.jpg")
|
||||||
UNKNOWN_IMAGE_URL = "get_photo_image?etudid=" # with empty etudid => unknown face image
|
UNKNOWN_IMAGE_URL = "get_photo_image?etudid=" # with empty etudid => unknown face image
|
||||||
IMAGE_EXT = ".jpg"
|
IMAGE_EXT = ".jpg"
|
||||||
|
@ -220,24 +220,22 @@ def group_by_key(d, key):
|
|||||||
# ----- Global lock for critical sections (except notes_tables caches)
|
# ----- Global lock for critical sections (except notes_tables caches)
|
||||||
GSL = six.moves._thread.allocate_lock() # Global ScoDoc Lock
|
GSL = six.moves._thread.allocate_lock() # Global ScoDoc Lock
|
||||||
|
|
||||||
# ----- Repertoire "var" (local)
|
SCODOC_DIR = Config.SCODOC_DIR
|
||||||
SCODOC_VAR_DIR = os.path.join(Config.INSTANCE_HOME, "var", "scodoc")
|
|
||||||
# ----- Repertoire "config" modifiable
|
# ----- Repertoire "config" modifiable
|
||||||
# /opt/scodoc/var/scodoc/config
|
# /opt/scodoc-data/config
|
||||||
SCODOC_CFG_DIR = os.path.join(SCODOC_VAR_DIR, "config")
|
SCODOC_CFG_DIR = os.path.join(Config.SCODOC_VAR_DIR, "config")
|
||||||
# ----- Version information
|
# ----- Version information
|
||||||
SCODOC_VERSION_DIR = os.path.join(SCODOC_CFG_DIR, "version")
|
SCODOC_VERSION_DIR = os.path.join(SCODOC_CFG_DIR, "version")
|
||||||
# ----- Repertoire tmp
|
# ----- Repertoire tmp : /opt/scodoc-data/tmp
|
||||||
SCO_TMP_DIR = os.path.join(SCODOC_VAR_DIR, "tmp")
|
SCO_TMP_DIR = os.path.join(Config.SCODOC_VAR_DIR, "tmp")
|
||||||
if not os.path.exists(SCO_TMP_DIR):
|
if not os.path.exists(SCO_TMP_DIR):
|
||||||
os.mkdir(SCO_TMP_DIR, 0o755)
|
os.mkdir(SCO_TMP_DIR, 0o755)
|
||||||
# ----- Les logos: /opt/scodoc/var/scodoc/config/logos
|
# ----- Les logos: /opt/scodoc-data/config/logos
|
||||||
SCODOC_LOGOS_DIR = os.path.join(SCODOC_CFG_DIR, "logos")
|
SCODOC_LOGOS_DIR = os.path.join(SCODOC_CFG_DIR, "logos")
|
||||||
|
|
||||||
# Racine projet: /.../ScoDoc/
|
# ----- Les outils distribués
|
||||||
SCO_SRC_DIR = os.path.join(Config.INSTANCE_HOME, "Products", "ScoDoc")
|
SCO_TOOLS_DIR = os.path.join(Config.SCODOC_DIR, "tools")
|
||||||
# - Les outils distribués
|
|
||||||
SCO_TOOLS_DIR = os.path.join(SCO_SRC_DIR, "config")
|
|
||||||
|
|
||||||
|
|
||||||
# ----- Lecture du fichier de configuration
|
# ----- Lecture du fichier de configuration
|
||||||
@ -720,7 +718,14 @@ def icontag(name, file_format="png", **attrs):
|
|||||||
"""
|
"""
|
||||||
if ("width" not in attrs) or ("height" not in attrs):
|
if ("width" not in attrs) or ("height" not in attrs):
|
||||||
if name not in ICONSIZES:
|
if name not in ICONSIZES:
|
||||||
img_file = SCO_SRC_DIR + "/app/static/icons/%s.%s" % (name, file_format)
|
img_file = os.path.join(
|
||||||
|
Config.SCODOC_DIR,
|
||||||
|
"app/static/icons/%s.%s"
|
||||||
|
% (
|
||||||
|
name,
|
||||||
|
file_format,
|
||||||
|
),
|
||||||
|
)
|
||||||
im = PILImage.open(img_file)
|
im = PILImage.open(img_file)
|
||||||
width, height = im.size[0], im.size[1]
|
width, height = im.size[0], im.size[1]
|
||||||
ICONSIZES[name] = (width, height) # cache
|
ICONSIZES[name] = (width, height) # cache
|
||||||
|
@ -125,7 +125,7 @@ def sco_publish(route, function, permission, methods=("GET",)):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
log.set_log_directory(Config.INSTANCE_HOME + "/log")
|
log.set_log_directory(Config.SCODOC_VAR_DIR + "/log")
|
||||||
log("ScoDoc8 restarting...")
|
log("ScoDoc8 restarting...")
|
||||||
|
|
||||||
# --------------------------------------------------------------------
|
# --------------------------------------------------------------------
|
||||||
|
@ -28,11 +28,8 @@ class Config:
|
|||||||
ADMINS = [SCODOC_ADMIN_MAIL]
|
ADMINS = [SCODOC_ADMIN_MAIL]
|
||||||
SCODOC_ERR_MAIL = os.environ.get("SCODOC_ERR_MAIL")
|
SCODOC_ERR_MAIL = os.environ.get("SCODOC_ERR_MAIL")
|
||||||
BOOTSTRAP_SERVE_LOCAL = os.environ.get("BOOTSTRAP_SERVE_LOCAL")
|
BOOTSTRAP_SERVE_LOCAL = os.environ.get("BOOTSTRAP_SERVE_LOCAL")
|
||||||
# for ScoDoc 7 compat (à changer)
|
SCODOC_DIR = os.environ.get("SCODOC_DIR", "/opt/scodoc")
|
||||||
INSTANCE_HOME = os.environ.get("INSTANCE_HOME", "/opt/scodoc")
|
SCODOC_VAR_DIR = os.environ.get("SCODOC_VAR_DIR", "/opt/scodoc-data")
|
||||||
SCODOC_VAR_DIR = os.path.join(
|
|
||||||
os.environ.get("INSTANCE_HOME", "/opt/scodoc"), "var", "scodoc"
|
|
||||||
)
|
|
||||||
|
|
||||||
# For legacy ScoDoc7 installs: postgresql user
|
# For legacy ScoDoc7 installs: postgresql user
|
||||||
SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data")
|
SCODOC7_SQL_USER = os.environ.get("SCODOC7_SQL_USER", "www-data")
|
||||||
|
@ -17,6 +17,7 @@ import pprint
|
|||||||
import random
|
import random
|
||||||
|
|
||||||
import scodoc_manager
|
import scodoc_manager
|
||||||
|
from config import Config
|
||||||
from app.scodoc import notesdb as ndb
|
from app.scodoc import notesdb as ndb
|
||||||
from app.scodoc import sco_codes_parcours
|
from app.scodoc import sco_codes_parcours
|
||||||
from app.scodoc import sco_edit_formation
|
from app.scodoc import sco_edit_formation
|
||||||
@ -40,7 +41,7 @@ from app.scodoc.sco_exceptions import ScoValueError
|
|||||||
random.seed(12345) # tests reproductibles
|
random.seed(12345) # tests reproductibles
|
||||||
|
|
||||||
|
|
||||||
DEMO_DIR = scu.SCO_SRC_DIR + "/scotests/demo/"
|
DEMO_DIR = Config.SCODOC_DIR + "/scotests/demo/"
|
||||||
NOMS = [x.strip() for x in open(DEMO_DIR + "/noms.txt").readlines()]
|
NOMS = [x.strip() for x in open(DEMO_DIR + "/noms.txt").readlines()]
|
||||||
PRENOMS_H = [x.strip() for x in open(DEMO_DIR + "/prenoms-h.txt").readlines()]
|
PRENOMS_H = [x.strip() for x in open(DEMO_DIR + "/prenoms-h.txt").readlines()]
|
||||||
PRENOMS_F = [x.strip() for x in open(DEMO_DIR + "/prenoms-f.txt").readlines()]
|
PRENOMS_F = [x.strip() for x in open(DEMO_DIR + "/prenoms-f.txt").readlines()]
|
||||||
|
@ -30,6 +30,15 @@ def test_notes_table(test_client):
|
|||||||
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
|
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
|
||||||
sco_cache.invalidate_formsemestre(formsemestre_id)
|
sco_cache.invalidate_formsemestre(formsemestre_id)
|
||||||
assert not sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
|
assert not sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
|
||||||
|
# cache les 5 premiers
|
||||||
|
for sem in sems[:5]:
|
||||||
|
formsemestre_id = sem["formsemestre_id"]
|
||||||
|
nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||||
|
assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
|
||||||
|
# assert "SEM38882" in {s["formsemestre_id"] for s in sems}
|
||||||
|
# formsemestre_id = "SEM38882"
|
||||||
|
# nt = sco_cache.NotesTableCache.get(formsemestre_id)
|
||||||
|
# assert sco_cache.NotesTableCache.get(formsemestre_id, compute=False)
|
||||||
|
|
||||||
|
|
||||||
def test_cache_evaluations(test_client):
|
def test_cache_evaluations(test_client):
|
||||||
|
@ -16,11 +16,9 @@ export PATH="${PATH}":/usr/sbin:/sbin
|
|||||||
# ScoDoc: environment variables
|
# ScoDoc: environment variables
|
||||||
umask 0022
|
umask 0022
|
||||||
|
|
||||||
export SCODOC_DIR=/opt/scodoc8
|
export SCODOC_DIR=/opt/scodoc
|
||||||
|
export SCODOC_VAR_DIR=/opt/scodoc-data
|
||||||
|
|
||||||
SCODOC_VAR_DIR=$(realpath -L "$SCODOC_DIR/var") || die "can't set SCODOC_VAR_DIR"
|
|
||||||
export SCODOC_VAR_DIR
|
|
||||||
# = /opt/scodoc/var/scodoc
|
|
||||||
export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version"
|
export SCODOC_VERSION_DIR="${SCODOC_VAR_DIR}/config/version"
|
||||||
export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos"
|
export SCODOC_LOGOS_DIR="${SCODOC_VAR_DIR}/config/logos"
|
||||||
|
|
||||||
|
@ -8,15 +8,14 @@
|
|||||||
#
|
#
|
||||||
DEST_ADDRESS=emmanuel.viennet@gmail.com
|
DEST_ADDRESS=emmanuel.viennet@gmail.com
|
||||||
|
|
||||||
INSTANCE_DIR=/opt/scodoc
|
|
||||||
|
|
||||||
TMP=/tmp/scodoc-$(date +%F-%s)
|
TMP=/tmp/scodoc-$(date +%F-%s)
|
||||||
|
|
||||||
DEPTS_TO_SAVE=""
|
DEPTS_TO_SAVE=""
|
||||||
SAVE_USERS=0
|
SAVE_USERS=0
|
||||||
SEND_BY_MAIL=1
|
SEND_BY_MAIL=1
|
||||||
|
|
||||||
SCODOC_HOME="/opt/scodoc8"
|
SCODOC_DIR="/opt/scodoc"
|
||||||
|
SCODOC_VAR_DIR="/opt/scodoc-data"
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Arguments
|
# Arguments
|
||||||
@ -76,7 +75,7 @@ fi
|
|||||||
mkdir "$TMP"
|
mkdir "$TMP"
|
||||||
|
|
||||||
# Files to copy:
|
# Files to copy:
|
||||||
FILES="/etc/hosts /etc/debian_version /etc/apt /etc/apache2"
|
FILES="/etc/hosts /etc/debian_version /etc/apt /etc/apache2 $SCODOC_DIR/VERSION"
|
||||||
|
|
||||||
|
|
||||||
echo "ScoDoc diagnostic: informations about your system will be "
|
echo "ScoDoc diagnostic: informations about your system will be "
|
||||||
@ -92,18 +91,8 @@ echo "left in ${TMP}"
|
|||||||
# Logs
|
# Logs
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
|
|
||||||
copy_log() {
|
|
||||||
if [ -e "$1" ]
|
|
||||||
then
|
|
||||||
cp "$1" "$TMP"/scodoc_logs/
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
mkdir "$TMP"/scodoc_logs/
|
mkdir "$TMP"/scodoc_logs/
|
||||||
copy_log "$SCODOC_HOME/log/event.log"
|
cp "$SCODOC_VAR_DIR"/log/*.log "$TMP"/scodoc_logs/
|
||||||
copy_log "$SCODOC_HOME/log/event.log.1"
|
|
||||||
copy_log "$SCODOC_HOME/log/notes.log"
|
|
||||||
copy_log "$SCODOC_HOME/log/notes.log.1"
|
|
||||||
|
|
||||||
|
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
# Linux System Configuration
|
# Linux System Configuration
|
||||||
@ -126,7 +115,7 @@ ls -laR "$SCODOC_HOME" > "$TMP"/ls-laR
|
|||||||
# Databases configurations
|
# Databases configurations
|
||||||
# -------------------------------------
|
# -------------------------------------
|
||||||
(su postgres -c "psql -l") > "${TMP}/psql-l.out"
|
(su postgres -c "psql -l") > "${TMP}/psql-l.out"
|
||||||
for dept in "${INSTANCE_DIR}"/var/scodoc/config/depts/*.cfg
|
for dept in "${SCODOC_VAR_DIR}"/config/depts/*.cfg
|
||||||
do
|
do
|
||||||
cnx=$(cat "$dept")
|
cnx=$(cat "$dept")
|
||||||
(su postgres -c "echo '\dt' | psql -d $cnx") > "${TMP}/psql-$(basename ${dept%%.*}).out"
|
(su postgres -c "echo '\dt' | psql -d $cnx") > "${TMP}/psql-$(basename ${dept%%.*}).out"
|
||||||
@ -139,7 +128,10 @@ done
|
|||||||
# copy files:
|
# copy files:
|
||||||
for f in $FILES
|
for f in $FILES
|
||||||
do
|
do
|
||||||
|
if [ -e "$f" ]
|
||||||
|
then
|
||||||
cp -R "$f" "$TMP"
|
cp -R "$f" "$TMP"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,5 +14,5 @@ Description=Update ScoDoc Software
|
|||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/opt/scodoc8/tools/upgrade.sh
|
ExecStart=/opt/scodoc/tools/upgrade.sh
|
||||||
|
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
source config.sh
|
source config.sh
|
||||||
source utils.sh
|
source utils.sh
|
||||||
|
|
||||||
check_uid_root $0
|
check_uid_root "$0"
|
||||||
|
|
||||||
|
cd "$SCODOC_DIR" || die "can't cd $SCODOC_DIR"
|
||||||
|
|
||||||
# ------------ Safety checks
|
# ------------ Safety checks
|
||||||
if [ "${debian_version}" != "10" ]
|
if [ "${debian_version}" != "10" ]
|
||||||
@ -29,13 +31,24 @@ fi
|
|||||||
# ------------ Unix user
|
# ------------ Unix user
|
||||||
check_create_scodoc_user
|
check_create_scodoc_user
|
||||||
|
|
||||||
|
# --- Create empty .../var/ subdir
|
||||||
|
echo "Creating empty local directories..."
|
||||||
|
for d in var var/scodoc var/scodoc/archives var/scodoc/photos var/scodoc/tmp var/scodoc/config var/scodoc/config/version var/scodoc/config/depts var/scodoc/config/logos
|
||||||
|
do
|
||||||
|
[ -d "$d" ] || mkdir "$d" || die "can't create $d subdirectory"
|
||||||
|
done
|
||||||
|
|
||||||
# ------------ Permissions & directories
|
# ------------ Permissions & directories
|
||||||
change_scodoc_file_ownership
|
change_scodoc_file_ownership
|
||||||
|
set_scodoc_var_dir
|
||||||
|
|
||||||
# ------------ AJOUT DES PAQUETS DEBIAN NECESSAIRES
|
# ------------ AJOUT DES PAQUETS DEBIAN NECESSAIRES
|
||||||
apt-get update
|
apt-get update
|
||||||
|
apt-get -y install gcc
|
||||||
apt-get -y install python3-dev
|
apt-get -y install python3-dev
|
||||||
apt-get -y install python3-venv
|
apt-get -y install python3-venv
|
||||||
|
apt-get -y install python3-pip
|
||||||
|
apt-get install -y python3-wheel
|
||||||
apt-get -y install libpq-dev
|
apt-get -y install libpq-dev
|
||||||
apt-get -y install libcrack2-dev
|
apt-get -y install libcrack2-dev
|
||||||
apt-get -y install postgresql
|
apt-get -y install postgresql
|
||||||
@ -44,12 +57,12 @@ apt-get -y install graphviz
|
|||||||
|
|
||||||
# ------------ CREATION DU VIRTUALENV
|
# ------------ CREATION DU VIRTUALENV
|
||||||
echo "Creating python3 virtualenv..."
|
echo "Creating python3 virtualenv..."
|
||||||
cd "$SCODOC_DIR" || die "can't cd $SCODOC_DIR"
|
|
||||||
python3 -m venv venv || die "can't create Python 3 virtualenv"
|
python3 -m venv venv || die "can't create Python 3 virtualenv"
|
||||||
|
|
||||||
# ------------ INSTALL DES PAQUETS PYTHON (3.7)
|
# ------------ INSTALL DES PAQUETS PYTHON (3.7)
|
||||||
# ScoDoc8 uses pip in our env
|
# ScoDoc8 uses pip in our env
|
||||||
source venv/bin/activate
|
source venv/bin/activate
|
||||||
|
pip install --upgrade pip
|
||||||
pip install wheel
|
pip install wheel
|
||||||
pip install -r requirements-3.7.txt
|
pip install -r requirements-3.7.txt
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
# INUTILE
|
||||||
|
|
||||||
# Préparation d'une release ScoDoc
|
# Préparation d'une release ScoDoc
|
||||||
# Download last git
|
# Download last git
|
||||||
source config.sh
|
source config.sh
|
||||||
@ -61,18 +63,13 @@ git clone "$SOURCE_URL" || die "git error cloning $SOURCE_URL"
|
|||||||
cd ScoDoc || die "no ScoDoc directory !"
|
cd ScoDoc || die "no ScoDoc directory !"
|
||||||
git checkout "$SOURCE_BRANCH" || die "git ckecking out branch $SOURCE_BRANCH"
|
git checkout "$SOURCE_BRANCH" || die "git ckecking out branch $SOURCE_BRANCH"
|
||||||
|
|
||||||
# --- Create empty .../var/ subdir
|
|
||||||
echo "Creating empty local directories..."
|
|
||||||
mkdir -p var/scodoc || die "can't create var subdirectory"
|
|
||||||
mkdir var/scodoc/archives var/scodoc/photos var/scodoc/tmp var/scodoc/config
|
|
||||||
mkdir var/scodoc/config/version var/scodoc/config/depts var/scodoc/config/logos
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
# --- Archive
|
# --- Archive
|
||||||
echo "Preparing archive..."
|
echo "Preparing archive..."
|
||||||
mv ScoDoc scodoc8
|
mv ScoDoc scodoc
|
||||||
chown -R scodoc scodoc8
|
chown -R scodoc scodoc
|
||||||
tar cfz "$RESULTFILE" scodoc8
|
tar cfz "$RESULTFILE" scodoc
|
||||||
echo
|
echo
|
||||||
echo "Release: $(pwd)/$RESULTFILE"
|
echo "Release: $(pwd)/$RESULTFILE"
|
||||||
|
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Migre une install ScoDoc 7 vers ScoDoc 8
|
# Migre une install ScoDoc 7 vers ScoDoc 8
|
||||||
# Le ScoDoc7 est supposé être dans /opt/scodoc/Products/ScoDoc
|
# Le ScoDoc7 est supposé être dans /opt/scodoc7/Products/ScoDoc
|
||||||
# Le nouveau est /opt/scodoc8/
|
# Le nouveau est /opt/scodoc/
|
||||||
#
|
#
|
||||||
# L'install ScoDoc7 de départ doit impérativement être à jour (upgrade.sh).
|
# L'install ScoDoc7 de départ doit impérativement être à jour (upgrade.sh).
|
||||||
#
|
#
|
||||||
# 1- Utilisateur Unix:
|
# 1- Utilisateur Unix:
|
||||||
# scodoc7 tournait comme www-data
|
# scodoc7 tournait comme www-data
|
||||||
# scodoc8 tourne sous l'utilisateur unix scodoc
|
# scodoc >= 8 tourne sous l'utilisateur unix scodoc
|
||||||
#
|
#
|
||||||
# 2- Utilisateur postgresql (bases de données)
|
# 2- Utilisateur postgresql (bases de données)
|
||||||
# scodoc7 les bases appartenaient à "www-data"
|
# scodoc7 les bases appartenaient à "www-data"
|
||||||
@ -17,7 +17,7 @@
|
|||||||
# idem pour la base SCOUSERS (avant sa migration vers SCO8USERS)
|
# idem pour la base SCOUSERS (avant sa migration vers SCO8USERS)
|
||||||
#
|
#
|
||||||
# 3- Fichiers de données et config locale:
|
# 3- Fichiers de données et config locale:
|
||||||
# archives, photos: /opt/scodoc/var/ => /opt/scodoc8/var
|
# archives, photos: /opt/scodoc/var/ => /opt/scodoc-data
|
||||||
#
|
#
|
||||||
# 4- TODO migrer de Apache à nginx, installer memcached, scripts service systemd
|
# 4- TODO migrer de Apache à nginx, installer memcached, scripts service systemd
|
||||||
#
|
#
|
||||||
@ -26,7 +26,7 @@ source config.sh
|
|||||||
source utils.sh
|
source utils.sh
|
||||||
check_uid_root
|
check_uid_root
|
||||||
|
|
||||||
SCODOC7_HOME="/opt/scodoc"
|
SCODOC7_HOME="/opt/scodoc7"
|
||||||
SCODOC7_DIR="${SCODOC7_HOME}/Products/ScoDoc"
|
SCODOC7_DIR="${SCODOC7_HOME}/Products/ScoDoc"
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ migrate_database_ownership() {
|
|||||||
su -c "psql -c 'REASSIGN OWNED BY \"www-data\" TO scodoc;'" "$POSTGRES_SUPERUSER"
|
su -c "psql -c 'REASSIGN OWNED BY \"www-data\" TO scodoc;'" "$POSTGRES_SUPERUSER"
|
||||||
}
|
}
|
||||||
|
|
||||||
# --- 3. Fichiers locaux: /opt/scodoc/var => /opt/scodoc8/var
|
# --- 3. Fichiers locaux: /opt/scodoc/var => /opt/scodoc-data
|
||||||
migrate_local_files() {
|
migrate_local_files() {
|
||||||
SCODOC_VAR_DIR_BACKUP="$SCODOC_VAR_DIR".bak
|
SCODOC_VAR_DIR_BACKUP="$SCODOC_VAR_DIR".bak
|
||||||
if [ -e "$SCODOC_VAR_DIR_BACKUP" ]
|
if [ -e "$SCODOC_VAR_DIR_BACKUP" ]
|
||||||
@ -53,7 +53,15 @@ migrate_local_files() {
|
|||||||
echo "renomme $SCODOC_VAR_DIR en $SCODOC_VAR_DIR_BACKUP"
|
echo "renomme $SCODOC_VAR_DIR en $SCODOC_VAR_DIR_BACKUP"
|
||||||
mv "$SCODOC_VAR_DIR" "$SCODOC_VAR_DIR_BACKUP"
|
mv "$SCODOC_VAR_DIR" "$SCODOC_VAR_DIR_BACKUP"
|
||||||
fi
|
fi
|
||||||
mv "${SCODOC7_HOME}"/var/* "$SCODOC_VAR_DIR" || die "migrate_local_files failed"
|
mv "${SCODOC7_HOME}"/var/scodoc/* "$SCODOC_VAR_DIR" || die "migrate_local_files failed"
|
||||||
|
|
||||||
|
# Templates locaux poursuites etudes
|
||||||
|
if [ -e "${SCODOC7_DIR}"/config/doc_poursuites_etudes/local ]
|
||||||
|
then
|
||||||
|
mv "${SCODOC7_DIR}"/config/doc_poursuites_etudes/local "$SCODOC_VAR_DIR"/config/doc_poursuites_etudes || die "migrate_local_files failed to migrate doc_poursuites_etudes/local"
|
||||||
|
fi
|
||||||
|
# S'assure que le propriétaire est "scodoc":
|
||||||
|
chown -R "${SCODOC_USER}:${SCODOC_GROUP}" "${SCODOC_VAR_DIR}" || die "change_scodoc_file_ownership failed on ${SCODOC_VAR_DIR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -85,5 +93,12 @@ read -r ans
|
|||||||
if [ "$(norm_ans "$ans")" != 'N' ]
|
if [ "$(norm_ans "$ans")" != 'N' ]
|
||||||
then
|
then
|
||||||
migrate_local_files
|
migrate_local_files
|
||||||
|
else
|
||||||
|
echo -n "Vérifier et créer si besoin le répertoire local /opt/scodoc-data ?"
|
||||||
|
read -r ans
|
||||||
|
if [ "$(norm_ans "$ans")" != 'N' ]
|
||||||
|
then
|
||||||
|
set_scodoc_var_dir
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -117,8 +117,8 @@ CONFIG.CUSTOM_HTML_FOOTER_CNX = CONFIG.CUSTOM_HTML_FOOTER
|
|||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
|
|
||||||
# Fichier de correspondance codelycee -> noms
|
# Fichier de correspondance codelycee -> noms
|
||||||
# (chemin relatif au repertoire d'install des sources)
|
# (dans tools/)
|
||||||
CONFIG.ETABL_FILENAME = "tools/etablissements.csv"
|
CONFIG.ETABL_FILENAME = "etablissements.csv"
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Configuration globale de ScoDoc (version juin 2009)
|
# Configuration globale de ScoDoc (version juin 2009)
|
||||||
# Ce fichier est copié dans /opt/scodoc8/var/scodoc/config
|
# Ce fichier est copié dans /opt/scodoc-data/config
|
||||||
# par les scripts d'installation/mise à jour.
|
# par les scripts d'installation/mise à jour.
|
||||||
|
|
||||||
# La plupart des réglages sont stoqués en base de donnée et accessibles via le web
|
# La plupart des réglages sont stoqués en base de donnée et accessibles via le web
|
||||||
@ -100,8 +100,7 @@ CONFIG = CFG()
|
|||||||
# -------------- Noms de Lycées
|
# -------------- Noms de Lycées
|
||||||
# -----------------------------------------------------
|
# -----------------------------------------------------
|
||||||
# Fichier de correspondance codelycee -> noms
|
# Fichier de correspondance codelycee -> noms
|
||||||
# (chemin relatif au repertoire d'install des sources)
|
# CONFIG.ETABL_FILENAME = "etablissements.csv"
|
||||||
# CONFIG.ETABL_FILENAME = "tools/etablissements.csv"
|
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------
|
# ----------------------------------------------------
|
||||||
|
@ -12,12 +12,6 @@ import traceback
|
|||||||
|
|
||||||
sys.path.append("..")
|
sys.path.append("..")
|
||||||
|
|
||||||
# INSTANCE_HOME est nécessaire pour sco_utils.py
|
|
||||||
# note: avec le python 2.7 de Zope2, l'import de pyscopg2 change
|
|
||||||
# INSTANCE_HOME dans l'environnement !
|
|
||||||
# Ici on le fixe à la "bonne" valeur pour ScoDoc7.
|
|
||||||
os.environ["INSTANCE_HOME"] = "/opt/scodoc"
|
|
||||||
|
|
||||||
|
|
||||||
def log(msg):
|
def log(msg):
|
||||||
"write msg on stderr, add newline and flush"
|
"write msg on stderr, add newline and flush"
|
||||||
|
@ -10,7 +10,10 @@
|
|||||||
#
|
#
|
||||||
# E. Viennet, sep 2013, mar 2017, jun 2019, aug 2020, dec 2020
|
# E. Viennet, sep 2013, mar 2017, jun 2019, aug 2020, dec 2020
|
||||||
|
|
||||||
cd /opt/scodoc8 || { echo "Invalid directory"; exit 1; }
|
|
||||||
|
A REVOIR : utiliser releases
|
||||||
|
|
||||||
|
cd /opt/scodoc || { echo "Invalid directory"; exit 1; }
|
||||||
source config.sh
|
source config.sh
|
||||||
source utils.sh
|
source utils.sh
|
||||||
|
|
||||||
|
@ -72,10 +72,21 @@ check_create_scodoc_user() {
|
|||||||
|
|
||||||
# --- Give all ScoDoc files to user "scodoc":
|
# --- Give all ScoDoc files to user "scodoc":
|
||||||
change_scodoc_file_ownership() {
|
change_scodoc_file_ownership() {
|
||||||
echo "Changing owner of $SCODOC_DIR to ${SCODOC_USER}"
|
echo "Changing owner of ${SCODOC_DIR} to ${SCODOC_USER}"
|
||||||
chown -R "${SCODOC_USER}:${SCODOC_GROUP}" "$SCODOC_DIR"
|
chown -R "${SCODOC_USER}:${SCODOC_GROUP}" "${SCODOC_DIR}" || die "change_scodoc_file_ownership failed on ${SCODOC_DIR}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Création du répertoire local (scodoc-data) et vérification du propriétaire
|
||||||
|
set_scodoc_var_dir() {
|
||||||
|
echo "Checking $SCODOC_VAR_DIR..."
|
||||||
|
for d in archives photos tmp log config config/version config/depts config/logos
|
||||||
|
do
|
||||||
|
[ -d "$SCODOC_VAR_DIR/$d" ] || mkdir "$SCODOC_VAR_DIR/$d" || die "can't create $SCODOC_VAR_DIR/$d subdirectory"
|
||||||
|
done
|
||||||
|
chown -R "${SCODOC_USER}:${SCODOC_GROUP}" "${SCODOC_VAR_DIR}" || die "change_scodoc_file_ownership failed on ${SCODOC_VAR_DIR}"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# XXX inutilise
|
# XXX inutilise
|
||||||
gen_passwd() {
|
gen_passwd() {
|
||||||
PASSWORD_LENGTH="8"
|
PASSWORD_LENGTH="8"
|
||||||
|
Loading…
Reference in New Issue
Block a user