From d78c23959171f64d7cca2aa40f65b9b2aa1747aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:04:58 +0200 Subject: [PATCH 01/11] cleaning --- manifest.toml | 14 +++++++------- scripts/_common.sh | 2 +- scripts/backup | 6 ------ scripts/change_url | 8 ++++---- scripts/install | 9 +-------- scripts/restore | 10 ---------- scripts/upgrade | 5 +++-- 7 files changed, 16 insertions(+), 38 deletions(-) diff --git a/manifest.toml b/manifest.toml index c65240a..b708da6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -4,10 +4,10 @@ packaging_format = 2 id = "tandoor" name = "Tandoor" -description.en = "Application for managing and sharing recipes, planning meals, building shopping lists and much much more!" -description.fr = "Gérez et partagez vos recettes, planifiez vos repas, créez vos listes de courses et beaucoup plus encore !" +description.en = "Manage and share recipes, plan meals, build shopping lists" +description.fr = "Gérez et partagez des recettes, planifiez des repas, créez des listes de courses" -version = "1.5.18~ynh1" +version = "1.5.18~ynh2" maintainers = ["Navan Chauhan"] @@ -21,14 +21,14 @@ code = "https://github.com/TandoorRecipes/recipes" cpe = "cpe:2.3:a:tandoor:recipes" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.20" architectures = "all" multi_instance = true ldap = false sso = false -disk = "50M" -ram.build = "50M" -ram.runtime = "50M" +disk = "1000M" +ram.build = "2000M" +ram.runtime = "1500M" [install] [install.domain] diff --git a/scripts/_common.sh b/scripts/_common.sh index 02ac495..57695b7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,8 +6,8 @@ nodejs_version=16 -# Used in .env timezone="$(cat /etc/timezone)" +version=$(ynh_app_upstream_version) #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 866f7ac..34ea8d1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -44,12 +44,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf" ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -ynh_backup --src_path="/var/log/$app/" - #================================================= # BACKUP THE PostgreSQL DATABASE #================================================= diff --git a/scripts/change_url b/scripts/change_url index 4988f8a..80493ed 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_change_url_nginx_config @@ -40,7 +40,7 @@ chown "$app:$app" "$install_dir/.env" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" @@ -48,4 +48,4 @@ ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$ # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 8453120..4492aa7 100755 --- a/scripts/install +++ b/scripts/install @@ -40,14 +40,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/source" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" -chown -R "$app:www-data" "$data_dir" - #================================================= # ADD A CONFIGURATION #================================================= @@ -58,9 +52,8 @@ ynh_add_config --template="dot_env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown "$app:$app" "$install_dir/.env" -version=$(ynh_app_upstream_version) - ynh_add_config --template="version.py" --destination="$install_dir/source/recipes/version.py" + chmod 400 "$install_dir/source/recipes/version.py" chown "$app:$app" "$install_dir/source/recipes/version.py" diff --git a/scripts/restore b/scripts/restore index 1ed1148..fdfe5bd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -17,8 +17,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= @@ -28,8 +26,6 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_restore_file --origin_path="$data_dir" --not_mandatory -chmod 750 "$data_dir" -chmod -R o-rwx "$data_dir" chown -R "$app:www-data" "$data_dir" #================================================= @@ -52,12 +48,6 @@ yunohost service add "$app" --description="Smart recipe management" --log="/var/ ynh_restore_file --origin_path="/etc/logrotate.d/$app" -#================================================= -# RESTORE VARIOUS FILES -#================================================= - -ynh_restore_file --origin_path="/var/log/$app/" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 597450e..cf82f9d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,9 +47,8 @@ ynh_add_config --template="dot_env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown "$app:$app" "$install_dir/.env" -version=$(ynh_app_upstream_version) - ynh_add_config --template="version.py" --destination="$install_dir/source/recipes/version.py" + chmod 400 "$install_dir/source/recipes/version.py" chown "$app:$app" "$install_dir/source/recipes/version.py" @@ -57,9 +56,11 @@ chown "$app:$app" "$install_dir/source/recipes/version.py" # SPECIFIC SETUP #================================================= ynh_script_progression --message="Building frontend..." --weight=5 + _tandoor_build_frontend ynh_script_progression --message="Installing Tandoor and its python dependencies..." --weight=1 + _tandoor_venv_install ynh_script_progression --message="Running migrations and generating static files..." --weight=2 From fd371c47cfc6b440128eaffba047bce47782db08 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 22 Jul 2024 09:05:04 +0000 Subject: [PATCH 02/11] Auto-update READMEs --- README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_id.md | 2 +- README_zh_Hans.md | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 22bd820..af80222 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ a public page. - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - ➕ Many more like recipe scaling, image compression, printing views and supermarkets -**Shipped version:** 1.5.18~ynh1 +**Shipped version:** 1.5.18~ynh2 **Demo:** diff --git a/README_es.md b/README_es.md index 090b846..c7c2329 100644 --- a/README_es.md +++ b/README_es.md @@ -45,7 +45,7 @@ a public page. - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - ➕ Many more like recipe scaling, image compression, printing views and supermarkets -**Versión actual:** 1.5.18~ynh1 +**Versión actual:** 1.5.18~ynh2 **Demo:** diff --git a/README_eu.md b/README_eu.md index 0d8854e..c3addbf 100644 --- a/README_eu.md +++ b/README_eu.md @@ -45,7 +45,7 @@ a public page. - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - ➕ Many more like recipe scaling, image compression, printing views and supermarkets -**Paketatutako bertsioa:** 1.5.18~ynh1 +**Paketatutako bertsioa:** 1.5.18~ynh2 **Demoa:** diff --git a/README_fr.md b/README_fr.md index aa7d4a1..ec59fdb 100644 --- a/README_fr.md +++ b/README_fr.md @@ -45,7 +45,7 @@ a public page. - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - ➕ Many more like recipe scaling, image compression, printing views and supermarkets -**Version incluse :** 1.5.18~ynh1 +**Version incluse :** 1.5.18~ynh2 **Démo :** diff --git a/README_gl.md b/README_gl.md index 1dd26f2..6ea7845 100644 --- a/README_gl.md +++ b/README_gl.md @@ -45,7 +45,7 @@ a public page. - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - ➕ Many more like recipe scaling, image compression, printing views and supermarkets -**Versión proporcionada:** 1.5.18~ynh1 +**Versión proporcionada:** 1.5.18~ynh2 **Demo:** diff --git a/README_id.md b/README_id.md index b9f8374..fce894e 100644 --- a/README_id.md +++ b/README_id.md @@ -45,7 +45,7 @@ a public page. - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - ➕ Many more like recipe scaling, image compression, printing views and supermarkets -**Versi terkirim:** 1.5.18~ynh1 +**Versi terkirim:** 1.5.18~ynh2 **Demo:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 59afa01..ccd0598 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -45,7 +45,7 @@ a public page. - 📥️ **Import your collection** from many other [recipe managers](https://docs.tandoor.dev/features/import_export/) - ➕ Many more like recipe scaling, image compression, printing views and supermarkets -**分发版本:** 1.5.18~ynh1 +**分发版本:** 1.5.18~ynh2 **演示:** From 5f2e3be15310de28916a88b0b4c56b659aa1fa15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:23:30 +0200 Subject: [PATCH 03/11] Delete PRE_INSTALL.md --- doc/PRE_INSTALL.md | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 doc/PRE_INSTALL.md diff --git a/doc/PRE_INSTALL.md b/doc/PRE_INSTALL.md deleted file mode 100644 index 1ccfd5d..0000000 --- a/doc/PRE_INSTALL.md +++ /dev/null @@ -1,3 +0,0 @@ -### Known limitations: - -* Requires a full dedicated domain for now From c76aa2603e47c8ee08ca1e4c0d3350104cde6931 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:26:51 +0200 Subject: [PATCH 04/11] fix --- scripts/_common.sh | 1 - scripts/install | 2 ++ scripts/upgrade | 2 ++ 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 57695b7..3338f47 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,6 @@ nodejs_version=16 timezone="$(cat /etc/timezone)" -version=$(ynh_app_upstream_version) #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 4492aa7..b8dbb09 100755 --- a/scripts/install +++ b/scripts/install @@ -52,6 +52,8 @@ ynh_add_config --template="dot_env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown "$app:$app" "$install_dir/.env" +version=$(ynh_app_upstream_version) + ynh_add_config --template="version.py" --destination="$install_dir/source/recipes/version.py" chmod 400 "$install_dir/source/recipes/version.py" diff --git a/scripts/upgrade b/scripts/upgrade index cf82f9d..725b7dd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -47,6 +47,8 @@ ynh_add_config --template="dot_env" --destination="$install_dir/.env" chmod 400 "$install_dir/.env" chown "$app:$app" "$install_dir/.env" +version=$(ynh_app_upstream_version) + ynh_add_config --template="version.py" --destination="$install_dir/source/recipes/version.py" chmod 400 "$install_dir/source/recipes/version.py" From 1af56714740d4d945d6d831806b14eccc5ccbbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:36:03 +0200 Subject: [PATCH 05/11] cleaning --- conf/systemd.service | 36 +++++++++++++++++++++++++++++++++++- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 6 +++--- 4 files changed, 40 insertions(+), 6 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 61a2ebc..7969f0a 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Tandoor, smart recipe mangement +Description=Tandoor: smart recipe mangement After=network.target [Service] @@ -12,5 +12,39 @@ ExecStart=__INSTALL_DIR__/venv/bin/gunicorn --bind 127.0.0.1:__PORT__ recipes.ws Restart=on-failure RestartSec=10 +### Depending on specificities of your service/app, you may need to tweak these +### .. but this should be a good baseline +# Sandboxing options to harden security +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectClock=yes +ProtectHostname=yes +ProtectProc=invisible +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallArchitectures=native +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + [Install] WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index b8dbb09..f92d1f6 100755 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ ynh_use_logrotate ynh_script_progression --message="Starting a systemd service..." --weight=1 # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT diff --git a/scripts/restore b/scripts/restore index fdfe5bd..e329248 100755 --- a/scripts/restore +++ b/scripts/restore @@ -55,7 +55,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index 725b7dd..3561577 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" #================================================= # UPGRADE DEPENDENCIES @@ -31,7 +31,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" ynh_script_progression --message="Upgrading source files..." --weight=1 # 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/source" --full_replace=1 --keep="$install_dir/.env" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -97,7 +97,7 @@ ynh_use_logrotate --non-append #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" #================================================= # END OF SCRIPT From 1ec56df1334cdb8ebabfbaae73dc20db0d2407f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:38:48 +0200 Subject: [PATCH 06/11] fix --- conf/nginx.conf | 2 -- manifest.toml | 3 ++- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b1dad4b..e352b59 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -20,5 +20,3 @@ location __PATH__/ { location /media/ { alias __INSTALL_DIR__/mediafiles/; } - - diff --git a/manifest.toml b/manifest.toml index b708da6..aa9c9b8 100644 --- a/manifest.toml +++ b/manifest.toml @@ -47,7 +47,8 @@ ram.runtime = "1500M" autoupdate.asset = "tarball" [resources.system_user] - + allow_email = true + [resources.install_dir] [resources.data_dir] From 18690350c1c46025f65ea7fd37840a321c842643 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:44:36 +0200 Subject: [PATCH 07/11] cleaning --- conf/dot_env | 4 ---- scripts/change_url | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/conf/dot_env b/conf/dot_env index 3a00444..cdb8c5c 100644 --- a/conf/dot_env +++ b/conf/dot_env @@ -12,9 +12,7 @@ TANDOOR_PORT=__PORT__ ALLOWED_HOSTS=__DOMAIN__ # random secret key, use for example `base64 /dev/urandom | head -c50` to generate one -# ---------------------------- REQUIRED ------------------------- SECRET_KEY=__SECRETKEY__ -# --------------------------------------------------------------- # your default timezone See https://timezonedb.com/time-zones for a list of timezones TZ=__TIMEZONE__ @@ -25,9 +23,7 @@ DB_ENGINE=django.db.backends.postgresql POSTGRES_HOST=127.0.0.1 POSTGRES_PORT=5432 POSTGRES_USER=__DB_USER__ -# ---------------------------- REQUIRED ------------------------- POSTGRES_PASSWORD=__DB_PWD__ -# --------------------------------------------------------------- POSTGRES_DB=__DB_NAME__ # the default value for the user preference 'fractions' (enable/disable fraction support) diff --git a/scripts/change_url b/scripts/change_url index 80493ed..e2ac889 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF @@ -42,7 +42,7 @@ chown "$app:$app" "$install_dir/.env" #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" #================================================= # END OF SCRIPT From 4c6eb542d56484b52320364964e4a3724dbc0ac7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 11:45:02 +0200 Subject: [PATCH 08/11] Update dot_env --- conf/dot_env | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/dot_env b/conf/dot_env index cdb8c5c..39c60f9 100644 --- a/conf/dot_env +++ b/conf/dot_env @@ -81,8 +81,8 @@ GUNICORN_MEDIA=0 # Required for email confirmation and password reset (automatically activates if host is set) EMAIL_HOST='127.0.0.1' EMAIL_PORT=25 -EMAIL_HOST_USER= -EMAIL_HOST_PASSWORD= +EMAIL_HOST_USER='__APP__' +EMAIL_HOST_PASSWORD='__MAIL_PWD__' EMAIL_USE_TLS=0 EMAIL_USE_SSL=0 # email sender address (default 'webmaster@localhost') From f294abb63463af877fb505627bcaa57805436dd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 12:57:33 +0200 Subject: [PATCH 09/11] fix --- scripts/_common.sh | 4 ++-- scripts/install | 11 +++++------ scripts/upgrade | 10 +++++----- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 3338f47..dea5baf 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -16,13 +16,13 @@ _tandoor_venv_install() { ynh_exec_as "$app" python3 -m venv --upgrade "$install_dir/venv" venvpy="$install_dir/venv/bin/python3" - pushd "$install_dir/source" + pushd "$install_dir" ynh_exec_as "$app" "$venvpy" -m pip install -r requirements.txt popd } _tandoor_build_frontend() { - pushd "$install_dir/source/vue" + pushd "$install_dir/vue" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn install ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn build diff --git a/scripts/install b/scripts/install index f92d1f6..8dffd6d 100755 --- a/scripts/install +++ b/scripts/install @@ -38,7 +38,7 @@ ynh_psql_execute_as_root --sql="ALTER USER $db_name WITH SUPERUSER;" ynh_script_progression --message="Setting up source files..." --weight=1 # 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" chown -R "$app:www-data" "$install_dir" @@ -54,10 +54,10 @@ chown "$app:$app" "$install_dir/.env" version=$(ynh_app_upstream_version) -ynh_add_config --template="version.py" --destination="$install_dir/source/recipes/version.py" +ynh_add_config --template="version.py" --destination="$install_dir/recipes/version.py" -chmod 400 "$install_dir/source/recipes/version.py" -chown "$app:$app" "$install_dir/source/recipes/version.py" +chmod 400 "$install_dir/recipes/version.py" +chown "$app:$app" "$install_dir/recipes/version.py" #================================================= # SPECIFIC SETUP @@ -69,10 +69,9 @@ ynh_script_progression --message="Installing Tandoor and its python dependencies _tandoor_venv_install ynh_script_progression --message="Running migrations and generating static files..." --weight=2 -pushd "$install_dir/source" +pushd "$install_dir" ( source "$install_dir/.env" - ynh_exec_as "$app" "$venvpy" manage.py migrate ynh_psql_execute_as_root --sql="ALTER USER $app WITH NOSUPERUSER;" ynh_exec_as "$app" "$venvpy" manage.py collectstatic --no-input diff --git a/scripts/upgrade b/scripts/upgrade index 3561577..79427a9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -31,7 +31,7 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir/source" --full_replace=1 --keep="$install_dir/.env" +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="$install_dir/.env" chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" @@ -49,10 +49,10 @@ chown "$app:$app" "$install_dir/.env" version=$(ynh_app_upstream_version) -ynh_add_config --template="version.py" --destination="$install_dir/source/recipes/version.py" +ynh_add_config --template="version.py" --destination="$install_dir/recipes/version.py" -chmod 400 "$install_dir/source/recipes/version.py" -chown "$app:$app" "$install_dir/source/recipes/version.py" +chmod 400 "$install_dir/recipes/version.py" +chown "$app:$app" "$install_dir/recipes/version.py" #================================================= # SPECIFIC SETUP @@ -66,7 +66,7 @@ ynh_script_progression --message="Installing Tandoor and its python dependencies _tandoor_venv_install ynh_script_progression --message="Running migrations and generating static files..." --weight=2 -pushd "$install_dir/source" +pushd "$install_dir" ( source "$install_dir/.env" From 52476cc68ae9f7f5d3611b70c0155f21cd9197f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:00:09 +0200 Subject: [PATCH 10/11] Update upgrade --- scripts/upgrade | 1 - 1 file changed, 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 79427a9..03acc0b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -69,7 +69,6 @@ ynh_script_progression --message="Running migrations and generating static files pushd "$install_dir" ( source "$install_dir/.env" - ynh_exec_as "$app" "$venvpy" manage.py migrate ynh_psql_execute_as_root --sql="ALTER USER $app WITH NOSUPERUSER;" ynh_exec_as "$app" "$venvpy" manage.py collectstatic --no-input From 41ec83bc43403ef9da282a4b8e8932436fa94da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 22 Jul 2024 13:07:51 +0200 Subject: [PATCH 11/11] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 7969f0a..f6cc38d 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__INSTALL_DIR__/source/ +WorkingDirectory=__INSTALL_DIR__/ EnvironmentFile=__INSTALL_DIR__/.env ExecStart=__INSTALL_DIR__/venv/bin/gunicorn --bind 127.0.0.1:__PORT__ recipes.wsgi:application Restart=on-failure