Skip to content
Snippets Groups Projects
Commit 16a17567 authored by Jan Mach's avatar Jan Mach
Browse files

Debian package now installs Mentat into virtual environment.

(Redmine issue: #3387)
parent 81346647
No related branches found
No related tags found
No related merge requests found
......@@ -62,6 +62,7 @@ include Makefile.cfg
# Populate certain variables with appropriate default values.
#
BUILD_NUMBER ?= 0
BUILD_SUITE ?= 'development'
#===============================================================================
......@@ -574,7 +575,7 @@ build-package-deb: FORCE
mkdir -p debdist
cd packaging && fakeroot make -f debian/rules clean
cd packaging && fakeroot make -f debian/rules build
cd packaging && fakeroot make -f debian/rules binary BUILD_NUMBER=$(BUILD_NUMBER)
cd packaging && fakeroot make -f debian/rules binary BUILD_NUMBER=$(BUILD_NUMBER) BUILD_SUITE=$(BUILD_SUITE)
@echo ""
......
......@@ -7,7 +7,7 @@
# Use of this source is governed by the MIT license, see LICENSE file.
#-------------------------------------------------------------------------------
WSGIDaemonProcess hawat user=mentat group=mentat threads=5
WSGIDaemonProcess hawat user=mentat group=mentat threads=5 python-home=/var/mentat/venv
WSGIScriptAlias /mentat /usr/local/bin/mentat-hawat.wsgi
<Directory /usr/lib/python3/dist-packages/hawat>
......
......@@ -6,6 +6,7 @@
# Use of this source is governed by the MIT license, see LICENSE file.
#-------------------------------------------------------------------------------
MENTAT_VENV=/var/mentat/venv
MENTAT_IS_ENABLED=yes
MENTAT_USER=mentat
MENTAT_GROUP=mentat
......
......@@ -14,12 +14,45 @@ if ! getent passwd mentat > /dev/null 2>&1; then
adduser --quiet --system --home /var/mentat/spool --no-create-home --disabled-login --group mentat
fi
if ! [ -d /var/mentat/venv ]; then
python3 -m venv /var/mentat/venv
if ! [ -d "${MENTAT_VENV}" ]; then
python3 -m venv "${MENTAT_VENV}"
fi
# Install all project requirements into prepared virtual environment.
/var/mentat/venv/bin/pip install -r /etc/mentat/requirements.pip
${MENTAT_VENV}/bin/pip install -r /etc/mentat/requirements.pip
# Install Mentat system itself.
${MENTAT_VENV}/bin/pip install -r /etc/mentat/install.pip
mentat_bin_list=(
hawat-cli
mentat-backup.py
mentat-cleanup.py
mentat-controller.py
mentat-dbmngr.py
mentat-enricher.py
mentat-hawat.py
mentat-hawat.wsgi
mentat-ideagen.py
mentat-informant.py
mentat-inspector.py
mentat-netmngr.py
mentat-precache.py
mentat-reporter.py
mentat-sampler.py
mentat-statistician.py
mentat-storage.py
)
for b in "${mentat_bin_list[@]}"
do
if [ -f "/usr/local/bin/${b}" ]; then
rm -f "/usr/local/bin/${b}"
fi
if [ ! -L "/usr/local/bin/${b}" ]; then
ln -s "${MENTAT_VENV}/bin/${b}" "/usr/local/bin/${b}"
fi
done
# Make sure required directory structure exists and has proper permissions
mentat_dir_list=(
......
......@@ -2,6 +2,7 @@
PROJECT_VERSION = $(shell python -c "import mentat; print(mentat.__version__);")
BUILD_SUITE ?= 'development'
BUILD_NUMBER ?= 0
PACKAGE_VERSION ?= "$(PROJECT_VERSION).$(BUILD_NUMBER)"
......@@ -24,6 +25,16 @@ binary:
cp -r ../etc/init.d debian/mentat-ng/etc/
cp -r ../etc/systemd debian/mentat-ng/etc/
ifeq ($(BUILD_SUITE),production)
echo "mentat-ng" > debian/mentat-ng/etc/mentat/install.pip
endif
ifeq ($(BUILD_SUITE),release)
echo "--index-url https://alchemist.cesnet.cz/mentat/files/release/\nmentat-ng" > debian/mentat-ng/etc/mentat/install.pip
endif
ifeq ($(BUILD_SUITE),development)
echo "--index-url https://alchemist.cesnet.cz/mentat/files/development/\nmentat-ng" > debian/mentat-ng/etc/mentat/install.pip
endif
dh_installdeb
dh_installdocs
dh_installchangelogs
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment