2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 16:51:54 +00:00
This commit is contained in:
Philip Sargent 2022-10-27 17:23:41 +01:00
parent 73e57a19df
commit 5b3f91d3e5
4 changed files with 66 additions and 71 deletions

15
requirements-p10d5.txt Normal file
View File

@ -0,0 +1,15 @@
asgiref==3.5.2
confusable-homoglyphs==3.2.0
coverage==6.4
Django==3.2
docutils==0.18
mariadb==1.0.11
mysql-connector-python==8.0.29
mysqlclient==2.1.0
Pillow==9.2.0
protobuf==4.21.2
pytz==2022.5
reportlab==3.6.0
sqlparse==0.4.0
typing_extensions==4.2.0
Unidecode==1.3.6

15
requirements-p3.10.txt Normal file
View File

@ -0,0 +1,15 @@
asgiref==3.5.2
confusable-homoglyphs==3.2.0
coverage==6.4
Django==3.2
docutils==0.18
mariadb==1.0.11
mysql-connector-python==8.0.29
mysqlclient==2.1.0
Pillow==9.2.0
protobuf==4.21.2
pytz==2022.5
reportlab==3.6.0
sqlparse==0.4.0
typing_extensions==4.2.0
Unidecode==1.3.6

View File

@ -0,0 +1,15 @@
asgiref==3.5.2
confusable-homoglyphs==3.2.0
coverage==6.4
Django==3.2
docutils==0.18
mariadb==1.0.11
mysql-connector-python==8.0.29
mysqlclient==2.1.0
Pillow==9.2.0
protobuf==4.21.2
pytz==2022.5
reportlab==3.6.0
sqlparse==0.4.0
typing_extensions==4.2.0
Unidecode==1.3.6

View File

@ -4,42 +4,16 @@
echo '-- Run this in a terminal in the troggle directory: "bash venv-trog.sh"' echo '-- Run this in a terminal in the troggle directory: "bash venv-trog.sh"'
# Expects an Ubuntu 22.04 relatively clean install. # Expects an Ubuntu 22.04 relatively clean install.
# Running using SQLite version 3.37.2 2022-01-06 13:25:41
# Many permissions conflicts under WSL2 mean more sudo needed
# If you have not already installed these on your clean Ubuntu install DO THIS FIRST # If you have not already installed these on your clean Ubuntu install DO THIS FIRST
# use the script os-trog.sh # use the script os-trog.sh
# which does the following:
# python --version : ensure python is an alias for python3 not python2.7
# sudo apt install sqlite3
# sudo apt install python3-pip # this installs a shed-load of other stuff: binutils etc.
# sudo apt install python3.10
# sudo apt install python3.10-venv
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
# on WSL there is an oddity that creating a venv trips over a PowerShell permissions issue
# and of course:
# sudo apt update
# sudo apt dist-upgrade
# On a clean debian 11 (bullseye) installation with Xfce & ssh,
# as debian does not install everything that ubuntu does, you need:
# sudo usermod -a -G sudo expo # to put expo in sudoers group, re-login required
# sudo apt install python3.10
# sudo apt install python3.10-pip
# sudo apt install python3.10-venv
# sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
#
# NOW we set up troggle # NOW we set up troggle
# copy this file and requirements.txt into the directory above where you want to install the VENV VENAME=p10d5 # python3.10 and django 3.2
VENAME=zp310d3 # python3.10 and django 3.2 echo "** You are logged in as `id -u -n`"
echo "The 50MB pip cache will be in /home/`id -u -n`/.cache/"
echo "-- Script executed from: ${PWD}" echo "The 150MB venv will created in /home/`id -u -n`/$VENAME/"
TROGDIR=$(cd $(dirname $0) && pwd) TROGDIR=$(cd $(dirname $0) && pwd)
sudo echo "-- Troggle folder (this script location): ${TROGDIR}" echo "-- Troggle folder (this script location): ${TROGDIR}"
if [ -d requirements.txt ]; then if [ -d requirements.txt ]; then
echo "-- No requirements.txt found. Copy it from your most recent installation." echo "-- No requirements.txt found. Copy it from your most recent installation."
@ -53,22 +27,7 @@ python --version
echo Creating links from Linux filesystem user echo Creating links from Linux filesystem user
# These links only need making once, for many venv # These links only need making once, for many venv
cd ~ cd ~
# cd ..
# mkdir expo
# cd expo
# ln -s ${TROGDIR}../$VENAME $VENAME
if [ -d troggle ]; then
echo "-- No /troggle/ found. Creating links."
ln -s ${TROGDIR} troggle
ln -s ${TROGDIR}/../expoweb expoweb
ln -s ${TROGDIR}/../loser loser
ln -s ${TROGDIR}/../drawings drawings
ln -s ${TROGDIR}/../expofiles expofiles
fi
# LOOK HERE: we go up a level so that /$VENAME is parallel to /troggle
#cd ..
if [ ! -d $VENAME ]; then if [ ! -d $VENAME ]; then
echo "## Creating venv $VENAME. (If this fails with a pip error, you need to use a Ubuntu window)" echo "## Creating venv $VENAME. (If this fails with a pip error, you need to use a Ubuntu window)"
python -m venv $VENAME python -m venv $VENAME
@ -77,10 +36,6 @@ else
exit 1 exit 1
fi fi
# seems to create infinite loop for tests
# echo "-- Make link from EXPO folder to venv $VENAME"
# sudo ln -s $VENAME ${TROGDIR}/../$VENAME
# Activate the virtual env and see what the default packages are # Activate the virtual env and see what the default packages are
echo "### Activating $VENAME" echo "### Activating $VENAME"
@ -91,9 +46,7 @@ echo "### Activated."
# update local version of pip, more recent than OS version # update local version of pip, more recent than OS version
# debian bullseye installs pip 20.3.4 which barfs, we want >22.0.3 # debian bullseye installs pip 20.3.4 which barfs, we want >22.0.3
#This fails when using python3.10 (which has installed pip 22.0.2) and is attempting to upgrade to 22.3 # update local version of setuptools, more recent than OS version, needed for packages without wheels
# WARNING: No metadata found in ./lib/python3.10/site-packages
# and then the rollback fails to roll back successfully.
echo "### installing later version of pip inside $VENAME" echo "### installing later version of pip inside $VENAME"
python -m pip install --upgrade pip python -m pip install --upgrade pip
@ -104,32 +57,25 @@ PIP=pip
$PIP list > original-pip.list $PIP list > original-pip.list
$PIP freeze >original.txt $PIP freeze >original.txt
# we are in /home/$USER/$VENAME/
ln -s ${TROGDIR} troggle ln -s ${TROGDIR} troggle
ln -s ${TROGDIR}/../expoweb expoweb ln -s ${TROGDIR}/../expoweb expoweb
ln -s ${TROGDIR}/../loser loser ln -s ${TROGDIR}/../loser loser
ln -s ${TROGDIR}/../drawings drawings ln -s ${TROGDIR}/../drawings drawings
ln -s ${TROGDIR}/../expofiles expofiles ln -s ${TROGDIR}/../expofiles expofiles
echo "### links to expoweb, troggle etc. complete"
# Package Version echo "###"
# ------------- ---------- echo "### now installing ${TROGDIR}/requirements.txt"
echo '### links to expoweb, troggle etc. complete' echo "###"
echo '###'
echo '### now installing ${TROGDIR}/requirements.txt'
echo '###'
$PIP install -r ${TROGDIR}/requirements.txt $PIP install -r ${TROGDIR}/requirements.txt
echo '### install from requirements.txt completed.' echo '### install from requirements.txt completed.'
echo '### ' echo '### '
$PIP freeze > requirements.txt $PIP freeze > requirements.txt
# so that we can track requirements more easily with git # so that we can track requirements more easily with git
# because we do not install these with pip, but they are listed by the freeze command # because we do not install these with pip, but they are listed by the freeze command
# Now find out what we actually installed by subtracting the stuff venv installed anyway
# Now find out what we actually installed by subtracting the stuff virtualenv installed anyway
sort original.txt > 1 sort original.txt > 1
sort requirements.txt >2 sort requirements.txt >2
comm -3 1 2 --check-order | awk '{ print $1}'>fresh-requirements.txt comm -3 1 2 --check-order | awk '{ print $1}'>fresh-requirements.txt
@ -159,12 +105,16 @@ python --version
echo "Django version:`django-admin --version`" echo "Django version:`django-admin --version`"
echo "### Now do echo "### Now do
'sudo service mysql start' '[sudo service mysql start]'
'sudo service mariadb restart' '[sudo service mariadb restart]'
'sudo mysql_secure_installation' '[sudo mysql_secure_installation]'
'cd ~/$VENAME' 'cd ~/$VENAME'
'source bin/activate' 'source bin/activate'
'cd troggle' 'cd troggle'
'django-admin check'
'python manage.py check' 'python manage.py check'
'python manage.py test -v 2'
'./pre-run.sh' './pre-run.sh'
'python manage.py test -v 3' " 'python databaseReset.py reset $VENAME'
'python manage.py runserver 0.0.0.0:8000 (and allow access when the firewall window pops up)'
"