mirror of
https://github.com/YunoHost-Apps/photoprism_ynh.git
synced 2024-09-03 19:56:41 +02:00
commit
b429ef7a83
24 changed files with 185 additions and 801 deletions
137
.github/workflows/updater.sh
vendored
137
.github/workflows/updater.sh
vendored
|
@ -1,137 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# PACKAGE UPDATING HELPER
|
||||
#=================================================
|
||||
|
||||
# This script is meant to be run by GitHub Actions
|
||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
# Remove this exit command when you are ready to run this Action
|
||||
exit 1
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
||||
# Fetching information
|
||||
current_version=$(cat manifest.json | jq -j '.version|split("~")[0]')
|
||||
repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]')
|
||||
# Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions)
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||
assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'"))
|
||||
|
||||
# Later down the script, we assume the version has only digits and dots
|
||||
# Sometimes the release name starts with a "v", so let's filter it out.
|
||||
# You may need more tweaks here if the upstream repository has different naming conventions.
|
||||
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
||||
version=${version:1}
|
||||
fi
|
||||
|
||||
# Setting up the environment variables
|
||||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
echo "REPO=$repo" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
# Proceed only if the retrieved version is greater than the current one
|
||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||
echo "::warning ::No new version available"
|
||||
exit 0
|
||||
# Proceed only if a PR for this new version does not already exist
|
||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||
echo "::warning ::A branch already exists for this update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
||||
echo "${#assets[@]} available asset(s)"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
# Here we use the $assets variable to get the resources published in the upstream release.
|
||||
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
|
||||
|
||||
# Let's loop over the array of assets URLs
|
||||
for asset_url in ${assets[@]}; do
|
||||
|
||||
echo "Handling asset at $asset_url"
|
||||
|
||||
# Assign the asset to a source file in conf/ directory
|
||||
# Here we base the source file name upon a unique keyword in the assets url (admin vs. update)
|
||||
# Leave $src empty to ignore the asset
|
||||
case $asset_url in
|
||||
*"admin"*)
|
||||
src="app"
|
||||
;;
|
||||
*"update"*)
|
||||
src="app-upgrade"
|
||||
;;
|
||||
*)
|
||||
src=""
|
||||
;;
|
||||
esac
|
||||
|
||||
# If $src is not empty, let's process the asset
|
||||
if [ ! -z "$src" ]; then
|
||||
|
||||
# Create the temporary directory
|
||||
tempdir="$(mktemp -d)"
|
||||
|
||||
# Download sources and calculate checksum
|
||||
filename=${asset_url##*/}
|
||||
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
|
||||
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
|
||||
|
||||
# Delete temporary directory
|
||||
rm -rf $tempdir
|
||||
|
||||
# Get extension
|
||||
if [[ $filename == *.tar.gz ]]; then
|
||||
extension=tar.gz
|
||||
else
|
||||
extension=${filename##*.}
|
||||
fi
|
||||
|
||||
# Rewrite source file
|
||||
cat <<EOT > conf/$src.src
|
||||
SOURCE_URL=$asset_url
|
||||
SOURCE_SUM=$checksum
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=$extension
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
|
||||
else
|
||||
echo "... asset ignored"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
||||
# Any action on the app's source code can be done.
|
||||
# The GitHub Action workflow takes care of committing all changes after this script ends.
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
# Replace new version in manifest
|
||||
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
|
||||
|
||||
# No need to update the README, yunohost-bot takes care of it
|
||||
|
||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
17
README.md
17
README.md
|
@ -28,7 +28,7 @@ PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. It makes use
|
|||
- Automatic classification of pictures based on their content and location
|
||||
|
||||
|
||||
**Shipped version:** 2022.09.01~ynh3
|
||||
**Shipped version:** 2022.09.01~ynh4
|
||||
|
||||
**Demo:** https://demo-fr.photoprism.app
|
||||
|
||||
|
@ -36,21 +36,6 @@ PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. It makes use
|
|||
|
||||

|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
* Known limitations:
|
||||
* Although reaching level 7, Photoprism hasn't yet been extensively tested in real conditions
|
||||
* Please use with **extreme care** if you install it on a test server !
|
||||
* Photoprism currently supports only one user. OIDC should be supported within a few months
|
||||
* Photoprism requires an important amount of RAM and disk to install or to work properly
|
||||
|
||||
* All data is stored in `/home/yunohost.app/photoprism/photos/`
|
||||
* Be careful, this data is not backed-up by default when doing a backup
|
||||
|
||||
* At first install, you'll be prompted for credentials
|
||||
* Username is "admin"
|
||||
* Password is the password you have set during the installation
|
||||
|
||||
## Documentation and resources
|
||||
|
||||
* Official app website: <https://photoprism.app>
|
||||
|
|
17
README_fr.md
17
README_fr.md
|
@ -28,7 +28,7 @@ PhotoPrism® est une application de photos alimentée par l'IA pour le Web déce
|
|||
- Classification automatique des photos en fonction de leur contenu et de leur emplacement
|
||||
|
||||
|
||||
**Version incluse :** 2022.09.01~ynh3
|
||||
**Version incluse :** 2022.09.01~ynh4
|
||||
|
||||
**Démo :** https://demo-fr.photoprism.app
|
||||
|
||||
|
@ -36,21 +36,6 @@ PhotoPrism® est une application de photos alimentée par l'IA pour le Web déce
|
|||
|
||||

|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
* Limites connues :
|
||||
* Bien qu'ayant atteint le niveau 7, Photoprism n'a pas encore été testé de manière approfondie en conditions réelles.
|
||||
* Veuillez l'utiliser avec **extrême prudence** si vous l'installez sur un serveur de test !
|
||||
* Photoprism ne supporte actuellement qu'un seul utilisateur. OIDC devrait être supporté d'ici quelques mois.
|
||||
* Photoprism nécessite une quantité importante de RAM et de disque pour être installé et fonctionner correctement.
|
||||
|
||||
* Les données sont stockées dans `/home/yunohost.app/photoprism/photos/`
|
||||
* Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée
|
||||
|
||||
* Lors de la première installation, il vous sera demandé de fournir des informations d'identification.
|
||||
* Le nom d'utilisateur est "admin".
|
||||
* Le mot de passe est celui que vous avez défini lors de l'installation.
|
||||
|
||||
## Documentations et ressources
|
||||
|
||||
* Site officiel de l’app : <https://photoprism.app>
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
;; Test complet
|
||||
; Manifest
|
||||
domain="domain.tld"
|
||||
path="/path"
|
||||
is_public=1
|
||||
language="fr"
|
||||
password="1Strong-Password"
|
||||
; Checks
|
||||
pkg_linter=1
|
||||
setup_sub_dir=1
|
||||
setup_root=1
|
||||
setup_nourl=0
|
||||
setup_private=1
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
# 2022.06.17~ynh1
|
||||
upgrade=1 from_commit=4de2ab27722b2300a6faff4f910ecf5b93160cb6
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=none
|
||||
;;; Upgrade options
|
||||
; commit=4de2ab27722b2300a6faff4f910ecf5b93160cb6
|
||||
name=2022.06.17~ynh1
|
|
@ -3,7 +3,7 @@ PHOTOPRISM_CACHE_PATH="/home/yunohost.app/__APP__/cache"
|
|||
PHOTOPRISM_ORIGINALS_PATH="/home/yunohost.app/__APP__/photos/originals"
|
||||
PHOTOPRISM_IMPORT_PATH="/home/yunohost.app/__APP__/photos/import"
|
||||
PHOTOPRISM_TEMP_PATH="/home/yunohost.app/__APP__/temp"
|
||||
PHOTOPRISM_SITE_URL="https://__DOMAIN____PATH_URL__"
|
||||
PHOTOPRISM_SITE_URL="https://__DOMAIN____PATH__"
|
||||
PHOTOPRISM_ADMIN_PASSWORD="__PASSWORD__"
|
||||
PHOTOPRISM_HTTP_HOST="127.0.0.1"
|
||||
PHOTOPRISM_HTTP_MODE="release"
|
||||
|
@ -18,7 +18,7 @@ PHOTOPRISM_DEFAULT_LOCALE="__LANGUAGE_KEY__"
|
|||
PHOTOPRISM_SITE_DESCRIPTION="__APP__"
|
||||
PHOTOPRISM_DEBUG="false"
|
||||
PHOTOPRISM_DARKTABLE_BIN="/usr/bin/darktable-cli"
|
||||
PHOTOPRISM_HEIFCONVERT_BIN="__FINALPATH__/bin/heif-convert"
|
||||
PHOTOPRISM_HEIFCONVERT_BIN="__INSTALL_DIR__/bin/heif-convert"
|
||||
PHOTOPRISM_FFMPEG_BIN="/usr/bin/ffmpeg"
|
||||
PHOTOPRISM_EXIFTOOL_BIN="/usr/bin/exiftool"
|
||||
PHOTOPRISM_UPLOAD_NSFW="true"
|
|
@ -1,7 +0,0 @@
|
|||
SOURCE_URL=https://codeload.github.com/jjlin/docker-image-extract/tar.gz/a9e455e44bbbfba897bf3342d9661b182cee67a9
|
||||
SOURCE_SUM=9eb0c734e83a3fd7102fc7209af4977024ec467fbc819782491af47295675f67
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
|
@ -5,7 +5,7 @@ CachePath: /home/yunohost.app/__APP__/cache
|
|||
OriginalsPath: /home/yunohost.app/__APP__/photos/originals
|
||||
ImportPath: /home/yunohost.app/__APP__/photos/import
|
||||
TempPath: /home/yunohost.app/__APP__/temp
|
||||
SiteUrl: https://__DOMAIN____PATH_URL__
|
||||
SiteUrl: https://__DOMAIN____PATH__
|
||||
AdminPassword: __PASSWORD__
|
||||
HttpServerHost: 127.0.0.1
|
||||
HttpMode: release
|
||||
|
|
|
@ -17,9 +17,9 @@ BindReadOnlyPaths=-/lib/ -/lib64/ -/usr/lib/ -/usr/lib64/ -/etc/ld.so.cache -/et
|
|||
BindReadOnlyPaths=-/dev/log -/run/systemd/journal/socket -/run/systemd/journal/stdout -/run/systemd/notify
|
||||
BindPaths=/var/www/photoprism /var/www/photoprism/live/bin /home/yunohost.app/photoprism -/usr -/etc -/var -/home -/dev -/etc -/media -/mnt -/opt -/proc -/run -/srv -/sys -/tmp
|
||||
|
||||
EnvironmentFile=__FINALPATH__/.env
|
||||
WorkingDirectory=__FINALPATH__/live/bin
|
||||
ExecStart=__FINALPATH__/live/bin/photoprism --trace start
|
||||
EnvironmentFile=__INSTALL_DIR__/.env
|
||||
WorkingDirectory=__INSTALL_DIR__/live/bin
|
||||
ExecStart=__INSTALL_DIR__/live/bin/photoprism --trace start
|
||||
StandardOutput=append:/var/log/__APP__/__APP__.log
|
||||
StandardError=inherit
|
||||
TimeoutSec=900
|
||||
|
|
1
doc/ADMIN.md
Normal file
1
doc/ADMIN.md
Normal file
|
@ -0,0 +1 @@
|
|||
All data is stored in `__DATA_DIR__/photos/`. Be careful, this data is not backed-up by default when doing a backup
|
1
doc/ADMIN_fr.md
Normal file
1
doc/ADMIN_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Les données sont stockées dans `__DATA_DIR__/photos/`. Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée
|
|
@ -1,12 +0,0 @@
|
|||
* Known limitations:
|
||||
* Although reaching level 7, Photoprism hasn't yet been extensively tested in real conditions
|
||||
* Please use with **extreme care** if you install it on a test server !
|
||||
* Photoprism currently supports only one user. OIDC should be supported within a few months
|
||||
* Photoprism requires an important amount of RAM and disk to install or to work properly
|
||||
|
||||
* All data is stored in `/home/yunohost.app/photoprism/photos/`
|
||||
* Be careful, this data is not backed-up by default when doing a backup
|
||||
|
||||
* At first install, you'll be prompted for credentials
|
||||
* Username is "admin"
|
||||
* Password is the password you have set during the installation
|
|
@ -1,12 +0,0 @@
|
|||
* Limites connues :
|
||||
* Bien qu'ayant atteint le niveau 7, Photoprism n'a pas encore été testé de manière approfondie en conditions réelles.
|
||||
* Veuillez l'utiliser avec **extrême prudence** si vous l'installez sur un serveur de test !
|
||||
* Photoprism ne supporte actuellement qu'un seul utilisateur. OIDC devrait être supporté d'ici quelques mois.
|
||||
* Photoprism nécessite une quantité importante de RAM et de disque pour être installé et fonctionner correctement.
|
||||
|
||||
* Les données sont stockées dans `/home/yunohost.app/photoprism/photos/`
|
||||
* Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée
|
||||
|
||||
* Lors de la première installation, il vous sera demandé de fournir des informations d'identification.
|
||||
* Le nom d'utilisateur est "admin".
|
||||
* Le mot de passe est celui que vous avez défini lors de l'installation.
|
5
doc/POST_INSTALL.md
Normal file
5
doc/POST_INSTALL.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
At first install, you'll be prompted for credentials
|
||||
- Username is `admin`
|
||||
- Password is the password you have set during the installation
|
||||
|
||||
All data is stored in `__DATA_DIR__/photos/`. Be careful, this data is not backed-up by default when doing a backup
|
5
doc/POST_INSTALL_fr.md
Normal file
5
doc/POST_INSTALL_fr.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
Lors de la première installation, il vous sera demandé de fournir des informations d'identification.
|
||||
- Le nom d'utilisateur est `admin`.
|
||||
- Le mot de passe est celui que vous avez défini lors de l'installation.
|
||||
|
||||
Les données sont stockées dans `__DATA_DIR__/photos/`. Attention, ces données ne sont pas sauvegardées par défaut lorsqu'une sauvegarde est lancée
|
|
@ -1,71 +0,0 @@
|
|||
{
|
||||
"name": "Photoprism",
|
||||
"id": "photoprism",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "AI-Powered Photos App for the Decentralized Web",
|
||||
"fr": "Gestion de photos en ligne"
|
||||
},
|
||||
"version": "2022.09.01~ynh3",
|
||||
"url": "photoprism.app",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-only",
|
||||
"website": "https://photoprism.app",
|
||||
"demo": "https://demo-fr.photoprism.app",
|
||||
"admindoc": "https://docs.photoprism.app/developer-guide/",
|
||||
"userdoc": "https://docs.photoprism.app/user-guide/",
|
||||
"code": "https://github.com/photoprism/photoprism"
|
||||
},
|
||||
"license": "AGPL-3.0-only",
|
||||
"maintainer": {
|
||||
"name": "Thovi98"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 11.0.9.11"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"example": "/example",
|
||||
"default": "/example"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"help": {
|
||||
"en": "If enabled, Photoprism will be accessible by mobile apps and by users without a YunoHost account. This can be changed later in the webadmin.",
|
||||
"fr": "Si cette case est cochée, Photoprism sera accessible par des applications mobiles et par les utilisateurs n’ayant pas de compte YunoHost. Vous pourrez changer cela dans la webadmin."
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "language",
|
||||
"type": "string",
|
||||
"ask": {
|
||||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": ["fr", "en"],
|
||||
"default": "fr"
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"help": {
|
||||
"en": "Photoprism currently supports only one user : admin. Choose a password here.",
|
||||
"fr": "Photoprism ne permet qu'un seul utilisateur pour le moment. Choisissez un mot de passe ici."
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
95
manifest.toml
Normal file
95
manifest.toml
Normal file
|
@ -0,0 +1,95 @@
|
|||
packaging_format = 2
|
||||
|
||||
id = "photoprism"
|
||||
name = "Photoprism"
|
||||
description.en = "AI-Powered Photos App for the Decentralized Web"
|
||||
description.fr = "Gestion de photos en ligne"
|
||||
|
||||
version = "2022.09.01~ynh4"
|
||||
|
||||
maintainers = ["Thovi98"]
|
||||
|
||||
[upstream]
|
||||
license = "AGPL-3.0-only"
|
||||
website = "https://photoprism.app"
|
||||
demo = "https://demo-fr.photoprism.app"
|
||||
admindoc = "https://docs.photoprism.app/developer-guide/"
|
||||
userdoc = "https://docs.photoprism.app/user-guide/"
|
||||
code = "https://github.com/photoprism/photoprism"
|
||||
fund = "https://www.photoprism.app/membership"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.21"
|
||||
architectures = ["amd64", "arm64", "armhf"]
|
||||
multi_instance = false
|
||||
ldap = false
|
||||
sso = false
|
||||
disk = "50M"
|
||||
ram.build = "300M"
|
||||
ram.runtime = "50M"
|
||||
|
||||
[install]
|
||||
[install.domain]
|
||||
type = "domain"
|
||||
|
||||
[install.path]
|
||||
type = "path"
|
||||
default = "/photoprism"
|
||||
|
||||
[install.init_main_permission]
|
||||
help.en = "If enabled, Photoprism will be accessible by mobile apps and by users without a YunoHost account. This can be changed later in the webadmin."
|
||||
help.fr = "Si cette case est cochée, Photoprism sera accessible par des applications mobiles et par les utilisateurs n’ayant pas de compte YunoHost. Vous pourrez changer cela dans la webadmin."
|
||||
type = "group"
|
||||
default = "visitors"
|
||||
|
||||
[install.language]
|
||||
ask.en = "Choose the application language"
|
||||
ask.fr = "Choisissez la langue de l'application"
|
||||
type = "string"
|
||||
choices = ["fr", "en"]
|
||||
default = "fr"
|
||||
|
||||
[install.password]
|
||||
help.en = "Photoprism currently supports only one user : admin. Choose a password here."
|
||||
help.fr = "Photoprism ne permet qu'un seul utilisateur pour le moment. Choisissez un mot de passe ici."
|
||||
type = "password"
|
||||
|
||||
[resources]
|
||||
[resources.sources]
|
||||
[resources.sources.main]
|
||||
format = "docker"
|
||||
extract = true
|
||||
prefetch = false
|
||||
|
||||
amd64.url = "photoprism/photoprism:220901-bullseye"
|
||||
amd64.sha256 = "3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4"
|
||||
|
||||
arm64.url = "photoprism/photoprism:220901-bullseye"
|
||||
arm64.sha256 = "3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f"
|
||||
|
||||
armhf.url = "photoprism/photoprism:220901-bullseye"
|
||||
armhf.sha256 = "a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e"
|
||||
|
||||
[resources.system_user]
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
[resources.data_dir]
|
||||
subdirs = ["assets"]
|
||||
|
||||
[resources.permissions]
|
||||
main.url = "/"
|
||||
|
||||
sharing.url = "/s"
|
||||
sharing.allowed = "visitors"
|
||||
sharing.show_tile = false
|
||||
sharing.protected = true
|
||||
|
||||
[resources.ports]
|
||||
main.default = 8095
|
||||
|
||||
[resources.apt]
|
||||
packages = "libc6-dev, libssl-dev, libxft-dev, libhdf5-serial-dev, libpng-dev, libheif-examples, librsvg2-bin, libx264-dev, libx265-dev, libnss3, libfreetype6, libfreetype6-dev, libfontconfig1, libfontconfig1-dev, libzmq3-dev, ffmpeg, libimage-exiftool-perl, mariadb-server"
|
||||
|
||||
[resources.database]
|
||||
type = "mysql"
|
|
@ -4,29 +4,6 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
function detect_arch() {
|
||||
case "$YNH_ARCH" in
|
||||
"amd64")
|
||||
PHOTOPRISM_VERSION="sha256:3381d40181ecdf62932e9530c6b81e6e0f8828a3d373d8dedf662aab96dafba4"
|
||||
;;
|
||||
|
||||
"arm64")
|
||||
PHOTOPRISM_VERSION="sha256:3dcffda0a2b58c91479c883205025edee4ea799fc35be419f9bec708ccb54b7f"
|
||||
;;
|
||||
|
||||
"armhf")
|
||||
PHOTOPRISM_VERSION="sha256:a74f4d0a220af9a5291307bfba36f662d97c4df143f04d951e3c30111916317e"
|
||||
;;
|
||||
|
||||
*)
|
||||
ynh_die --message="Your server architecture ($YNH_ARCH) is not supported."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
#pkg_dependencies="libc6-dev libssl-dev libxft-dev libhdf5-serial-dev libpng-dev libheif-examples librsvg2-bin libx264-dev libx265-dev libnss3 libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev libzmq3-dev"
|
||||
pkg_dependencies="ffmpeg libimage-exiftool-perl"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -10,28 +10,6 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_print_info --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||
#=================================================
|
||||
|
@ -41,13 +19,13 @@ 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 DATA DIR
|
||||
#=================================================
|
||||
|
||||
ynh_backup --src_path="$datadir" --is_big
|
||||
ynh_backup --src_path="$data_dir" --is_big
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -9,68 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS
|
||||
#=================================================
|
||||
|
||||
old_domain=$YNH_APP_OLD_DOMAIN
|
||||
old_path=$YNH_APP_OLD_PATH
|
||||
|
||||
new_domain=$YNH_APP_NEW_DOMAIN
|
||||
new_path=$YNH_APP_NEW_PATH
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
language_key=$(ynh_app_setting_get --app=$app --key=language_key)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# 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"
|
||||
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# CHECK WHICH PARTS SHOULD BE CHANGED
|
||||
#=================================================
|
||||
|
||||
change_domain=0
|
||||
if [ "$old_domain" != "$new_domain" ]
|
||||
then
|
||||
change_domain=1
|
||||
fi
|
||||
|
||||
change_path=0
|
||||
if [ "$old_path" != "$new_path" ]
|
||||
then
|
||||
change_path=1
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -86,29 +24,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# 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
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||
fi
|
||||
ynh_change_url_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC MODIFICATIONS
|
||||
|
@ -118,12 +34,12 @@ fi
|
|||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
domain=$new_domain
|
||||
path_url=$new_path
|
||||
path=$new_path
|
||||
|
||||
ynh_add_config --template="options.yml" --destination="$final_path/live/config/options.yml"
|
||||
ynh_add_config --template="options.yml" --destination="$install_dir/live/config/options.yml"
|
||||
|
||||
chmod 400 "$final_path/live/config/options.yml"
|
||||
chown $app:$app "$final_path/live/config/options.yml"
|
||||
chmod 400 "$install_dir/live/config/options.yml"
|
||||
chown $app:$app "$install_dir/live/config/options.yml"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
@ -133,14 +49,7 @@ chown $app:$app "$final_path/live/config/options.yml"
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
143
scripts/install
143
scripts/install
|
@ -9,103 +9,36 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url=$YNH_APP_ARG_PATH
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
if [ $language == "fr" ]; then
|
||||
language_key="french"
|
||||
else
|
||||
language_key="english"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_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
|
||||
|
||||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
|
||||
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=language_key --value=$language_key
|
||||
ynh_app_setting_set --app=$app --key=password --value=$password
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..."
|
||||
|
||||
# Find an available port
|
||||
port=$(ynh_find_port --port=8095)
|
||||
ynh_app_setting_set --app=$app --key=port --value=$port
|
||||
|
||||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..."
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
||||
# Not saved by default
|
||||
ynh_app_setting_set --app=$app --key=password --value="$password"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path/build/" --source_id="docker-image-extract"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -122,44 +55,39 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Making install..."
|
||||
|
||||
# Install photoprism
|
||||
pushd $final_path/build
|
||||
detect_arch
|
||||
./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION
|
||||
popd
|
||||
mkdir -p "$final_path/live/"
|
||||
rsync -a "$final_path/build/output/opt/photoprism/" "$final_path/live/"
|
||||
ynh_secure_remove --file="$final_path/build"
|
||||
ynh_setup_source --dest_dir="$install_dir/build"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
mkdir -p "$install_dir/live/"
|
||||
|
||||
rsync -a "$install_dir/build/opt/photoprism/" "$install_dir/live/"
|
||||
ynh_secure_remove --file="$install_dir/build"
|
||||
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
#mkdir -p $data_dir
|
||||
rsync -a "$install_dir/live/assets/" "$data_dir/assets/"
|
||||
ynh_secure_remove --file="$install_dir/live/assets/"
|
||||
|
||||
mkdir -p $datadir
|
||||
rsync -a "$final_path/live/assets/" "$datadir/assets/"
|
||||
ynh_secure_remove --file="$final_path/live/assets/"
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
|
||||
|
||||
chmod 600 "$final_path/.env"
|
||||
chown $app:$app "$final_path/.env"
|
||||
chmod 600 "$install_dir/.env"
|
||||
chown $app:$app "$install_dir/.env"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -192,30 +120,7 @@ yunohost service add $app --description="AI-Powered Photos App for the Decentral
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
|
||||
# Make app public if necessary
|
||||
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"
|
||||
fi
|
||||
|
||||
# Permission to make link-sharing work
|
||||
ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -9,20 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
#=================================================
|
||||
|
@ -52,33 +38,6 @@ ynh_script_progression --message="Removing logrotate configuration..."
|
|||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..."
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..."
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -87,24 +46,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
|
|||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
||||
#=================================================
|
||||
# CLOSE A PORT
|
||||
#=================================================
|
||||
|
||||
if yunohost firewall list | grep -q "\- $port$"
|
||||
then
|
||||
ynh_script_progression --message="Closing port $port..."
|
||||
ynh_exec_warn_less yunohost firewall disallow TCP $port
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC REMOVE
|
||||
#=================================================
|
||||
|
@ -115,16 +56,6 @@ ynh_script_progression --message="Removing various files..."
|
|||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -10,81 +10,41 @@
|
|||
source ../settings/scripts/_common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# MANAGE SCRIPT FAILURE
|
||||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
ynh_restore_file --origin_path="$install_dir"
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
ynh_restore_file --origin_path="$data_dir" --not_mandatory
|
||||
|
||||
mkdir -p $datadir
|
||||
mkdir -p $data_dir
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC RESTORATION
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
|
@ -93,14 +53,6 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
|
|||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..."
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
|
@ -132,7 +84,7 @@ yunohost service add $app --description="AI-Powered Photos App for the Decentral
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at"
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
|
126
scripts/upgrade
126
scripts/upgrade
|
@ -9,23 +9,6 @@
|
|||
source _common.sh
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
language_key=$(ynh_app_setting_get --app=$app --key=language_key)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
password=$(ynh_app_setting_get --app=$app --key=password)
|
||||
|
||||
#=================================================
|
||||
# CHECK VERSION
|
||||
|
@ -34,29 +17,6 @@ ynh_script_progression --message="Checking version..."
|
|||
|
||||
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)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
|
@ -64,48 +24,12 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
|||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# If language_key doesn't exist, create it
|
||||
if [ -z "$language_key" ]; then
|
||||
if [ -z "${language_key:-}" ]; then
|
||||
language_key=$(ynh_app_setting_get --app=$app --key=language)
|
||||
ynh_app_setting_set --app=$app --key=language_key --value=$language_key
|
||||
ynh_app_setting_delete --app=$app --key=language
|
||||
fi
|
||||
|
||||
# Create sharing permission if needed
|
||||
if ! ynh_permission_exists --permission="sharing"; then
|
||||
ynh_permission_create --permission="sharing" --url="/s" --allowed="visitors" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$final_path/build/" --source_id="docker-image-extract"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -123,45 +47,44 @@ ynh_script_progression --message="Making install..."
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
# Install photoprism
|
||||
pushd $final_path/build
|
||||
detect_arch
|
||||
./docker-image-extract photoprism/photoprism:$PHOTOPRISM_VERSION
|
||||
popd
|
||||
mkdir -p "$final_path/live/"
|
||||
rsync -a "$final_path/build/output/opt/photoprism/" "$final_path/live/"
|
||||
ynh_secure_remove --file="$final_path/build"
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir/build/"
|
||||
|
||||
mkdir -p "$install_dir/live/"
|
||||
rsync -a "$install_dir/build/opt/photoprism/" "$install_dir/live/"
|
||||
ynh_secure_remove --file="$install_dir/build"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
chmod 750 "$install_dir"
|
||||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:$app "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# UPDATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating data directory..."
|
||||
|
||||
mkdir -p $datadir
|
||||
mkdir -p $data_dir
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
rsync -a "$final_path/live/assets/" "$datadir/assets/"
|
||||
ynh_secure_remove --file="$final_path/live/assets/"
|
||||
rsync -a "$install_dir/live/assets/" "$data_dir/assets/"
|
||||
ynh_secure_remove --file="$install_dir/live/assets/"
|
||||
fi
|
||||
|
||||
chmod 750 "$datadir"
|
||||
chmod -R o-rwx "$datadir"
|
||||
chown -R $app:www-data "$datadir"
|
||||
chmod 750 "$data_dir"
|
||||
chmod -R o-rwx "$data_dir"
|
||||
chown -R $app:www-data "$data_dir"
|
||||
|
||||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
|
||||
ynh_add_config --template="../conf/.env" --destination="$install_dir/.env"
|
||||
|
||||
chmod 600 "$final_path/.env"
|
||||
chown $app:$app "$final_path/.env"
|
||||
chmod 600 "$install_dir/.env"
|
||||
chown $app:$app "$install_dir/.env"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -193,14 +116,7 @@ yunohost service add $app --description="AI-Powered Photos App for the Decentral
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="http: starting web server at"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
ynh_exec_warn_less ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Started AI-Powered Photos App for the Decentralized Web"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
5
tests.toml
Normal file
5
tests.toml
Normal file
|
@ -0,0 +1,5 @@
|
|||
test_format = 1.0
|
||||
|
||||
[default]
|
||||
|
||||
test_upgrade_from.fe71ba9.name = "Packaging v1"
|
Loading…
Add table
Reference in a new issue