1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/photonix_ynh.git synced 2024-09-03 19:56:29 +02:00

Automated packaging v2 conversion

This commit is contained in:
Salamandar 2024-06-06 12:02:24 +02:00
parent b943d0955a
commit 01422087ee
24 changed files with 322 additions and 218 deletions

View file

@ -1,6 +0,0 @@
SOURCE_URL=https://github.com/photonixapp/photonix/archive/refs/tags/v0.22.0.tar.gz
SOURCE_SUM=1a34e4ee981455e826fe5bf4fbcba7d9fba36b94802f8c927dfbfa5b6c3e3848
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true

View file

@ -6,9 +6,9 @@ After=network.target postgresql.service redis-server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py rescan_photos && __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py reset_redis_locks && __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py housekeeping && __FINALPATH__/venv/bin/gunicorn -b 0.0.0.0:$PHOTONIX_PORT web.wsgi"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py rescan_photos && __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py reset_redis_locks && __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py housekeeping && __INSTALL_DIR__/venv/bin/gunicorn -b 0.0.0.0:$PHOTONIX_PORT web.wsgi"
StandardOutput=append:/var/log/__APP__/__APP__-app_server.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 9 && nice -n 19 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py classification_color_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 9 && nice -n 19 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py classification_color_processor"
StandardOutput=append:/var/log/__APP__/__APP__-classification_color_processor.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 14 && nice -n 19 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py classification_event_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 14 && nice -n 19 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py classification_event_processor"
StandardOutput=append:/var/log/__APP__/__APP__-classification_event_processor.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 11 && nice -n 19 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py classification_face_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 11 && nice -n 19 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py classification_face_processor"
StandardOutput=append:/var/log/__APP__/__APP__-classification_face_processor.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 10 && nice -n 19 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py classification_location_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 10 && nice -n 19 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py classification_location_processor"
StandardOutput=append:/var/log/__APP__/__APP__-classification_location_processor.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 12 && nice -n 19 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py classification_object_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 12 && nice -n 19 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py classification_object_processor"
StandardOutput=append:/var/log/__APP__/__APP__-classification_object_processor.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 8 && nice -n 18 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py classification_scheduler"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 8 && nice -n 18 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py classification_scheduler"
StandardOutput=append:/var/log/__APP__/__APP__-classification_scheduler.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 11 && nice -n 19 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py classification_style_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 11 && nice -n 19 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py classification_style_processor"
StandardOutput=append:/var/log/__APP__/__APP__-classification_style_processor.log
StandardError=inherit

View file

@ -1,7 +1,7 @@
error_page 500 502 503 504 /500.html;
location /500.html {
root __FINALPATH__/srv/ui/public/;
root __INSTALL_DIR__/srv/ui/public/;
}
location /photos {
@ -15,7 +15,7 @@ location /thumbnails {
}
location /static-collected {
root __FINALPATH__/srv;
root __INSTALL_DIR__/srv;
expires 1d;
}
@ -33,7 +33,7 @@ location ~ ^/(admin|graphql|thumbnailer) {
}
location / {
root __FINALPATH__/srv/ui/build;
root __INSTALL_DIR__/srv/ui/build;
expires 1d;
ssi on;
try_files $uri /index.html =404;

View file

@ -12,4 +12,4 @@ SAMPLE_DATA=0
PHOTONIX_PORT=__PORT__
DJANGO_SECRET_KEY=__SECRET_KEY__
PYTHONPATH=__FINALPATH__/srv
PYTHONPATH=__INSTALL_DIR__/srv

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 6 && nice -n 17 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py raw_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 6 && nice -n 17 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py raw_processor"
StandardOutput=append:/var/log/__APP__/__APP__-raw_processor.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 5 && nice -n 17 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py raw_scheduler"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 5 && nice -n 17 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py raw_scheduler"
StandardOutput=append:/var/log/__APP__/__APP__-raw_scheduler.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 60 && nice -n 16 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py rescan_photos_periodically"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 60 && nice -n 16 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py rescan_photos_periodically"
StandardOutput=append:/var/log/__APP__/__APP__-rescan_photos_periodically.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH sleep 7 && nice -n 17 __FINALPATH__/venv/bin/python __FINALPATH__/srv/photonix/manage.py thumbnail_processor"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH sleep 7 && nice -n 17 __INSTALL_DIR__/venv/bin/python __INSTALL_DIR__/srv/photonix/manage.py thumbnail_processor"
StandardOutput=append:/var/log/__APP__/__APP__-thumbnail_processor.log
StandardError=inherit

View file

@ -6,9 +6,9 @@ After=network.target __APP__-app_server.service
Type=simple
User=__APP__
Group=__APP__
WorkingDirectory=__FINALPATH__/srv/photonix
EnvironmentFile=__FINALPATH__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__FINALPATH__/venv/bin:$PATH nice -n 16 __FINALPATH__/photonix/manage.py watch_photos"
WorkingDirectory=__INSTALL_DIR__/srv/photonix
EnvironmentFile=__INSTALL_DIR__/photonix.env
ExecStart=/usr/bin/env bash -c "PATH=__INSTALL_DIR__/venv/bin:$PATH nice -n 16 __INSTALL_DIR__/photonix/manage.py watch_photos"
StandardOutput=append:/var/log/__APP__/__APP__-watch_photos.log
StandardError=inherit

108
manifest.toml Normal file
View file

@ -0,0 +1,108 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "photonix"
name = "Photonix"
description.en = "Photo management application that streamlines the process of storing, presenting and re-discovering photos"
description.fr = "Application de gestion de photos qui simplifie le processus de stocker, présenter er re-découvrir ses photos"
version = "0.22.0~ynh1"
maintainers = ["Jules Bertholet"]
[upstream]
license = "AGPL-3.0-only"
website = "https://photonix.org/"
cpe = "???" # FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is sort of a standard id for applications defined by the NIST. In particular, Yunohost may use this is in the future to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: https://nvd.nist.gov/products/cpe/search. For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
fund = "???" # FIXME: optional but recommended (or remove if irrelevant / not applicable). This is meant to be an URL where people can financially support this app, especially when its development is based on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
[integration]
yunohost = ">= 4.2.4"
architectures = "all" # FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
multi_instance = true
ldap = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "sso" key : the "ldap" key corresponds to wether or not a user *can* login on the app using its YunoHost credentials.
sso = "?" # FIXME: replace with true, false, or "not_relevant". Not to confuse with the "ldap" key : the "sso" key corresponds to wether or not a user is *automatically logged-in* on the app when logged-in on the YunoHost portal.
disk = "50M" # FIXME: replace with an **estimate** minimum disk requirement. e.g. 20M, 400M, 1G, ...
ram.build = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
ram.runtime = "50M" # FIXME: replace with an **estimate** minimum ram requirement. e.g. 50M, 400M, 1G, ...
[install]
[install.domain]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "domain"
[install.admin]
# this is a generic question - ask strings are automatically handled by Yunohost's core
type = "user"
[install.classification_color_enabled]
ask.en = "Analyse photo colors (fast)?"
ask.fr = "Analyser les couleurs des photos (rapide) ?"
help.en = "This default parameter can be overridden for individual libraries"
help.fr = "Ce paramètre par dèfault peut être modifié pour chaque bibliothèque individuelle"
type = "boolean"
default = true
[install.classification_location_enabled]
ask.en = "Identify photo locations (medium)?"
ask.fr = "Identifier la localizations des photos (moyen) ?"
help.en = "This default parameter can be overridden for individual libraries"
help.fr = "Ce paramètre par dèfault peut être modifié pour chaque bibliothèque individuelle"
type = "boolean"
default = true
[install.classification_face_enabled]
ask.en = "Identify faces in photos (medium)?"
ask.fr = "Identifier les visages dans les photos (moyen) ?"
help.en = "This default parameter can be overridden for individual libraries"
help.fr = "Ce paramètre par dèfault peut être modifié pour chaque bibliothèque individuelle"
type = "boolean"
default = true
[install.classification_style_enabled]
ask.en = "Recognize photo styles (medium)?"
ask.fr = "Reconnaître le style des photos (moyen) ?"
help.en = "This default parameter can be overridden for individual libraries"
help.fr = "Ce paramètre par dèfault peut être modifié pour chaque bibliothèque individuelle"
type = "boolean"
default = true
[install.classification_object_enabled]
ask.en = "Detect objects in photos (slow)?"
ask.fr = "Reconnaître les objets dans les photos (lent) ?"
help.en = "This default parameter can be overridden for individual libraries"
help.fr = "Ce paramètre par dèfault peut être modifié pour chaque bibliothèque individuelle"
type = "boolean"
default = true
[install.init_main_permission]
type = "group"
default = false
[resources]
[resources.sources.main]
url = "https://github.com/photonixapp/photonix/archive/refs/tags/v0.22.0.tar.gz"
sha256 = "1a34e4ee981455e826fe5bf4fbcba7d9fba36b94802f8c927dfbfa5b6c3e3848"
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.ports]
main.default = 8888
[resources.apt]
packages = "acl, python3, python3-pip, python3-venv, nodejs, postgresql, postgresql-contrib, postgresql-common, redis-server, libsasl2-dev, libldap2-dev, libssl-dev, build-essential, curl, gfortran, gnupg, libatlas-base-dev, libblas-dev, libblas3, libfreetype6, libfreetype6-dev, libhdf5-dev, libheif-examples, libjpeg-dev, liblapack-dev, liblapack3, libpq-dev, libtiff5-dev, netcat, libimage-exiftool-perl"
[[resources.apt.extras]]
repo = "deb https://dl.yarnpkg.com/debian/ stable main"
key = "https://dl.yarnpkg.com/debian/pubkey.gpg"
packages = "yarn"
[resources.database]
type = "postgresql"

View file

@ -5,7 +5,7 @@
#=================================================
# dependencies used by the app
pkg_dependencies="acl python3 python3-pip python3-venv nodejs postgresql postgresql-contrib postgresql-common redis-server libsasl2-dev libldap2-dev libssl-dev build-essential curl gfortran gnupg libatlas-base-dev libblas-dev libblas3 libfreetype6 libfreetype6-dev libhdf5-dev libheif-examples libjpeg-dev liblapack-dev liblapack3 libpq-dev libtiff5-dev netcat libimage-exiftool-perl"
#REMOVEME? pkg_dependencies="acl python3 python3-pip python3-venv nodejs postgresql postgresql-contrib postgresql-common redis-server libsasl2-dev libldap2-dev libssl-dev build-essential curl gfortran gnupg libatlas-base-dev libblas-dev libblas3 libfreetype6 libfreetype6-dev libhdf5-dev libheif-examples libjpeg-dev liblapack-dev liblapack3 libpq-dev libtiff5-dev netcat libimage-exiftool-perl"
#=================================================
# PERSONAL HELPERS
@ -16,11 +16,11 @@ pkg_dependencies="acl python3 python3-pip python3-venv nodejs postgresql postgre
#=================================================
function set_permissions {
mkdir -p "$final_path/srv"
chown -R root:$app "$final_path"
chmod -R g=u,g-w,o-rwx "$final_path"
setfacl -n -m g:www-data:--x "$final_path";
setfacl -nR -m d:g:www-data:r-x -m g:www-data:r-x "$final_path/srv";
mkdir -p "$install_dir/srv"
chown -R root:$app "$install_dir"
chmod -R g=u,g-w,o-rwx "$install_dir"
setfacl -n -m g:www-data:--x "$install_dir";
setfacl -nR -m d:g:www-data:r-x -m g:www-data:r-x "$install_dir/srv";
mkdir -p "$data_path/data/"{photos,raw-photos-processed,cache,models}
chown -R $app:$app "$data_path"
@ -34,8 +34,8 @@ function set_permissions {
}
function patch_files {
find "$final_path" -type f | while read file; do
ynh_replace_string -m "'/srv" -r "'$final_path/srv" -f "$file"
find "$install_dir" -type f | while read file; do
ynh_replace_string -m "'/srv" -r "'$install_dir/srv" -f "$file"
ynh_replace_string -m "'/data" -r "'$data_path/data" -f "$file"
done
@ -43,21 +43,21 @@ function patch_files {
}
function build_django_backend {
chown -R $app:$app "$final_path"
pushd "$final_path"
sudo -u $app python3 -m venv "$final_path/venv"
sudo -u $app $final_path/venv/bin/pip --cache-dir "$final_path/.cache/pip" install -U wheel pip setuptools 2>&1
chown -R $app:$app "$install_dir"
pushd "$install_dir"
sudo -u $app python3 -m venv "$install_dir/venv"
sudo -u $app $install_dir/venv/bin/pip --cache-dir "$install_dir/.cache/pip" install -U wheel pip setuptools 2>&1
while read requirement ; do
if [ ! -z "$requirement" ] && [[ ! "$requirement" =~ ^'#'.* ]]; then
sudo -u $app PYTHONUNBUFFERED=1 "$final_path/venv/bin/pip" --cache-dir "$final_path/.cache/pip" install "$requirement" 2>&1
sudo -u $app PYTHONUNBUFFERED=1 "$install_dir/venv/bin/pip" --cache-dir "$install_dir/.cache/pip" install "$requirement" 2>&1
fi
done < "$final_path/requirements.txt"
sudo -u $app $final_path/venv/bin/pip --cache-dir "$final_path/.cache/pip" install -U django-auth-ldap 2>&1
sudo -u $app mkdir -p "$final_path/srv"
sudo -u $app cp -rT "$final_path/photonix" "$final_path/srv/photonix"
done < "$install_dir/requirements.txt"
sudo -u $app $install_dir/venv/bin/pip --cache-dir "$install_dir/.cache/pip" install -U django-auth-ldap 2>&1
sudo -u $app mkdir -p "$install_dir/srv"
sudo -u $app cp -rT "$install_dir/photonix" "$install_dir/srv/photonix"
popd
pushd "$final_path/srv"
sudo -u $app $final_path/venv/bin/python "$final_path/srv/photonix/manage.py" collectstatic --noinput --link 2>&1
pushd "$install_dir/srv"
sudo -u $app $install_dir/venv/bin/python "$install_dir/srv/photonix/manage.py" collectstatic --noinput --link 2>&1
popd
set_permissions
@ -72,47 +72,47 @@ function set_node_vars {
function build_node_frontend {
set_node_vars
chown -R $app:$app "$final_path"
sudo -u $app touch "$final_path/.yarnrc"
sudo -u $app mkdir -p "$final_path/srv/ui"
pushd "$final_path"
sudo -u $app cp -T "$final_path/ui/package.json" "$final_path/srv/ui/package.json"
sudo -u $app cp -T "$final_path/ui/yarn.lock" "$final_path/srv/ui/yarn.lock"
chown -R $app:$app "$install_dir"
sudo -u $app touch "$install_dir/.yarnrc"
sudo -u $app mkdir -p "$install_dir/srv/ui"
pushd "$install_dir"
sudo -u $app cp -T "$install_dir/ui/package.json" "$install_dir/srv/ui/package.json"
sudo -u $app cp -T "$install_dir/ui/yarn.lock" "$install_dir/srv/ui/yarn.lock"
popd
pushd "$final_path/srv/ui"
sudo -u $app env "PATH=$node_path" yarn --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc install 2>&1
sudo -u $app cp -rT "$final_path/ui/public" "$final_path/srv/ui/public"
sudo -u $app cp -rT "$final_path/ui/src" "$final_path/srv/ui/src"
sudo -u $app env "PATH=$node_path" yarn --cache-folder $final_path/yarn-cache --use-yarnrc $final_path/.yarnrc build 2>&1
pushd "$install_dir/srv/ui"
sudo -u $app env "PATH=$node_path" yarn --cache-folder $install_dir/yarn-cache --use-yarnrc $install_dir/.yarnrc install 2>&1
sudo -u $app cp -rT "$install_dir/ui/public" "$install_dir/srv/ui/public"
sudo -u $app cp -rT "$install_dir/ui/src" "$install_dir/srv/ui/src"
sudo -u $app env "PATH=$node_path" yarn --cache-folder $install_dir/yarn-cache --use-yarnrc $install_dir/.yarnrc build 2>&1
popd
sudo -u $app cp -rT "$final_path/ui/public" "$final_path/srv/ui/public"
sudo -u $app cp -rT "$install_dir/ui/public" "$install_dir/srv/ui/public"
set_permissions
}
function add_envfile {
secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
if [ -z $secret_key ]; then
secret_key=$(ynh_string_random -l 64)
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
fi
ynh_add_config --template="photonix.env" --destination="$final_path/photonix.env"
ynh_add_config --template="photonix.env" --destination="$install_dir/photonix.env"
set_permissions
}
function apply_db_migrations {
pushd "$final_path/srv/photonix" || ynh_die
pushd "$install_dir/srv/photonix" || ynh_die
sudo -u $app bash -c "
source \"$final_path/venv/bin/activate\"
source \"$install_dir/venv/bin/activate\"
set -a
source \"$final_path/photonix.env\"
python \"$final_path/photonix/manage.py\" makemigrations
python \"$final_path/photonix/manage.py\" migrate"
source \"$install_dir/photonix.env\"
python \"$install_dir/photonix/manage.py\" makemigrations
python \"$install_dir/photonix/manage.py\" migrate"
popd
}
@ -173,20 +173,20 @@ function backup_services {
}
function load_settings {
final_path="$(ynh_app_setting_get --app=$app --key=final_path)"
data_path="$(ynh_app_setting_get --app=$app --key=data_path)"
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#REMOVEME? #REMOVEME? install_dir="$(ynh_app_setting_get --app=$app --key=install_dir)"
#REMOVEME? data_path="$(ynh_app_setting_get --app=$app --key=data_path)"
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
admin=$(ynh_app_setting_get --app=$app --key=admin)
port=$(ynh_app_setting_get --app=$app --key=port)
classification_color_enabled=$(ynh_app_setting_get --app=$app --key=classification_color_enabled)
classification_location_enabled=$(ynh_app_setting_get --app=$app --key=classification_location_enabled)
classification_face_enabled=$(ynh_app_setting_get --app=$app --key=classification_face_enabled)
classification_style_enabled=$(ynh_app_setting_get --app=$app --key=classification_style_enabled)
classification_object_enabled=$(ynh_app_setting_get --app=$app --key=classification_object_enabled)
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
#REMOVEME? classification_color_enabled=$(ynh_app_setting_get --app=$app --key=classification_color_enabled)
#REMOVEME? classification_location_enabled=$(ynh_app_setting_get --app=$app --key=classification_location_enabled)
#REMOVEME? classification_face_enabled=$(ynh_app_setting_get --app=$app --key=classification_face_enabled)
#REMOVEME? classification_style_enabled=$(ynh_app_setting_get --app=$app --key=classification_style_enabled)
#REMOVEME? classification_object_enabled=$(ynh_app_setting_get --app=$app --key=classification_object_enabled)
}
#=================================================

View file

@ -14,18 +14,18 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
#REMOVEME? ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
load_settings
@ -38,7 +38,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE APP DATA DIR

View file

@ -13,49 +13,49 @@ source /usr/share/yunohost/helpers
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
#REMOVEME? old_domain=$YNH_APP_OLD_DOMAIN
#REMOVEME? old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path="/"
#REMOVEME? new_domain=$YNH_APP_NEW_DOMAIN
#REMOVEME? new_path="/"
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
load_settings
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=140
#REMOVEME? ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=140
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#REMOVEME? ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
#REMOVEME? change_domain=0
#REMOVEME? if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
#REMOVEME? change_domain=1
fi
change_path=0
#REMOVEME? change_path=0
#=================================================
# STANDARD MODIFICATIONS
@ -71,16 +71,18 @@ stop_services
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
ynh_change_url_nginx_config
#REMOVEME? nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
#REMOVEME? ynh_delete_file_checksum --file="$nginx_conf_path"
#REMOVEME? mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
#REMOVEME? ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
@ -95,9 +97,9 @@ start_services
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? #REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT

View file

@ -13,49 +13,49 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
classification_color_enabled=$YNH_APP_ARG_CLASSIFICATION_COLOR_ENABLED
classification_location_enabled=$YNH_APP_ARG_CLASSIFICATION_LOCATION_ENABLED
classification_face_enabled=$YNH_APP_ARG_CLASSIFICATION_FACE_ENABLED
classification_style_enabled=$YNH_APP_ARG_CLASSIFICATION_STYLE_ENABLED
classification_object_enabled=$YNH_APP_ARG_CLASSIFICATION_OBJECT_ENABLED
#REMOVEME? domain=$YNH_APP_ARG_DOMAIN
path="/"
#REMOVEME? admin=$YNH_APP_ARG_ADMIN
#REMOVEME? is_public=$YNH_APP_ARG_IS_PUBLIC
#REMOVEME? classification_color_enabled=$YNH_APP_ARG_CLASSIFICATION_COLOR_ENABLED
#REMOVEME? classification_location_enabled=$YNH_APP_ARG_CLASSIFICATION_LOCATION_ENABLED
#REMOVEME? classification_face_enabled=$YNH_APP_ARG_CLASSIFICATION_FACE_ENABLED
#REMOVEME? classification_style_enabled=$YNH_APP_ARG_CLASSIFICATION_STYLE_ENABLED
#REMOVEME? classification_object_enabled=$YNH_APP_ARG_CLASSIFICATION_OBJECT_ENABLED
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
#REMOVEME? ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/opt/yunohost/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
#REMOVEME? install_dir=/opt/yunohost/$app
#REMOVEME? test ! -e "$install_dir" || ynh_die --message="This path already contains a folder"
data_path=/home/yunohost.app/$app
test ! -e "$data_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#REMOVEME? ynh_webpath_register --app=$app --domain=$domain --path=$path
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin
#REMOVEME? ynh_app_setting_set --app=$app --key=domain --value=$domain
#REMOVEME? ynh_app_setting_set --app=$app --key=path --value=$path
#REMOVEME? ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=classification_color_enabled --value=$classification_color_enabled
ynh_app_setting_set --app=$app --key=classification_location_enabled --value=$classification_location_enabled
ynh_app_setting_set --app=$app --key=classification_face_enabled --value=$classification_face_enabled
@ -67,48 +67,48 @@ ynh_app_setting_set --app=$app --key=classification_object_enabled --value=$clas
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..." --weight=1
#REMOVEME? ynh_script_progression --message="Finding an available port..." --weight=1
# Find an available port
port=$(ynh_find_port --port=8888)
ynh_app_setting_set --app=$app --key=port --value=$port
#REMOVEME? port=$(ynh_find_port --port=8888)
#REMOVEME? ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=50
#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=50
ynh_install_app_dependencies $pkg_dependencies
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
#REMOVEME? ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir="$data_path"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$data_path"
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
#REMOVEME? ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_psql_test_if_first_run
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#REMOVEME? db_name=$(ynh_sanitize_dbid --db_name=$app)
#REMOVEME? db_user=$db_name
#REMOVEME? ynh_psql_test_if_first_run
#REMOVEME? ynh_app_setting_set --app=$app --key=db_name --value=$db_name
#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_app_setting_set --app=$app --key=data_path --value=$data_path
#REMOVEME? ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
#REMOVEME? ynh_app_setting_set --app=$app --key=data_path --value=$data_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$install_dir"
set_permissions
@ -179,20 +179,20 @@ ynh_script_progression --message="Creating users and libraries..." --weight=5
admin_mail=$(ynh_user_get_info "$admin" mail)
sudo -u $app bash -c "
source \"$final_path/venv/bin/activate\"
source \"$install_dir/venv/bin/activate\"
set -a
source \"$final_path/photonix.env\"
python \"$final_path/photonix/manage.py\" createsuperuser --noinput --username \"$admin\" --email \"$admin_mail\"
source \"$install_dir/photonix.env\"
python \"$install_dir/photonix/manage.py\" createsuperuser --noinput --username \"$admin\" --email \"$admin_mail\"
"
for username in $(ynh_user_list); do
user_email=$(ynh_user_get_info --username="$username" --key=mail)
user_firstname=$(ynh_user_get_info --username="$username" --key=firstname)
user_lastname=$(ynh_user_get_info --username="$username" --key=lastname)
sudo -u $app bash -c "
source \"$final_path/venv/bin/activate\"
source \"$install_dir/venv/bin/activate\"
set -a
source \"$final_path/photonix.env\"
python \"$final_path/photonix/manage.py\" shell
source \"$install_dir/photonix.env\"
python \"$install_dir/photonix/manage.py\" shell
" <<< "
from django.contrib.auth import get_user_model
from photonix.photos.models import Library, LibraryUser, LibraryPath
@ -271,22 +271,22 @@ start_services
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
#REMOVEME? ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
#REMOVEME? if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT

View file

@ -12,9 +12,9 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
load_settings
@ -38,26 +38,26 @@ remove_systemd_configs
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
#REMOVEME? ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#REMOVEME? ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=5
#REMOVEME? ynh_script_progression --message="Removing dependencies..." --weight=5
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#REMOVEME? ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=1
#REMOVEME? ynh_script_progression --message="Removing app main directory..." --weight=1
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#REMOVEME? ynh_secure_remove --file="$install_dir"
#=================================================
# REMOVE APP DATA DIR
@ -105,10 +105,10 @@ ynh_remove_nodejs
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
#REMOVEME? ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#REMOVEME? ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT

View file

@ -14,30 +14,30 @@ source /usr/share/yunohost/helpers
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#REMOVEME? ynh_clean_setup () {
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
load_settings
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
#REMOVEME? ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#REMOVEME? ynh_webpath_available --domain=$domain --path=$path \
|| ynh_die --message="Path not available: ${domain}${path}"
#REMOVEME? test ! -d $install_dir \
|| ynh_die --message="There is already a directory: $install_dir "
test ! -d $data_path \
|| ynh_die --message="There is already a directory: $data_path "
@ -52,25 +52,25 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
#REMOVEME? ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$data_path"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$data_path"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=15
#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=15
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
set_permissions
@ -88,10 +88,10 @@ set_permissions
#=================================================
# RESTORE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
#REMOVEME? ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
#REMOVEME? ynh_psql_test_if_first_run
#REMOVEME? ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================

View file

@ -12,9 +12,9 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
load_settings
@ -27,16 +27,16 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=115
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=115
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
#REMOVEME? ynh_backup_before_upgrade
#REMOVEME? ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
#REMOVEME? ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#REMOVEME? ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
@ -50,10 +50,10 @@ stop_services
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$data_path"
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$data_path"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -68,10 +68,10 @@ fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=15
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=15
ynh_install_app_dependencies $pkg_dependencies
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
#REMOVEME? ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -81,10 +81,10 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=5
ynh_secure_remove --file="$final_path"
#REMOVEME? ynh_secure_remove --file="$install_dir"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$install_dir"
fi
set_permissions
@ -179,9 +179,9 @@ start_services
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT