Skip to content

Commit 4d1a9e9

Browse files
committed
deploy script updates for Django 4.2 update
1 parent 00f6e4f commit 4d1a9e9

File tree

2 files changed

+30
-7
lines changed

2 files changed

+30
-7
lines changed

deploy.sh

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# See COPYRIGHT.txt, AUTHORS.txt, and LICENSE.txt in the project root directory.
44

55
# Upgrade/Deployment for Roundware Server (http://www.roundware.org/)
6-
# Tested with Ubuntu 14.04 LTS 64 bit
6+
# Updated for Python 3.11 and Django 4.2 compatibility
77
#
88
# Use this to update production code.
99

@@ -34,37 +34,60 @@ cp $SOURCE_PATH/files/home-user-profile /home/$USERNAME/.profile
3434
# Set paths/directories
3535
WWW_PATH="/var/www/roundware"
3636
CODE_PATH="$WWW_PATH/source"
37-
VENV_PATH="$WWW_PATH"
37+
VENV_PATH="/var/www/roundware-venv" # Updated: venv outside code directory
3838

3939
# Install/Update the production code
4040
# TODO: Better deployment method.
4141
rm -rf $CODE_PATH
4242
mkdir -p $CODE_PATH
4343
cp -R $SOURCE_PATH/. $CODE_PATH
4444

45+
# Create or recreate virtual environment with Python 3.11
46+
if [ -d "$VENV_PATH" ]; then
47+
echo "Removing existing virtual environment..."
48+
rm -rf $VENV_PATH
49+
fi
50+
51+
echo "Creating new virtual environment with Python 3.11..."
52+
python3.11 -m venv $VENV_PATH
53+
4554
# Activate the environment
4655
source $VENV_PATH/bin/activate
4756

57+
# Verify Python version
58+
python --version
59+
4860
# Set python path to use production code
4961
export PYTHONPATH=$CODE_PATH
5062

5163
# Install upgrade pip
5264
python -m pip install -U pip wheel setuptools
5365

54-
# Install Roundware requirements
55-
python -m pip install -r $CODE_PATH/requirements.txt --upgrade
66+
# Install Roundware requirements (updated path)
67+
if [ -f "$CODE_PATH/requirements/common.txt" ]; then
68+
echo "Installing from requirements/common.txt..."
69+
python -m pip install -r $CODE_PATH/requirements/common.txt --upgrade
70+
elif [ -f "$CODE_PATH/requirements.txt" ]; then
71+
echo "Installing from requirements.txt..."
72+
python -m pip install -r $CODE_PATH/requirements.txt --upgrade
73+
else
74+
echo "Error: No requirements file found!"
75+
exit 1
76+
fi
77+
5678
if [ $ROUNDWARE_DEV ]; then
5779
python -m pip install -r $CODE_PATH/requirements/dev.txt --upgrade
5880
fi
5981

6082
# Set $USERNAME to own WWW_PATH files
6183
chown $USERNAME:$USERNAME -R $WWW_PATH
84+
chown $USERNAME:$USERNAME -R $VENV_PATH
6285

6386
# Run database migrations
64-
su - $USERNAME -c "$CODE_PATH/roundware/manage.py migrate --noinput"
87+
su - $USERNAME -c "$VENV_PATH/bin/python $CODE_PATH/roundware/manage.py migrate --noinput"
6588

6689
# Collect static files for production
67-
su - $USERNAME -c "$CODE_PATH/roundware/manage.py collectstatic --noinput"
90+
su - $USERNAME -c "$VENV_PATH/bin/python $CODE_PATH/roundware/manage.py collectstatic --noinput"
6891

6992
systemctl restart apache2
7093

files/etc-apache2-sites-available-roundware

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
CustomLog /var/log/apache2/access.log combined
3535

36-
WSGIDaemonProcess roundware user=USERNAME group=USERNAME umask=002 python-home=/var/www/roundware
36+
WSGIDaemonProcess roundware user=USERNAME group=USERNAME umask=002 python-home=/var/www/roundware-venv
3737
WSGIApplicationGroup %{GLOBAL}
3838
WSGIProcessGroup roundware
3939
WSGIScriptAlias / /var/www/roundware/source/roundware/wsgi.py

0 commit comments

Comments
 (0)