1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/ihatemoney_ynh.git synced 2024-09-03 19:26:15 +02:00
ihatemoney_ynh/scripts/_common.sh
2021-06-26 23:10:27 +02:00

62 lines
1.9 KiB
Bash

#=================================================
# COMMON VARIABLES
#=================================================
# dependencies used by the app
pkg_dependencies="python3-dev python3-virtualenv libffi-dev libssl-dev supervisor virtualenv"
### Constants
supervisor_conf_path="/etc/supervisor/conf.d/ihatemoney.conf"
gunicorn_conf_path="/etc/ihatemoney/gunicorn.conf.py"
ihatemoney_conf_path="/etc/ihatemoney/ihatemoney.cfg"
INSTALL_DIR="/opt/yunohost/ihatemoney"
create_system_dirs() {
install -o ihatemoney -g ihatemoney -m 755 -d \
/var/log/ihatemoney \
/etc/ihatemoney
mkdir -p /opt/yunohost
}
init_virtualenv () {
virtualenv /opt/yunohost/ihatemoney/venv --python /usr/bin/python3
# PyMySQL → cryptography → setuptools>=18.5
# Required on Jessie, Stretch has setuptools>=18.5
/opt/yunohost/ihatemoney/venv/bin/pip install 'setuptools>=18.5'
}
pip_install () {
# SQLAlchemy requirement is workaround https://github.com/pallets/flask-sqlalchemy/issues/910
# Might be removed later when IHM dependency set will no longer prevent working installation.
/opt/yunohost/ihatemoney/venv/bin/pip install --upgrade \
'gunicorn>=19.3.0' \
'PyMySQL>=0.9,<0.10' \
'ihatemoney>=4,<5' \
'SQLAlchemy<1.4' \
}
configure_nginx () {
local domain=$1
local path=$2
local python_version="$(readlink /usr/bin/python3|sed s/.*python//)"
ynh_replace_string "PATHTOCHANGE" "$path" ../conf/nginx.conf
ynh_replace_string "PYTHON_VERSION" "$python_version" ../conf/nginx.conf
# Fix double-slash for domain-root install
ynh_replace_string "location //" "location /" ../conf/nginx.conf
install -o root -g root -m644 \
../conf/nginx.conf /etc/nginx/conf.d/$domain.d/ihatemoney.conf
}
configure_supervisor () {
install -o root -g root -m 644 \
../conf/supervisord.conf /etc/supervisor/conf.d/ihatemoney.conf
}