1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mygpo_ynh.git synced 2024-09-03 19:55:52 +02:00

fix update

This commit is contained in:
Salamandar 2024-03-04 20:50:00 +01:00
parent 6890380a36
commit 24ca150702
6 changed files with 16 additions and 11 deletions

View file

@ -5,7 +5,7 @@ After=network.target postgresql.service redis.service __APP__.scoket
[Service] [Service]
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/source WorkingDirectory=__INSTALL_DIR__/sources/
ExecStart=__INSTALL_DIR__/venv/bin/envdir __INSTALL_DIR__/envs/prod __INSTALL_DIR__/venv/bin/celery -A __APP__ beat --pidfile /tmp/celerybeat.pid -S django ExecStart=__INSTALL_DIR__/venv/bin/envdir __INSTALL_DIR__/envs/prod __INSTALL_DIR__/venv/bin/celery -A __APP__ beat --pidfile /tmp/celerybeat.pid -S django
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID

View file

@ -5,7 +5,7 @@ After=network.target postgresql.service redis.service __APP__.socket
[Service] [Service]
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/source WorkingDirectory=__INSTALL_DIR__/sources/
ExecStart=__INSTALL_DIR__/venv/bin/envdir __INSTALL_DIR__/envs/prod __INSTALL_DIR__/venv/bin/celery -A __APP__ worker -l info -Ofair ExecStart=__INSTALL_DIR__/venv/bin/envdir __INSTALL_DIR__/envs/prod __INSTALL_DIR__/venv/bin/celery -A __APP__ worker -l info -Ofair
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID

View file

@ -7,9 +7,9 @@ Requires=__APP__.socket
Type=notify Type=notify
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=__INSTALL_DIR__/source/ WorkingDirectory=__INSTALL_DIR__/sources/
ExecStart=__INSTALL_DIR__/venv/bin/envdir __INSTALL_DIR__/envs/prod __INSTALL_DIR__/venv/bin/gunicorn -c __INSTALL_DIR__/source/conf/gunicorn.conf.py mygpo.wsgi:application --bind unix:/run/__APP__.sock ExecStart=__INSTALL_DIR__/venv/bin/envdir __INSTALL_DIR__/envs/prod __INSTALL_DIR__/venv/bin/gunicorn -c __INSTALL_DIR__/sources/conf/gunicorn.conf.py mygpo.wsgi:application --bind unix:/run/__APP__.sock
ExecReload=/bin/kill -s HUP $MAINPID ExecReload=/bin/kill -s HUP $MAINPID
Restart=on-failure Restart=on-failure
KillMode=mixed KillMode=mixed

View file

@ -27,14 +27,14 @@ function set_up_virtualenv {
ynh_exec_warn_less ynh_exec_as "$app" python3 -m venv "$install_dir/venv" ynh_exec_warn_less ynh_exec_as "$app" python3 -m venv "$install_dir/venv"
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U wheel pip --cache-dir "$install_dir/.cache/pip" setuptools ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U wheel pip --cache-dir "$install_dir/.cache/pip" setuptools
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U --requirement "$install_dir/source/requirements.txt" ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U --requirement "$install_dir/sources/requirements.txt"
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U --requirement "$install_dir/source/requirements-setup.txt" ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U --requirement "$install_dir/sources/requirements-setup.txt"
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U --requirement "$install_dir/requirements-ynh.txt" ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install -U --requirement "$install_dir/requirements-ynh.txt"
} }
function initialize_db { function initialize_db {
perform_db_migrations perform_db_migrations
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/envdir" "$env_path" "$install_dir/venv/bin/python" "$install_dir/source/manage.py" createsuperuser --username "$admin" --email "$admin_email" --noinput -v 0 ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/envdir" "$env_path" "$install_dir/venv/bin/python" "$install_dir/sources/manage.py" createsuperuser --username "$admin" --email "$admin_email" --noinput -v 0
} }
function upgrade_db { function upgrade_db {
@ -42,8 +42,8 @@ function upgrade_db {
} }
function perform_db_migrations { function perform_db_migrations {
yes | ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/envdir" "$env_path" "$install_dir/venv/bin/python" "$install_dir/source/manage.py" makemigrations --merge yes | ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/envdir" "$env_path" "$install_dir/venv/bin/python" "$install_dir/sources/manage.py" makemigrations --merge
ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/envdir" "$env_path" "$install_dir/venv/bin/python" "$install_dir/source/manage.py" migrate ynh_exec_warn_less ynh_exec_as "$app" "$install_dir/venv/bin/envdir" "$env_path" "$install_dir/venv/bin/python" "$install_dir/sources/manage.py" migrate
} }
#================================================= #=================================================

View file

@ -23,7 +23,7 @@ ynh_app_setting_set --app="$app" --key="secret_key" --value="$secret_key"
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/source" ynh_setup_source --dest_dir="$install_dir/sources"
#================================================= #=================================================
# APP INITIAL CONFIGURATION # APP INITIAL CONFIGURATION

View file

@ -45,13 +45,18 @@ if [[ -n "${random_key:-}" ]]; then
ynh_app_setting_set --app="$app" --key=secret_key --value="$random_key" ynh_app_setting_set --app="$app" --key=secret_key --value="$random_key"
fi fi
if [ -f "$install_dir/requirements.txt" ]; then
# Move to $install_dir/sources
find "$install_dir" -maxdepth 1 -mindepth 1 -not -name envs -exec rm -rf {} +
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/source" --full_replace=1 ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1
#================================================= #=================================================
# APP INITIAL CONFIGURATION # APP INITIAL CONFIGURATION