mirror of
https://github.com/YunoHost-Apps/fittrackee_ynh.git
synced 2024-09-03 18:36:16 +02:00
refactor virtualenv
This commit is contained in:
parent
0b20803ae7
commit
28e8b871dd
6 changed files with 31 additions and 40 deletions
|
@ -29,7 +29,7 @@ Environment="STATICMAP_SUBDOMAINS="
|
|||
Environment="MAP_ATTRIBUTION="
|
||||
Environment="WEATHER_API_KEY="
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/.venv/bin/gunicorn -b 127.0.0.1:__PORT__ "fittrackee:create_app()" --error-logfile /var/log/__APP__/gunicorn.log
|
||||
ExecStart=__INSTALL_DIR__/venv/bin/gunicorn -b 127.0.0.1:__PORT__ "fittrackee:create_app()" --error-logfile /var/log/__APP__/gunicorn.log
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ Environment="EMAIL_URL="
|
|||
Environment="SENDER_EMAIL="
|
||||
Environment="REDIS_URL="
|
||||
WorkingDirectory=__INSTALL_DIR__/
|
||||
ExecStart=__INSTALL_DIR__/.venv/bin/flask worker --processes 2
|
||||
ExecStart=__INSTALL_DIR__/venv/bin/flask worker --processes 2
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ ram.runtime = "50M"
|
|||
main.default = 5000
|
||||
|
||||
[resources.apt]
|
||||
packages = "postgresql, postgresql-contrib, python3-venv libopenjp2-7"
|
||||
packages = "postgresql, postgresql-contrib, python3-venv libopenjp2-7 python3-venv"
|
||||
|
||||
[resources.database]
|
||||
type = "postgresql"
|
||||
|
|
|
@ -23,16 +23,6 @@ touch /var/log/$app/${app}_workers.log
|
|||
touch /var/log/$app/gunicorn.log
|
||||
chown -R $app:www-data /var/log/$app/
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=23
|
||||
|
||||
ynh_exec_warn_less python3 -m pip install pipenv
|
||||
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
@ -49,29 +39,32 @@ ynh_script_progression --message="Setting up source files..." --weight=64
|
|||
ynh_add_config --template="../conf/.env.production" --destination="$install_dir/.env"
|
||||
chmod 600 $install_dir/.env
|
||||
|
||||
|
||||
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
|
||||
set -a; source "$install_dir/.env"; set +a
|
||||
|
||||
pushd $install_dir
|
||||
mkdir -p .venv
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install fittrackee==$fittrackee_version python-dotenv
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# INSTALL PYTHON DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Python dependencies..." --weight=3
|
||||
|
||||
pushd $install_dir
|
||||
python3 -m venv $install_dir/venv
|
||||
source $install_dir/venv/bin/activate
|
||||
ynh_exec_warn_less pip install fittrackee==$fittrackee_version
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# INITIALIZE DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Initializing database..." --weight=1
|
||||
|
||||
ynh_exec_warn_less $install_dir/.venv/bin/ftcli db upgrade
|
||||
ynh_exec_warn_less $install_dir/venv/bin/ftcli db upgrade
|
||||
|
||||
ynh_exec_warn_less $install_dir/.venv/bin/ftcli users create $admin --email $admin_mail --password $password
|
||||
ynh_exec_warn_less $install_dir/venv/bin/ftcli users create $admin --email $admin_mail --password $password
|
||||
|
||||
ynh_exec_warn_less $install_dir/.venv/bin/ftcli users update $admin --set-admin true
|
||||
ynh_exec_warn_less $install_dir/venv/bin/ftcli users update $admin --set-admin true
|
||||
|
||||
#=================================================
|
||||
# System Configuration
|
||||
|
|
|
@ -40,25 +40,11 @@ ynh_script_progression --message="Installing dependencies..." --weight=23
|
|||
|
||||
ynh_exec_warn_less python3 -m pip install pipenv
|
||||
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
|
||||
mkdir -p "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app: "$install_dir"
|
||||
|
||||
pushd $install_dir
|
||||
mkdir -p .venv
|
||||
PIPENV_VENV_IN_PROJECT="enabled" PIPENV_SKIP_LOCK=true ynh_exec_warn_less python3 -m pipenv install fittrackee==$fittrackee_version python-dotenv
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# CONFIGURE THEN INSTALL SCRIPT AND DEPENDENCIES
|
||||
# CONFIGURE THE INSTALL SCRIPT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing service script..." --weight=1
|
||||
|
||||
|
@ -68,12 +54,23 @@ chown $app: "$install_dir/.env"
|
|||
|
||||
set -a; source "$install_dir/.env"; set +a
|
||||
|
||||
#=================================================
|
||||
# INSTALL PYTHON DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing Python dependencies..." --weight=3
|
||||
|
||||
pushd $install_dir
|
||||
python3 -m venv $install_dir/venv
|
||||
source $install_dir/venv/bin/activate
|
||||
ynh_exec_warn_less pip install fittrackee==$fittrackee_version
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# Update DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading database..." --weight=1
|
||||
|
||||
ynh_exec_warn_less $install_dir/.venv/bin/ftcli db upgrade
|
||||
ynh_exec_warn_less $install_dir/venv/bin/ftcli db upgrade
|
||||
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -16,4 +16,5 @@ test_format = 1.0
|
|||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
test_upgrade_from.852bf0d.name = "Upgrade from 0.7.14"
|
||||
test_upgrade_from.852bf0d.name = "0.7.14"
|
||||
test_upgrade_from.0b20803.name = "0.7.17"
|
||||
|
|
Loading…
Reference in a new issue