1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/immich_ynh.git synced 2024-09-03 20:36:24 +02:00

Merge pull request #21 from YunoHost-Apps/testing

Testing - simplification
This commit is contained in:
ewilly 2024-04-03 07:38:49 +02:00 committed by GitHub
commit 9c8e0fac60
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 186 additions and 115 deletions

View file

@ -1,3 +1,6 @@
# All available README files by language
- [Read the README in English](README.md)
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)

View file

@ -24,7 +24,7 @@ Self-hosted photo and video management solution.
- Easy-to-use and friendly interface ;
**Shipped version:** 1.98.2~ynh1
**Shipped version:** 1.100.0~ynh1
## Screenshots
@ -32,7 +32,7 @@ Self-hosted photo and video management solution.
## Documentation and resources
- Official app website: <https://www.immich.app>
- Official app website: <https://immich.app>
- Official user documentation: <https://github.com/immich-app/immich#getting-started>
- Official admin documentation: <https://github.com/immich-app/immich#getting-started>
- Upstream app code repository: <https://github.com/immich-app/immich>

54
README_eu.md Normal file
View file

@ -0,0 +1,54 @@
<!--
Ohart ongi: README hau automatikoki sortu da <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>ri esker
EZ editatu eskuz.
-->
# Immich YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/immich.svg)](https://dash.yunohost.org/appci/app/immich) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/immich.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/immich.maintain.svg)
[![Instalatu Immich YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=immich)
*[Irakurri README hau beste hizkuntzatan.](./ALL_README.md)*
> *Pakete honek Immich YunoHost zerbitzari batean azkar eta zailtasunik gabe instalatzea ahalbidetzen dizu.*
> *YunoHost ez baduzu, kontsultatu [gida](https://yunohost.org/install) nola instalatu ikasteko.*
## Aurreikuspena
Self-hosted photo and video management solution.
### Features
- Simple-to-use backup tool with a native mobile app that can view photos and videos efficiently ;
- Easy-to-use and friendly interface ;
**Paketatutako bertsioa:** 1.100.0~ynh1
## Pantaila-argazkiak
![Immich(r)en pantaila-argazkia](./doc/screenshots/immich-screenshots.png)
## Dokumentazioa eta baliabideak
- Aplikazioaren webgune ofiziala: <https://immich.app>
- Erabiltzaileen dokumentazio ofiziala: <https://github.com/immich-app/immich#getting-started>
- Administratzaileen dokumentazio ofiziala: <https://github.com/immich-app/immich#getting-started>
- Jatorrizko aplikazioaren kode-gordailua: <https://github.com/immich-app/immich>
- YunoHost Denda: <https://apps.yunohost.org/app/immich>
- Eman errore baten berri: <https://github.com/YunoHost-Apps/immich_ynh/issues>
## Garatzaileentzako informazioa
Bidali `pull request`a [`testing` abarrera](https://github.com/YunoHost-Apps/immich_ynh/tree/testing).
`testing` abarra probatzeko, ondorengoa egin:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/immich_ynh/tree/testing --debug
edo
sudo yunohost app upgrade immich -u https://github.com/YunoHost-Apps/immich_ynh/tree/testing --debug
```
**Informazio gehiago aplikazioaren paketatzeari buruz:** <https://yunohost.org/packaging_apps>

View file

@ -24,7 +24,7 @@ Solution d'autohébergement pour a gestion de vos photos et vidéos.
- Interface conviviale et egronomique ;
**Version incluse:** 1.98.2~ynh1
**Version incluse:** 1.100.0~ynh1
## Captures décran
@ -32,7 +32,7 @@ Solution d'autohébergement pour a gestion de vos photos et vidéos.
## Documentations et ressources
- Site officiel de lapp: <https://www.immich.app>
- Site officiel de lapp: <https://immich.app>
- Documentation officielle utilisateur: <https://github.com/immich-app/immich#getting-started>
- Documentation officielle de ladmin: <https://github.com/immich-app/immich#getting-started>
- Dépôt de code officiel de lapp: <https://github.com/immich-app/immich>

View file

@ -24,7 +24,7 @@ Self-hosted photo and video management solution.
- Easy-to-use and friendly interface ;
**Versión proporcionada:** 1.98.2~ynh1
**Versión proporcionada:** 1.100.0~ynh1
## Capturas de pantalla
@ -32,7 +32,7 @@ Self-hosted photo and video management solution.
## Documentación e recursos
- Web oficial da app: <https://www.immich.app>
- Web oficial da app: <https://immich.app>
- Documentación oficial para usuarias: <https://github.com/immich-app/immich#getting-started>
- Documentación oficial para admin: <https://github.com/immich-app/immich#getting-started>
- Repositorio de orixe do código: <https://github.com/immich-app/immich>

View file

@ -9,6 +9,7 @@ SERVER_PORT=__PORT__
MICROSERVICES_PORT=__PORT_MICROSERVICES__
MACHINE_LEARNING_HOST=127.0.0.1
MACHINE_LEARNING_PORT=__PORT_MACHINELEARNING__
IMMICH_MACHINE_LEARNING_URL=127.0.0.1:__PORT_MACHINELEARNING__
## Database
DB_HOSTNAME=127.0.0.1

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "immich"
@ -5,13 +7,13 @@ name = "Immich"
description.en = "Photo and video backup solution directly from your mobile phone"
description.fr = "Sauvegarde de photos et de vidéos directement depuis votre mobile"
version = "1.98.2~ynh1"
version = "1.100.0~ynh1"
maintainers = ["ewilly"]
[upstream]
license = "AGPL-3.0-or-later"
website = "https://www.immich.app"
website = "https://immich.app"
admindoc = "https://github.com/immich-app/immich#getting-started"
userdoc = "https://github.com/immich-app/immich#getting-started"
code = "https://github.com/immich-app/immich"
@ -40,11 +42,26 @@ ram.runtime = "500M"
[resources.sources]
[resources.sources.main]
url = "https://github.com/immich-app/immich/archive/refs/tags/v1.98.2.tar.gz"
sha256 = "3fd79057b41a235518dde50ce62a2314758329c20360f462f77bba949f35d306"
url = "https://github.com/immich-app/immich/archive/refs/tags/v1.100.0.tar.gz"
sha256 = "13f00122d97f75293d4b1ac3385d40ebf07278f3b14ac2c7898138d9cf446fbb"
autoupdate.strategy = "latest_github_release"
[resources.sources.geonames_cities]
url = "https://download.geonames.org/export/dump/cities500.zip"
sha256 = "6f11390524953d068439b0a55dab36f5bf86f4e5615da4ac00d724c1d167f847"
in_subdir = false
[resources.sources.geonames_divisions]
url = "https://download.geonames.org/export/dump/admin1CodesASCII.txt"
sha256 = "6eace8b269cd4c9635d8f8631857c0be2cb3fb6362495f77f17f266ef7328f11"
rename = "admin1CodesASCII.txt"
[resources.sources.geonames_subdivisions]
url = "https://download.geonames.org/export/dump/admin2Codes.txt"
sha256 = "defbd99329530fa6b06e154662fb16a51a0c12caf41636be17597c58c5374f1c"
rename = "admin2Codes.txt"
[resources.ports]
main.default = 3001
microservices.default = 3002
@ -66,11 +83,32 @@ ram.runtime = "500M"
api.protected = true
[resources.apt]
packages = ["python3-venv", "python3-dev", "ffmpeg", "postgresql", "wget", "build-essential", "libreadline-dev", "libncursesw5-dev", "libssl-dev", "libsqlite3-dev", "tk-dev", "libgdbm-dev", "libc6-dev", "libbz2-dev", "libffi-dev", "zlib1g-dev", "unzip"]
packages = [
"python3-venv",
"python3-dev",
"ffmpeg",
"postgresql",
"wget",
"build-essential",
"libreadline-dev",
"libncursesw5-dev",
"libssl-dev",
"libsqlite3-dev",
"tk-dev",
"libgdbm-dev",
"libc6-dev",
"libbz2-dev",
"libffi-dev",
"zlib1g-dev",
"unzip"
]
extras.postgresql.repo = "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main 16"
extras.postgresql.key = "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
extras.postgresql.packages = ["libllvm13", "libpq5", "libpq-dev" , "postgresql-16", "postgresql-16-pgvector", "postgresql-client-16", "postgresql-common", "postgresql-client-common"]
[resources.apt.extras.postgresql]
repo = "deb https://apt.postgresql.org/pub/repos/apt bullseye-pgdg main 16"
key = "https://www.postgresql.org/media/keys/ACCC4CF8.asc"
packages = [
"libllvm13", "libpq5", "libpq-dev" , "postgresql-16", "postgresql-16-pgvector", "postgresql-client-16", "postgresql-common", "postgresql-client-common"
]
[resources.database]
type = "postgresql"

View file

@ -4,29 +4,9 @@
# COMMON VARIABLES
#=================================================
if [[ ${BASH_SOURCE[0]} == "../settings/"* ]]
then
manifest_path="../settings/manifest.toml"
else
manifest_path="../manifest.toml"
fi
# App version
## yq is not a dependencie of yunohost package so tomlq command is not available
## (see https://github.com/YunoHost/yunohost/blob/dev/debian/control)
app_version=$(cat "$manifest_path" 2>/dev/null \
| grep 'version = ' | cut -d '=' -f 2 \
| cut -d '~' -f 1 | tr -d ' "') #2024.2.5
app_version="v$app_version"
# NodeJS required version
nodejs_version=20
# PostgreSQL required version
postgresql_version=$(cat "$manifest_path" 2>/dev/null \
| grep -o 'postgresql-[0-9][0-9]-pgvector' \
| head -n1 | cut -d'-' -f2) #16
# Fail2ban
failregex="immich-server.*Failed login attempt for user.+from ip address\s?<ADDR>"
@ -34,6 +14,12 @@ failregex="immich-server.*Failed login attempt for user.+from ip address\s?<ADDR
# PERSONAL HELPERS
#=================================================
# PostgreSQL required version
postgresql_version() {
ynh_read_manifest --manifest_key="resources.apt.extras.postgresql.packages" \
| grep -o 'postgresql-[0-9][0-9]-pgvector' | head -n1 | cut -d'-' -f2
}
# Retrieve full latest python version from major version
# usage: py_latest_from_major --python="3.8"
# | arg: -p, --python= - the major python version
@ -138,30 +124,30 @@ myynh_install_immich() {
ynh_use_nodejs
# Install immich-server
cd "$tmpdir/server"
cd "$source_dir/server"
ynh_exec_warn_less "$ynh_npm" ci
ynh_exec_warn_less "$ynh_npm" run build
ynh_exec_warn_less "$ynh_npm" prune --omit=dev --omit=optional
cd "$tmpdir/open-api/typescript-sdk"
cd "$source_dir/open-api/typescript-sdk"
ynh_exec_warn_less "$ynh_npm" ci
ynh_exec_warn_less "$ynh_npm" run build
cd "$tmpdir/web"
cd "$source_dir/web"
ynh_exec_warn_less "$ynh_npm" ci
ynh_exec_warn_less "$ynh_npm" run build
mkdir -p "$install_dir/app/"
cp -a "$tmpdir/server/node_modules" "$install_dir/app/"
cp -a "$tmpdir/server/dist" "$install_dir/app/"
cp -a "$tmpdir/server/bin" "$install_dir/app/"
cp -a "$tmpdir/web/build" "$install_dir/app/www"
cp -a "$tmpdir/server/resources" "$install_dir/app/"
cp -a "$tmpdir/server/package.json" "$install_dir/app/"
cp -a "$tmpdir/server/package-lock.json" "$install_dir/app/"
cp -a "$tmpdir/server/start-microservices.sh" "$install_dir/app/"
cp -a "$tmpdir/server/start-server.sh" "$install_dir/app/"
cp -a "$tmpdir/LICENSE" "$install_dir/app/"
cp -a "$source_dir/server/node_modules" "$install_dir/app/"
cp -a "$source_dir/server/dist" "$install_dir/app/"
cp -a "$source_dir/server/bin" "$install_dir/app/"
cp -a "$source_dir/web/build" "$install_dir/app/www"
cp -a "$source_dir/server/resources" "$install_dir/app/"
cp -a "$source_dir/server/package.json" "$install_dir/app/"
cp -a "$source_dir/server/package-lock.json" "$install_dir/app/"
cp -a "$source_dir/server/start-microservices.sh" "$install_dir/app/"
cp -a "$source_dir/server/start-server.sh" "$install_dir/app/"
cp -a "$source_dir/LICENSE" "$install_dir/app/"
# Install custom start.sh script
ynh_add_config --template="immich-server-start.sh" --destination="$install_dir/app/start.sh"
chmod +x "$install_dir/app/start.sh"
@ -169,7 +155,7 @@ myynh_install_immich() {
ynh_exec_warn_less "$ynh_npm" cache clean --force
# Install immich-machine-learning
cd "$tmpdir/machine-learning"
cd "$source_dir/machine-learning"
mkdir -p "$install_dir/app/machine-learning"
$py_app_version -m venv "$install_dir/app/machine-learning/venv"
(
@ -184,8 +170,8 @@ myynh_install_immich() {
# poetry install
ynh_exec_warn_less "$install_dir/app/machine-learning/venv/bin/poetry" install --no-root --with dev --with cpu
)
cp -a "$tmpdir/machine-learning/ann" "$install_dir/app/machine-learning/"
cp -a "$tmpdir/machine-learning/app" "$install_dir/app/machine-learning/"
cp -a "$source_dir/machine-learning/ann" "$install_dir/app/machine-learning/"
cp -a "$source_dir/machine-learning/app" "$install_dir/app/machine-learning/"
# Install custom start.sh script
ynh_add_config --template="immich-machine-learning-start.sh" --destination="$install_dir/app/machine-learning/start.sh"
chmod +x "$install_dir/app/machine-learning/start.sh"
@ -202,22 +188,17 @@ myynh_install_immich() {
ynh_exec_warn_less "$ynh_npm" install sharp
# Use 127.0.0.1 for microservices
sed -i -e "s@app.listen(port)@app.listen(port, '127.0.0.1')@g" "$install_dir/app/dist/microservices/main.js"
# Cleanup
ynh_secure_remove --file="$tmpdir"
sed -i -e "s@app.listen(port)@app.listen(port, '127.0.0.1')@g" "$install_dir/app/dist/main.js"
# Install geonames
wget --output-document="$install_dir/resources/cities500.zip" \
"https://download.geonames.org/export/dump/cities500.zip" 2>&1
unzip "$install_dir/resources/cities500.zip" -d "$install_dir/resources/"
ynh_secure_remove --file="$install_dir/resources/cities500.zip"
wget --output-document="$install_dir/resources/admin1CodesASCII.txt" \
"https://download.geonames.org/export/dump/admin1CodesASCII.txt" 2>&1
wget --output-document="$install_dir/resources/admin2Codes.txt" \
"https://download.geonames.org/export/dump/admin2Codes.txt" 2>&1
cp -a "$source_dir/geonames_cities/cities500.txt" "$install_dir/resources/"
cp -a "$source_dir/geonames_divisions/admin1CodesASCII.txt" "$install_dir/resources/"
cp -a "$source_dir/geonames_subdivisions/admin2Codes.txt" "$install_dir/resources/"
date --iso-8601=seconds | tr -d "\n" > "$install_dir/resources/geodata-date.txt"
# Cleanup
ynh_secure_remove --file="$source_dir"
# Fix permissisons
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
@ -244,7 +225,7 @@ myynh_execute_psql_as_root() {
fi
sudo --login --user=postgres PGUSER=postgres PGPASSWORD="$(cat $PSQL_ROOT_PWD_FILE)" \
psql --cluster="$postgresql_version/main" "$database" --command="$sql"
psql --cluster="$(postgresql_version)/main" "$database" --command="$sql"
}
# Install the database
@ -278,7 +259,7 @@ myynh_restore_psql_db() {
--replace_string="SELECT pg_catalog.set_config('search_path', 'public, pg_catalog', true);" --target_file="db.sql"
sudo --login --user=postgres PGUSER=postgres PGPASSWORD="$(cat $PSQL_ROOT_PWD_FILE)" \
psql --cluster="$postgresql_version/main" --dbname="$app" < ./db.sql
psql --cluster="$(postgresql_version)/main" --dbname="$app" < ./db.sql
}
#=================================================

View file

@ -13,15 +13,18 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
tmpdir="$(mktemp --directory)"
ynh_setup_source --source_id="main" --dest_dir="$tmpdir"
source_dir="$install_dir/source"
ynh_setup_source --source_id="main" --dest_dir="$source_dir"
ynh_setup_source --source_id="geonames_cities" --dest_dir="$source_dir/geonames_cities/"
ynh_setup_source --source_id="geonames_divisions" --dest_dir="$source_dir/geonames_divisions/"
ynh_setup_source --source_id="geonames_subdivisions" --dest_dir="$source_dir/geonames_subdivisions/"
#=================================================
# CHECK PYTHON VERSION AND COMPILE IF NEEDED
#=================================================
ynh_script_progression --message="Check Python version & compile the required one if needed..." --weight=1
py_required_major=$(cat "$tmpdir/machine-learning/Dockerfile" | grep "FROM python:" | head -n1 | cut -d':' -f2 | cut -d'-' -f1)
py_required_major=$(cat "$source_dir/machine-learning/Dockerfile" | grep "FROM python:" | head -n1 | cut -d':' -f2 | cut -d'-' -f1)
myynh_py_latest_from_major --python="$py_required_major"
myynh_install_python --python="$py_required_version"
@ -41,7 +44,7 @@ db_pwd=$(ynh_string_random)
myynh_create_psql_db
db_port=$(myynh_execute_psql_as_root --sql="\conninfo" | cut -d'"' -f8)
ynh_app_setting_set --app="$app" --key=psql_pwd --value="$db_pwd"
ynh_app_setting_set --app="$app" --key=psql_version --value="$postgresql_version"
ynh_app_setting_set --app="$app" --key=psql_version --value="$(postgresql_version)"
ynh_app_setting_set --app="$app" --key=psql_port --value="$db_port"
#=================================================

View file

@ -12,33 +12,27 @@ source /usr/share/yunohost/helpers
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status "$app-server" >/dev/null
then
ynh_script_progression --message="Removing $app-server service integration..." --weight=1
if ynh_exec_warn_less yunohost service status "$app-server" >/dev/null; then
yunohost service remove "$app-server"
fi
if ynh_exec_warn_less yunohost service status "$app-microservices" >/dev/null
then
ynh_script_progression --message="Removing $app-microservices service integration..." --weight=1
if ynh_exec_warn_less yunohost service status "$app-microservices" >/dev/null; then
yunohost service remove "$app-microservices"
fi
if ynh_exec_warn_less yunohost service status "$app-machine-learning" >/dev/null
then
ynh_script_progression --message="Removing $app-machine-learning service integration..." --weight=1
if ynh_exec_warn_less yunohost service status "$app-machine-learning" >/dev/null; then
yunohost service remove "$app-machine-learning"
fi
# Remove the dedicated systemd config
ynh_remove_systemd_config --service="immich-server"
ynh_remove_systemd_config --service="immich-microservices"
ynh_remove_systemd_config --service="immich-machine-learning"
# Remove the app-specific fail2ban config
ynh_remove_fail2ban_config
# Remove the app-specific logrotate config
ynh_remove_logrotate
# Remove the dedicated systemd config
ynh_remove_systemd_config --service="immich-server"
ynh_remove_systemd_config --service="immich-microservices"
ynh_remove_systemd_config --service="immich-machine-learning"
# Remove the dedicated NGINX config
ynh_remove_nginx_config

View file

@ -6,11 +6,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
@ -26,38 +21,38 @@ ynh_systemd_action --service_name="$app-machine-learning" --action="stop"
#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
#=================================================
# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
tmpdir="$(mktemp --directory)"
ynh_setup_source --source_id="main" --dest_dir="$tmpdir"
ynh_script_progression --message="Upgrading source files..." --weight=1
#=================================================
# CHECK PYTHON VERSION AND COMPILE IF NEEDED
#=================================================
ynh_script_progression --message="Check Python version & compile the required one if needed..." --weight=1
py_required_major=$(cat "$tmpdir/machine-learning/Dockerfile" | grep "FROM python:" | head -n1 | cut -d':' -f2 | cut -d'-' -f1)
myynh_py_latest_from_major --python="$py_required_major"
myynh_install_python --python="$py_required_version"
source_dir="$install_dir/source"
ynh_setup_source --source_id="main" --dest_dir="$source_dir" --full_replace=1
ynh_setup_source --source_id="geonames_cities" --dest_dir="$source_dir/geonames_cities/" --full_replace=1
ynh_setup_source --source_id="geonames_divisions" --dest_dir="$source_dir/geonames_divisions/" --full_replace=1
ynh_setup_source --source_id="geonames_subdivisions" --dest_dir="$source_dir/geonames_subdivisions/" --full_replace=1
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing nodejs..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
#=================================================
# CHECK PYTHON VERSION AND COMPILE IF NEEDED
#=================================================
ynh_script_progression --message="Check Python version & compile the required one if needed..." --weight=1
#=================================================
# MAKE INSTALL
#=================================================
ynh_script_progression --message="Making install..." --weight=5
ynh_secure_remove --file="$install_dir"
myynh_install_immich
fi
py_required_major=$(cat "$source_dir/machine-learning/Dockerfile" | grep "FROM python:" | head -n1 | cut -d':' -f2 | cut -d'-' -f1)
myynh_py_latest_from_major --python="$py_required_major"
myynh_install_python --python="$py_required_version"
#=================================================
# INSTALL NODEJS
#=================================================
ynh_script_progression --message="Installing nodejs..." --weight=1
ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version"
#=================================================
# MAKE INSTALL
#=================================================
ynh_script_progression --message="Making install..." --weight=5
myynh_install_immich
#=================================================
# UPDATE A CONFIG FILE

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0
[default]