Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Poetry build system & normalise on Python 3.11 #2703 #2754 #2693 #2755

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,6 @@ rockstor-tasks-huey.db*
/src/rockstor/logs/error.tgz
# Rockstor docker
/conf/docker-daemon.json

# Poetry error logs
poetry-installer-error*
25 changes: 13 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,28 @@
set -o errexit

# Install Poetry, a dependency management, packaging, and build system.
# We currently require Python 3.6 compatibility which was last in v1.1.15.
# We use the official installer which installs to: ~/.local/share/pypoetry.
# The installer is python 3 only: https://python-poetry.org/docs/#installation
# N.B. there is no harm in re-running this installer.
# For first-install on Tumbleweed instances with Py3.11 as default:
# 1. uninstall vai: curl -sSL https://install.python-poetry.org | python3 - --uninstall
# 2. change 3 to 3.8 in the following:
curl -sSL https://install.python-poetry.org | POETRY_VERSION=1.1.15 python3 -
# Uninstall legacy/transitional Poetry version of 1.1.15
if which poetry && poetry --version | grep -q "1.1.15"; then
echo "Poetry version 1.1.15 found - UNINSTALLING"
curl -sSL https://install.python-poetry.org | python3 - --uninstall
fi
# Install Poetry via PIPX as a global app
# https://peps.python.org/pep-0668/#guide-users-towards-virtual-environments
export PIPX_HOME=/opt/pipx # virtual environment location, default ~/.local/pipx
export PIPX_BIN_DIR=/usr/local/bin # binary location for pipx-installed apps, default ~/.local/bin
python3.11 -m pipx install poetry==1.7.1

# Install project dependencies defined in cwd pyproject.toml using poetry.toml
# specific configuration, i.e. virtualenv in cwd/.venv
# /opt/rockstor/.venv
# poetry env remove --all # removes all venvs associated with a pyproject.toml
# rm -rf ~/.cache/pypoetry/virtualenvs/* # to delete default location venvs.
# ** --no-ansi avoids special characters **
PATH="$HOME/.local/bin:$PATH"
# Resolve Python 3.6 Poetry issue re char \u2022: (bullet)
# https://github.com/python-poetry/poetry/issues/3078
export LANG=C.UTF-8
export PYTHONIOENCODING=utf8
/root/.local/bin/poetry install --no-interaction --no-ansi > poetry-install.txt 2>&1
/usr/local/bin/poetry install --no-interaction --no-ansi > poetry-install.txt 2>&1
echo

# Add js libs. See: https://github.com/rockstor/rockstor-jslibs
Expand Down Expand Up @@ -60,12 +61,12 @@ fi
# Additional collectstatic options --clear --dry-run
export DJANGO_SETTINGS_MODULE=settings
# must be run in project root:
/root/.local/bin/poetry run django-admin collectstatic --no-input --verbosity 2
/usr/local/bin/poetry run django-admin collectstatic --no-input --verbosity 2
echo

echo "ROCKSTOR BUILD SCRIPT COMPLETED"
echo
echo "If installing from source, from scratch, for development:"
echo "If installing from source, from scratch, for development; i.e. NOT via RPM:"
echo "1. Run 'cd /opt/rockstor'."
echo "2. Run 'systemctl start postgresql'."
echo "3. Run 'export DJANGO_SETTINGS_MODULE=settings'."
Expand Down
2 changes: 1 addition & 1 deletion conf/rockstor-pre.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Requires=postgresql.service
[Service]
Environment="DJANGO_SETTINGS_MODULE=settings"
WorkingDirectory=/opt/rockstor
ExecStart=/root/.local/bin/poetry run initrock
ExecStart=/usr/local/bin/poetry run initrock
Type=oneshot
RemainAfterExit=yes

Expand Down
6 changes: 3 additions & 3 deletions conf/rockstor.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ Requires=rockstor-pre.service
[Service]
Environment="DJANGO_SETTINGS_MODULE=settings"
WorkingDirectory=/opt/rockstor
ExecStart=/root/.local/bin/poetry run supervisord -c /opt/rockstor/etc/supervisord.conf
ExecStop=/root/.local/bin/poetry run supervisorctl shutdown
ExecReload=/root/.local/bin/poetry run supervisorctl reload
ExecStart=/usr/local/bin/poetry run supervisord -c /opt/rockstor/etc/supervisord.conf
ExecStop=/usr/local/bin/poetry run supervisorctl shutdown
ExecReload=/usr/local/bin/poetry run supervisorctl reload
# Generally not recommended but used here to honour supervisord's remit re process management.
KillMode=process

Expand Down
Loading