1
0
forked from ScoDoc/ScoDoc

install script for ScoDoc8 development

This commit is contained in:
Emmanuel Viennet 2021-07-23 10:32:20 +03:00
parent c0f3bdedcd
commit 3c943b21b2
5 changed files with 87 additions and 134 deletions

View File

@ -1,61 +1,34 @@
alembic==1.6.5 asn1crypto==0.24.0
astroid==2.6.2 certifi==2018.8.24
Babel==2.9.1 chardet==3.0.4
blinker==1.4 configparser==3.5.0b2
certifi==2021.5.30 cracklib==2.9.6
chardet==4.0.0 cryptography==2.6.1
click==8.0.1 docutils==0.14
cracklib==2.9.3 entrypoints==0.3
dnspython==2.1.0 enum34==1.1.6
dominate==2.6.0 gyp==0.1
email-validator==1.1.3 icalendar==4.0.3
Flask==2.0.1 idna==2.6
Flask-Babel==2.0.0 ipaddress==1.0.17
Flask-Bootstrap==3.3.7.1 jaxml==3.1
Flask-Caching==1.10.1 keyring==17.1.1
Flask-Login==0.5.0 keyrings.alt==3.1.1
Flask-Mail==0.9.1 olefile==0.46
Flask-Migrate==3.0.1 Pillow==5.4.1
Flask-Moment==1.0.1 psycopg2==2.7.7
Flask-SQLAlchemy==2.5.1 pycrypto==2.6.1
Flask-WTF==0.15.1 Pygments==2.3.1
greenlet==1.1.0 PyGObject==3.30.4
html2text==2020.1.16 pyOpenSSL==19.0.0
icalendar==4.0.7
idna==2.10
importlib-metadata==4.6.1
isort==5.9.2
itsdangerous==2.0.1
Jinja2==3.0.1
lazy-object-proxy==1.6.0
Mako==1.1.4
MarkupSafe==2.0.1
mccabe==0.6.1
Pillow==8.3.1
pkg-resources==0.0.0
psycopg2==2.9.1
pydot==1.4.2
PyJWT==2.1.0
pylibmc==1.6.1
pylint==2.9.3
pylint-flask-sqlalchemy==0.2.0
pymemcache==3.5.0
pyparsing==2.4.7
PyRSS2Gen==1.1 PyRSS2Gen==1.1
python-dateutil==2.8.1 python-dateutil==2.7.3
python-dotenv==0.18.0 pytz==2019.1
python-editor==1.0.4 pyxdg==0.25
pytz==2021.1 reportlab==3.5.13
reportlab==3.5.68 requests==2.21.0
requests==2.25.1 roman==2.0.0
six==1.16.0 SecretStorage==2.3.1
SQLAlchemy==1.4.20 six==1.12.0
toml==0.10.2 urllib3==1.24.1
typed-ast==1.4.3 virtualenv==15.1.0
typing-extensions==3.10.0.0
urllib3==1.26.6
visitor==0.1.3
Werkzeug==2.0.1
wrapt==1.12.1
WTForms==2.3.3
zipp==3.5.0

View File

@ -44,7 +44,12 @@ else
fi fi
export PSQL export PSQL
# tcp port for SQL server (under Debian 4, 5432 or 5433 for 8.1 if 7.4 also installed !) # tcp port for SQL server
# Important note: if changed, you should probably also change it in # Important note: if changed, you should probably also change it in
# sco_utils.py (SCO_DEFAULT_SQL_PORT). # sco_utils.py (SCO_DEFAULT_SQL_PORT).
export POSTGRES_PORT=5432 export POSTGRES_PORT=5432
# ---
echo "SCODOC_USER=$SCODOC_USER"
echo "SCODOC_DIR=$SCODOC_DIR"
echo "SCODOC_VAR_DIR=$SCODOC_VAR_DIR"

View File

@ -1,11 +1,11 @@
#!/bin/bash #!/bin/bash
# #
# ScoDoc: install third-party software necessary for our installation # ScoDoc 8: install third-party software necessary for our installation
# starting for a minimal Debian (Buster, 10.0) install. # starting for a minimal Debian (Buster, 10.0) install.
# #
# E. Viennet, Jun 2008, Apr 2009, Sept 2011, Sept 2013, Nov 2013, Mar 2017, Jul 2017, # E. Viennet, Jun 2008, Apr 2009, Sept 2011, Sept 2013, Nov 2013, Mar 2017, Jul 2017,
# Jun 2019, Oct 2019, Dec 2020 # Jun 2019, Oct 2019, Dec 2020, Jul 2021
# #
source config.sh source config.sh
@ -27,65 +27,27 @@ then
fi fi
# ------------ Permissions & directories # ------------ Permissions & directories
chown -R "$SCODOC_USER"."$SCODOC_GROUP" "${SCODOC_DIR}" change_scodoc_file_ownership
# ------------ AJOUT DES PAQUETS DEBIAN NECESSAIRES
# ------------ LOCALES
echo
echo '---- Configuration des locales...'
echo
if [ ! -e /etc/locale.gen ]
then
touch /etc/locale.gen
fi
for locname in en_US.UTF-8 en_US.ISO-8859-15 en_US.ISO-8859-1
do
outname=$(echo ${locname//-/} | tr 'A-Z' 'a-z')
if [ "$(locale -a | grep -E -i ^${outname}$ | wc -l)" -lt 1 ]
then
echo adding $locname
echo "$locname ${locname##*.}" >> /etc/locale.gen
fi
done
/usr/sbin/locale-gen --keep-existing
# Voir si encore nécessaire avec ScoDoc8: ?
if [ "$LANG" != "en_US.UTF-8" ]
then
# ceci est necessaire a cause de postgresql 8.3 qui
# cree son cluster lors de l'install avec la locale par defaut !
echo "Attention: changement de la locale par defaut"
mv /etc/default/locale /etc/default/locale.orig
echo "LANG=\"en_US.UTF-8\"" > /etc/default/locale
export LANG=en_US.UTF-8
fi
echo 'Done.'
# ------------ AJOUT DES PAQUETS NECESSAIRES
apt-get update apt-get update
apt-get -y install subversion curl cracklib-runtime apt-get -y install python3-dev
apt-get -y install apache2 ssl-cert apt-get -y install python3-venv
apt-get -y install libpq-dev
apt-get -y install libcrack2-dev
apt-get -y install postgresql apt-get -y install postgresql
apt-get -y install curl
apt-get -y install graphviz apt-get -y install graphviz
# ------------ INSTALL DES EXTENSIONS PYTHON (2.7) # ------------ INSTALL DES PAQUETS PYTHON (3.7)
# ScoDoc8 uses pip in our env # ScoDoc8 uses pip in our env
apt-get -y install python-docutils source venv/bin/activate
apt-get -y install python-psycopg2 pip install wheel
apt-get -y install python-pyrss2gen pip install -r requirements-3.7.txt
apt-get -y install python-pil python-reportlab
apt-get -y install python-cracklib # was python-crack
apt-get -y install python-icalendar
apt-get -y install python-requests
# ------------ # ------------
SVNVERSION=$(cd ..; svnversion) GITCOMMIT=$(git rev-parse HEAD)
SVERSION=$(curl --silent http://scodoc.iutv.univ-paris13.fr/scodoc-installmgr/version?mode=install\&svn="$SVNVERSION") SVERSION=$(curl --silent http://scodoc.iutv.univ-paris13.fr/scodoc-installmgr/version?mode=install\&commit="$GITCOMMIT")
echo "$SVERSION" > "${SCODOC_VERSION_DIR}/scodoc.sn" echo "$SVERSION" > "${SCODOC_VERSION_DIR}/scodoc.sn"
@ -116,10 +78,19 @@ then
yes | ufw enable yes | ufw enable
fi fi
# --- XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ---
echo
echo "WARNING: version ScoDoc8 expérimentale"
echo "Ne pas utiliser en production !"
echo
echo "Pour lancer le serveur de développement: voir README"
exit 0
# --- XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX XXX ---
# Nota: after this point, the network _may_ be unreachable # Nota: after this point, the network _may_ be unreachable
# (if firewall config is wrong) # (if firewall config is wrong)
# ------------ CONFIG APACHE # ------------ CONFIG NGINX
a2enmod ssl a2enmod ssl
a2enmod proxy a2enmod proxy
a2enmod proxy_http a2enmod proxy_http

View File

@ -29,25 +29,10 @@ check_uid_root
SCODOC7_HOME="/opt/scodoc" SCODOC7_HOME="/opt/scodoc"
SCODOC7_DIR="${SCODOC7_HOME}/Products/ScoDoc" SCODOC7_DIR="${SCODOC7_HOME}/Products/ScoDoc"
# --- 1. Utilisateur UNIX
migrate_unix_user() {
if [ $(id -u "${SCODOC_USER}" &> /dev/null) ]
then
echo "Unix user ${SCODOC_USER} exists"
else
echo "Creating unix user ${SCODOC_USER}"
adduser --no-create-home --shell /bin/bash --gecos "ScoDoc service" ${SCODOC_USER} || die "failed to create user"
fi
}
migrate_file_ownership() {
echo "Changing owner of $SCODOC_DIR to ${SCODOC_USER}"
chown -R "${SCODOC_USER}:${SCODOC_GROUP}" "$SCODOC_DIR"
}
# --- 2. Propriétaire des bases de données # --- 2. Propriétaire des bases de données
# Bases appartenant à www-data: # Bases appartenant à www-data:
migrate_databse_ownsership() { migrate_database_ownership() {
SCO7_BASES=$(su -c "psql -l -t | grep www-data" "$POSTGRES_SUPERUSER" | awk -F '|' '{print $1}') SCO7_BASES=$(su -c "psql -l -t | grep www-data" "$POSTGRES_SUPERUSER" | awk -F '|' '{print $1}')
for base in $SCO7_BASES for base in $SCO7_BASES
do do
@ -74,22 +59,25 @@ migrate_local_files() {
# ------ MAIN # ------ MAIN
migrate_unix_user check_create_scodoc_user
echo
echo -n "Changer si nécessaire le propriétaire des fichiers de $SCODOC_DIR ? (y/n) [y] " echo -n "Changer si nécessaire le propriétaire des fichiers de $SCODOC_DIR ? (y/n) [y] "
read -r ans read -r ans
if [ "$(norm_ans "$ans")" != 'N' ] if [ "$(norm_ans "$ans")" != 'N' ]
then then
migrate_file_ownership change_scodoc_file_ownership
fi fi
echo
echo -n "Changer si nécessaire le propriétaire des bases de données SQL ? (y/n) [y] " echo -n "Changer si nécessaire le propriétaire des bases de données SQL ? (y/n) [y] "
read -r ans read -r ans
if [ "$(norm_ans "$ans")" != 'N' ] if [ "$(norm_ans "$ans")" != 'N' ]
then then
migrate_databse_ownsership migrate_database_ownership
fi fi
echo
echo "Les fichiers locaux de ScoDoc (configuration, photos, procès-verbaux...)" echo "Les fichiers locaux de ScoDoc (configuration, photos, procès-verbaux...)"
echo "sont maintenant stockées dans $SCODOC_VAR_DIR" echo "sont maintenant stockées dans $SCODOC_VAR_DIR"
echo -n "Copier les fichiers locaux de ScoDoc7 ? (y/n) [y] " echo -n "Copier les fichiers locaux de ScoDoc7 ? (y/n) [y] "

View File

@ -59,6 +59,22 @@ init_postgres_user() { # run as root
fi fi
} }
# --- Ensure Unix user "scodoc" exists
check_create_scodoc_user() {
if [ $(id -u "${SCODOC_USER}" &> /dev/null) ]
then
echo "Creating unix user ${SCODOC_USER}"
adduser --no-create-home --shell /bin/bash --gecos "ScoDoc service" ${SCODOC_USER} || die "failed to create user"
else
echo "Unix user ${SCODOC_USER} exists"
fi
}
# --- Give all ScoDoc files to user "scodoc":
change_scodoc_file_ownership() {
echo "Changing owner of $SCODOC_DIR to ${SCODOC_USER}"
chown -R "${SCODOC_USER}:${SCODOC_GROUP}" "$SCODOC_DIR"
}
# XXX inutilise # XXX inutilise
gen_passwd() { gen_passwd() {