1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/lemmy_ynh.git synced 2024-09-03 19:36:09 +02:00
This commit is contained in:
Salamandar 2024-07-29 07:01:07 +00:00 committed by GitHub
commit 4581dee2d9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 267 additions and 322 deletions

View file

@ -5,4 +5,5 @@
- [Irakurri README euskaraz](README_eu.md)
- [Lire le README en français](README_fr.md)
- [Le o README en galego](README_gl.md)
- [Baca README dalam bahasa bahasa Indonesia](README_id.md)
- [阅读中文(简体)的 README](README_zh_Hans.md)

View file

@ -5,7 +5,7 @@ It shall NOT be edited by hand.
# Lemmy for YunoHost
[![Integration level](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Working status](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/lemmy.svg)](https://ci-apps.yunohost.org/ci/apps/lemmy/) ![Working status](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Install Lemmy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
@ -19,7 +19,7 @@ It shall NOT be edited by hand.
Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**Shipped version:** 0.18.2~ynh3
**Shipped version:** 0.19.5~ynh2
**Demo:** <https://lemmy.ml/>

View file

@ -5,7 +5,7 @@ No se debe editar a mano.
# Lemmy para Yunohost
[![Nivel de integración](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Nivel de integración](https://dash.yunohost.org/integration/lemmy.svg)](https://ci-apps.yunohost.org/ci/apps/lemmy/) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Instalar Lemmy con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
@ -19,7 +19,7 @@ No se debe editar a mano.
Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**Versión actual:** 0.18.2~ynh3
**Versión actual:** 0.19.5~ynh2
**Demo:** <https://lemmy.ml/>

View file

@ -5,7 +5,7 @@ EZ editatu eskuz.
# Lemmy YunoHost-erako
[![Integrazio maila](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Integrazio maila](https://dash.yunohost.org/integration/lemmy.svg)](https://ci-apps.yunohost.org/ci/apps/lemmy/) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Instalatu Lemmy YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
@ -19,7 +19,7 @@ EZ editatu eskuz.
Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**Paketatutako bertsioa:** 0.18.2~ynh3
**Paketatutako bertsioa:** 0.19.5~ynh2
**Demoa:** <https://lemmy.ml/>

View file

@ -5,7 +5,7 @@ Il NE doit PAS être modifié à la main.
# Lemmy pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/lemmy.svg)](https://ci-apps.yunohost.org/ci/apps/lemmy/) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Installer Lemmy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
@ -18,7 +18,7 @@ Il NE doit PAS être modifié à la main.
Lemmy est similaire à des sites comme Reddit, Lobste.rs ou Hacker News : vous vous abonnez aux forums qui vous intéressent, publiez des liens et des discussions, puis votez et commentez-les. Dans les coulisses, c'est très différent ; n'importe qui peut facilement exécuter un serveur, et tous ces serveurs sont fédérés (pensez au courrier électronique) et connectés au même univers, appelé Fediverse.
**Version incluse:** 0.18.2~ynh3
**Version incluse:** 0.19.5~ynh2
**Démo:** <https://lemmy.ml/>

View file

@ -5,7 +5,7 @@ NON debe editarse manualmente.
# Lemmy para YunoHost
[![Nivel de integración](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Nivel de integración](https://dash.yunohost.org/integration/lemmy.svg)](https://ci-apps.yunohost.org/ci/apps/lemmy/) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Instalar Lemmy con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
@ -19,7 +19,7 @@ NON debe editarse manualmente.
Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**Versión proporcionada:** 0.18.2~ynh3
**Versión proporcionada:** 0.19.5~ynh2
**Demo:** <https://lemmy.ml/>

50
README_id.md Normal file
View file

@ -0,0 +1,50 @@
<!--
N.B.: README ini dibuat secara otomatis oleh <https://github.com/YunoHost/apps/tree/master/tools/readme_generator>
Ini TIDAK boleh diedit dengan tangan.
-->
# Lemmy untuk YunoHost
[![Tingkat integrasi](https://dash.yunohost.org/integration/lemmy.svg)](https://ci-apps.yunohost.org/ci/apps/lemmy/) ![Status kerja](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Status pemeliharaan](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![Pasang Lemmy dengan YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
*[Baca README ini dengan bahasa yang lain.](./ALL_README.md)*
> *Paket ini memperbolehkan Anda untuk memasang Lemmy secara cepat dan mudah pada server YunoHost.*
> *Bila Anda tidak mempunyai YunoHost, silakan berkonsultasi dengan [panduan](https://yunohost.org/install) untuk mempelajari bagaimana untuk memasangnya.*
## Ringkasan
Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**Versi terkirim:** 0.19.5~ynh2
**Demo:** <https://lemmy.ml/>
## Tangkapan Layar
![Tangkapan Layar pada Lemmy](./doc/screenshots/screenshot1.webp)
## Dokumentasi dan sumber daya
- Website aplikasi resmi: <https://join-lemmy.org/>
- Dokumentasi admin resmi: <https://join-lemmy.org/docs/en/>
- Depot kode aplikasi hulu: <https://github.com/LemmyNet/lemmy>
- Gudang YunoHost: <https://apps.yunohost.org/app/lemmy>
- Laporkan bug: <https://github.com/YunoHost-Apps/lemmy_ynh/issues>
## Info developer
Silakan kirim pull request ke [`testing` branch](https://github.com/YunoHost-Apps/lemmy_ynh/tree/testing).
Untuk mencoba branch `testing`, silakan dilanjutkan seperti:
```bash
sudo yunohost app install https://github.com/YunoHost-Apps/lemmy_ynh/tree/testing --debug
atau
sudo yunohost app upgrade lemmy -u https://github.com/YunoHost-Apps/lemmy_ynh/tree/testing --debug
```
**Info lebih lanjut mengenai pemaketan aplikasi:** <https://yunohost.org/packaging_apps>

View file

@ -5,7 +5,7 @@
# YunoHost 上的 Lemmy
[![集成程度](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![工作状态](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![集成程度](https://dash.yunohost.org/integration/lemmy.svg)](https://ci-apps.yunohost.org/ci/apps/lemmy/) ![工作状态](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
[![使用 YunoHost 安装 Lemmy](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
@ -19,7 +19,7 @@
Lemmy is similar to sites like Reddit, Lobste.rs, or Hacker News: you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the Fediverse.
**分发版本:** 0.18.2~ynh3
**分发版本:** 0.19.5~ynh2
**演示:** <https://lemmy.ml/>

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2
id = "lemmy"
@ -5,7 +7,7 @@ name = "Lemmy"
description.en = "Link aggregator/Reddit clone for the fediverse"
description.fr = "Agrégateur de liens/clone Reddit pour le fedivers"
version = "0.18.2~ynh3"
version = "0.19.5~ynh2"
maintainers = []
@ -39,17 +41,26 @@ ram.runtime = "50M"
[resources]
[resources.sources]
[resources.sources.main]
url = "https://github.com/jjlin/docker-image-extract/archive/b664b29a1de37d25f732e885e1331a8e90f67dcd.tar.gz"
sha256 = "7b2c8baeec6e9a67c905d4d55e4dc0944815cf55bd6bf11fadbb6eb8990b4912"
autoupdate.upstream = "https://github.com/jjlin/docker-image-extract"
autoupdate.strategy = "latest_github_commit"
[resources.sources.main]
url = "https://github.com/LemmyNet/lemmy/archive/refs/tags/0.19.5.tar.gz"
sha256 = "55fc078688867ce662416f6eaf1fabe33d6a9551226abbc341ec4b42dcf78610"
# Actually not used, just here for autoupdate
prefetch = false
autoupdate.strategy = "latest_github_release"
[resources.sources.lemmy-translations]
url = "https://github.com/LemmyNet/lemmy-translations/archive/f1602a5993c426d56ebb7c98a8453fbfb482e9a7.tar.gz"
sha256 = "570d3f8c1ab13dbf72fd2f2f6d7a930a5fd7233259fbd0f1b156205524f0e4c3"
autoupdate.upstream = "https://github.com/LemmyNet/lemmy-translations/"
autoupdate.strategy = "latest_github_commit"
[resources.sources.docker-image-extract]
url = "https://github.com/jjlin/docker-image-extract/archive/4273b2796da5055e431b4db5efe29a71bba12b45.tar.gz"
sha256 = "8e582bb186bdb1053051ad6be8829ebb4af418cb4e43005efc9d7749e0269cba"
autoupdate.upstream = "https://github.com/jjlin/docker-image-extract"
autoupdate.strategy = "latest_github_commit"
[resources.sources.lemmy-translations]
url = "https://github.com/LemmyNet/lemmy-translations/archive/088a27703ffa65e069dfbf341ee9bd44ec4c45c5.tar.gz"
sha256 = "b504c50878a7914bdc49ea578a8c4855152de6f50a94c3cf053954ef903cd93e"
autoupdate.upstream = "https://github.com/LemmyNet/lemmy-translations/"
autoupdate.strategy = "latest_github_commit"
[resources.ports]
main.default = 8536
@ -71,7 +82,7 @@ ram.runtime = "50M"
pictrs.allowed = "visitors"
pictrs.show_tile = false
pictrs.protected = true
api.url = "/api"
api.allowed = "visitors"
api.auth_header = false
@ -85,10 +96,19 @@ ram.runtime = "50M"
inbox.protected = true
[resources.apt]
packages = "postgresql, espeak, rsync, libfuse2, libimage-exiftool-perl, ffmpeg"
extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main"
extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg"
extras.yarn.packages = "yarn"
packages = [
"postgresql",
"espeak",
"rsync",
"libfuse2",
"libimage-exiftool-perl",
"ffmpeg",
]
[resources.apt.extras.yarn]
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

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -28,23 +26,13 @@ ynh_backup --src_path="$install_dir"
ynh_backup --src_path="$data_dir" --is_big
#=================================================
# BACKUP THE NGINX CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP LOGROTATE
#=================================================
ynh_backup --src_path="/etc/logrotate.d/$app"
#=================================================
# BACKUP SYSTEMD
#=================================================
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup --src_path="/etc/systemd/system/$app-ui.service"
ynh_backup --src_path="/etc/systemd/system/$app-pict-rs.service"

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,16 +7,14 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression --message="Stopping $app's systemd services..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" "/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-ui.log"
ynh_systemd_action --service_name=$app-pict-rs --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-pict-rs.log"
ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped" "/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-ui" --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-ui.log"
ynh_systemd_action --service_name="$app-pict-rs" --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-pict-rs.log"
#=================================================
# MODIFY URL IN NGINX CONF
@ -30,24 +26,22 @@ ynh_change_url_nginx_config
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression --message="Updating $app's configuration file..." --weight=1
mkdir -p "$install_dir/config/"
ynh_add_config --template="../conf/lemmy.hjson" --destination="$install_dir/config/config.hjson"
ynh_add_config --template="lemmy.hjson" --destination="$install_dir/config/config.hjson"
chmod 400 "$install_dir/config/config.hjson"
chown $app:$app "$install_dir/config/config.hjson"
chown "$app:$app" "$install_dir/config/config.hjson"
#=================================================
# GENERIC FINALISATION
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd services..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name=$app-ui --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name=$app-pict-rs --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name="$app-ui" --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name="$app-pict-rs" --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -12,18 +10,19 @@ source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_script_progression --message="Installing NodeJS..." --weight=1
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_nodejs --nodejs_version="$NODEJS_VERSION"
ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
ynh_script_progression --message="Configuring $app's PostgreSQL database..." --weight=1
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
ynh_psql_execute_as_root --database="$db_name" --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -31,29 +30,20 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --data
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/build-lemmy/"
ynh_setup_source --dest_dir="$install_dir/build-lemmy-ui/"
ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
ynh_setup_source --dest_dir="$install_dir/build-pict-rs/"
ynh_setup_source --source_id="docker-image-extract" --dest_dir="$install_dir/build-lemmy/"
ynh_setup_source --source_id="docker-image-extract" --dest_dir="$install_dir/build-lemmy-ui/"
ynh_setup_source --source_id="docker-image-extract" --dest_dir="$install_dir/build-pict-rs/"
ynh_setup_source --source_id="lemmy-translations" --dest_dir="$install_dir/lemmy-ui/lemmy-translations/"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
chown -R "$app:$app" "$install_dir"
#=================================================
# INSTALL SHARP
#=================================================
pushd $install_dir/lemmy-ui
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn add sharp
pushd "$install_dir/lemmy-ui"
# ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn add sharp
popd
#=================================================
@ -62,24 +52,24 @@ popd
ynh_script_progression --message="Making install..." --weight=1
# Install lemmy-ui
pushd $install_dir/build-lemmy-ui
./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version)
pushd "$install_dir/build-lemmy-ui"
./docker-image-extract "dessalines/lemmy-ui:$(ynh_app_upstream_version)"
popd
mkdir -p "$install_dir/lemmy-ui/"
rsync -a "$install_dir/build-lemmy-ui/output/app/" "$install_dir/lemmy-ui/"
ynh_secure_remove --file="$install_dir/build-lemmy-ui"
# Install lemmy
pushd $install_dir/build-lemmy
./docker-image-extract dessalines/lemmy:$(ynh_app_upstream_version)
pushd "$install_dir/build-lemmy"
./docker-image-extract "dessalines/lemmy:$(ynh_app_upstream_version)"
popd
mkdir -p "$install_dir/lemmy/"
mv -f "$install_dir/build-lemmy/output/app/lemmy" "$install_dir/lemmy/lemmy"
ynh_secure_remove --file="$install_dir/build-lemmy"
# Install pict-rs
pushd $install_dir/build-pict-rs
./docker-image-extract asonix/pictrs:$PICTRS_VERSION
pushd "$install_dir/build-pict-rs"
./docker-image-extract "asonix/pictrs:$PICTRS_VERSION"
popd
mkdir -p "$install_dir/pict-rs/"
mv -f "$install_dir/build-pict-rs/output/usr/local/bin/pict-rs" "$install_dir/pict-rs/pict-rs"
@ -87,7 +77,7 @@ ynh_secure_remove --file="$install_dir/build-pict-rs"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
chown -R "$app:$app" "$install_dir"
# (Dirty) Install ImageMagick
# Requires 'libfuse2' and 'libimage-exiftool-perl' apt dependencies
@ -97,29 +87,32 @@ download_and_install_appimage --name="magick" --url="https://imagemagick.org/arc
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_script_progression --message="Adding $app's configuration file..." --weight=1
# Lemmy configuration
mkdir -p "$install_dir/config/"
ynh_add_config --template="lemmy.hjson" --destination="$install_dir/config/config.hjson"
chmod 400 "$install_dir/config/config.hjson"
chown $app:$app "$install_dir/config/config.hjson"
chown "$app:$app" "$install_dir/config/config.hjson"
# Pict-RS configuration
ynh_add_config --template="pict-rs.toml" --destination="$install_dir/pict-rs/pict-rs.toml"
chmod 400 "$install_dir/pict-rs/pict-rs.toml"
chown $app:$app "$install_dir/pict-rs/pict-rs.toml"
chown "$app:$app" "$install_dir/pict-rs/pict-rs.toml"
# ImageMagick configuration
mkdir -p "$install_dir/.config/ImageMagick"
ynh_add_config --template="policy.xml" --destination="$install_dir/.config/ImageMagick/policy.xml"
chmod 400 "$install_dir/.config/ImageMagick/policy.xml"
chown -R $app:$app "$install_dir/.config"
chown -R "$app:$app" "$install_dir/.config"
#=================================================
# SETUP SYSTEMD
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Prep local path for Pict-RS
pictrs_path="$install_dir/pict-rs:$PATH"
@ -128,47 +121,30 @@ pictrs_path="$install_dir/pict-rs:$PATH"
ynh_add_systemd_config --service="$app" --template="lemmy.service"
ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service"
ynh_add_systemd_config --service="$app-pict-rs" --template="pict-rs.service"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Configuring log rotation..." --weight=1
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:$app "/var/log/$app"
yunohost service add "$app" --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app.log"
yunohost service add "$app-ui" --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app-ui.log"
yunohost service add "$app-pict-rs" --description="Simple image hosting service for Lemmy" --log="/var/log/$app/$app-pict-rs.log"
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R "$app:$app" "/var/log/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app.log"
yunohost service add $app-ui --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app-ui.log"
yunohost service add $app-pict-rs --description="Simple image hosting service for Lemmy" --log="/var/log/$app/$app-pict-rs.log"
# FIXME: TMP rebuild sharp
pushd "$install_dir/lemmy-ui"
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" npm rebuild sharp
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================
# TMP rebuild sharp
pushd $install_dir/lemmy-ui
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH npm rebuild sharp
popd
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_script_progression --message="Starting $app's systemd services..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name=$app-ui --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name=$app-pict-rs --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name="$app-ui" --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name="$app-pict-rs" --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,34 +7,26 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=10
# 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 >/dev/null
then
ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove $app
if ynh_exec_warn_less yunohost service status "$app" >/dev/null; then
yunohost service remove "$app"
fi
if ynh_exec_warn_less yunohost service status $app-ui >/dev/null
then
ynh_script_progression --message="Removing $app-ui service integration..." --weight=1
yunohost service remove $app-ui
fi
if ynh_exec_warn_less yunohost service status $app-pict-rs >/dev/null
then
ynh_script_progression --message="Removing $app-pict-rs service integration..." --weight=1
yunohost service remove $app-pict-rs
fi
# Remove the dedicated systemd config
ynh_remove_systemd_config
ynh_remove_systemd_config --service=$app-ui
ynh_remove_systemd_config --service=$app-pict-rs
if ynh_exec_warn_less yunohost service status "$app-ui" >/dev/null; then
yunohost service remove "$app-ui"
fi
ynh_remove_systemd_config --service="$app-ui"
if ynh_exec_warn_less yunohost service status "$app-pict-rs" >/dev/null; then
yunohost service remove "$app-pict-rs"
fi
ynh_remove_systemd_config --service="$app-pict-rs"
# Remove the app-specific logrotate config
ynh_remove_logrotate
@ -46,9 +36,6 @@ ynh_remove_nginx_config
# Remove metapackage and its dependencies
ynh_remove_nodejs
#ynh_secure_remove --file="/lib/libc.musl-x86_64.so.1"
# Remove the log files
#=================================================
# END OF SCRIPT

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -10,6 +8,17 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling NodeJS..." --weight=1
# Define and install dependencies
ynh_install_nodejs --nodejs_version="$NODEJS_VERSION"
ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -18,7 +27,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
chown -R "$app:$app" "$install_dir"
#=================================================
# RESTORE THE DATA DIRECTORY
@ -27,26 +36,7 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
chown -R $app:$app "$data_dir"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
chown -R "$app:$app" "$data_dir"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
@ -57,53 +47,37 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
#=================================================
# RESTORE SYSTEMD
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
ynh_restore_file --origin_path="/etc/systemd/system/$app-ui.service"
systemctl enable $app-ui.service --quiet
ynh_restore_file --origin_path="/etc/systemd/system/$app-pict-rs.service"
systemctl enable $app-pict-rs.service --quiet
#=================================================
# RESTORE THE LOGROTATE CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
systemctl enable "$app.service" --quiet
systemctl enable "$app-ui.service" --quiet
systemctl enable "$app-pict-rs.service" --quiet
yunohost service add "$app" --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app.log"
yunohost service add "$app-ui" --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app-ui.log"
yunohost service add "$app-pict-rs" --description="Simple image hosting service for Lemmy" --log="/var/log/$app/$app-pict-rs.log"
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:$app "/var/log/$app"
chown -R "$app:$app" "/var/log/$app"
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
yunohost service add $app --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app.log"
yunohost service add $app-ui --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app-ui.log"
yunohost service add $app-pict-rs --description="Simple image hosting service for Lemmy" --log="/var/log/$app/$app-pict-rs.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name=$app-ui --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name=$app-pict-rs --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name="$app-ui" --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name="$app-pict-rs" --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -1,7 +1,5 @@
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -9,22 +7,14 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_script_progression --message="Stopping $app's systemd services..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app-ui --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-ui.log"
ynh_systemd_action --service_name=$app-pict-rs --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-pict-rs.log"
ynh_systemd_action --service_name="$app" --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name="$app-ui" --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-ui.log"
ynh_systemd_action --service_name="$app-pict-rs" --action="stop" --line_match="Stopped" --log_path="/var/log/$app/$app-pict-rs.log"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
@ -32,101 +22,85 @@ ynh_systemd_action --service_name=$app-pict-rs --action="stop" --line_match="Sto
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Removing previously installed iframely
if ynh_exec_warn_less yunohost service status $app-iframely >/dev/null
then
ynh_script_progression --message="Removing $app-iframely service integration..."
yunohost service remove $app-iframely
ynh_app_setting_delete --app=$app --key=random
ynh_app_setting_delete --app=$app --key=port_iframely
ynh_remove_systemd_config --service=$app-iframely
if ynh_exec_warn_less yunohost service status "$app-iframely" >/dev/null; then
ynh_script_progression --message="Removing $app-iframely service integration..."
yunohost service remove "$app-iframely"
ynh_app_setting_delete --app="$app" --key=random
ynh_app_setting_delete --app="$app" --key=port_iframely
ynh_remove_systemd_config --service="$app-iframely"
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress the source of lemmy from app.src to his build directory
ynh_setup_source --dest_dir="$install_dir/build-lemmy/"
ynh_setup_source --dest_dir="$install_dir/build-lemmy-ui/"
ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
ynh_setup_source --dest_dir="$install_dir/build-pict-rs/"
fi
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_script_progression --message="Upgrading NodeJS..." --weight=1
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_use_nodejs
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
#=================================================
# NGINX CONFIGURATION
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
ynh_script_progression --message="Upgrading source files..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Download, check integrity, uncompress the source of lemmy from app.src to his build directory
ynh_setup_source --source_id="docker-image-extract" --dest_dir="$install_dir/build-lemmy/"
ynh_setup_source --source_id="docker-image-extract" --dest_dir="$install_dir/build-lemmy-ui/"
ynh_setup_source --source_id="docker-image-extract" --dest_dir="$install_dir/build-pict-rs/"
ynh_setup_source --dest_dir="$install_dir/lemmy-ui/lemmy-translations/" --source_id="lemmy-translations"
chmod -R o-rwx "$install_dir"
chown -R "$app:$app" "$install_dir"
#=================================================
# INSTALL SHARP
#=================================================
pushd $install_dir/lemmy-ui
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn add sharp
pushd "$install_dir/lemmy-ui"
ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" yarn add sharp
popd
#=================================================
# SPECIFIC UPGRADE
#=================================================
# MAKE UPGRADE
#=================================================
ynh_script_progression --message="Making upgrade..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
# Install lemmy-ui
pushd $install_dir/build-lemmy-ui
./docker-image-extract dessalines/lemmy-ui:$(ynh_app_upstream_version)
popd
mkdir -p "$install_dir/lemmy-ui/"
rsync -a "$install_dir/build-lemmy-ui/output/app/" "$install_dir/lemmy-ui/"
ynh_secure_remove --file="$install_dir/build-lemmy-ui"
# Install lemmy-ui
pushd "$install_dir/build-lemmy-ui"
./docker-image-extract "dessalines/lemmy-ui:$(ynh_app_upstream_version)"
popd
mkdir -p "$install_dir/lemmy-ui/"
rsync -a "$install_dir/build-lemmy-ui/output/app/" "$install_dir/lemmy-ui/"
ynh_secure_remove --file="$install_dir/build-lemmy-ui"
# Install lemmy
pushd $install_dir/build-lemmy
./docker-image-extract dessalines/lemmy:$(ynh_app_upstream_version)
popd
mkdir -p "$install_dir/lemmy/"
mv -f "$install_dir/build-lemmy/output/app/lemmy" "$install_dir/lemmy/lemmy"
ynh_secure_remove --file="$install_dir/build-lemmy"
# Install lemmy
pushd "$install_dir/build-lemmy"
./docker-image-extract "dessalines/lemmy:$(ynh_app_upstream_version)"
popd
mkdir -p "$install_dir/lemmy/"
mv -f "$install_dir/build-lemmy/output/app/lemmy" "$install_dir/lemmy/lemmy"
ynh_secure_remove --file="$install_dir/build-lemmy"
# Install pict-rs
pushd $install_dir/build-pict-rs
./docker-image-extract asonix/pictrs:$PICTRS_VERSION
popd
mkdir -p "$install_dir/pict-rs/"
mv -f "$install_dir/build-pict-rs/output/usr/local/bin/pict-rs" "$install_dir/pict-rs/pict-rs"
ynh_secure_remove --file="$install_dir/build-pict-rs"
# Install pict-rs
pushd "$install_dir/build-pict-rs"
./docker-image-extract "asonix/pictrs:$PICTRS_VERSION"
popd
mkdir -p "$install_dir/pict-rs/"
mv -f "$install_dir/build-pict-rs/output/usr/local/bin/pict-rs" "$install_dir/pict-rs/pict-rs"
ynh_secure_remove --file="$install_dir/build-pict-rs"
# (Dirty) Install ImageMagick
# Requires 'libfuse2' and 'libimage-exiftool-perl' apt dependencies
ynh_script_progression --message="Downloading and installing ImageMagick..." --weight=1
download_and_install_appimage --name="magick" --url="https://imagemagick.org/archive/binaries/magick" --directory="$install_dir/pict-rs" --symlink="$install_dir/pict-rs/magick"
fi
# (Dirty) Install ImageMagick
# Requires 'libfuse2' and 'libimage-exiftool-perl' apt dependencies
ynh_script_progression --message="Downloading and installing ImageMagick..." --weight=1
download_and_install_appimage --name="magick" --url="https://imagemagick.org/archive/binaries/magick" --directory="$install_dir/pict-rs" --symlink="$install_dir/pict-rs/magick"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R $app:$app "$install_dir"
chown -R "$app:$app" "$install_dir"
#=================================================
# UPDATE A CONFIG FILE
@ -135,36 +109,32 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1
# Lemmy configuration
mkdir -p "$install_dir/lemmy/"
chown $app:$app "$install_dir/lemmy"
chown "$app:$app" "$install_dir/lemmy"
ynh_add_config --template="lemmy.hjson" --destination="$install_dir/config/config.hjson"
chmod 400 "$install_dir/config/config.hjson"
chown $app:$app "$install_dir/config/config.hjson"
chown "$app:$app" "$install_dir/config/config.hjson"
# Pict-RS configuration
mkdir -p "$install_dir/pict-rs"
chown $app:$app "$install_dir/pict-rs"
chown "$app:$app" "$install_dir/pict-rs"
ynh_add_config --template="pict-rs.toml" --destination="$install_dir/pict-rs/pict-rs.toml"
chmod 400 "$install_dir/pict-rs/pict-rs.toml"
chown $app:$app "$install_dir/pict-rs/pict-rs.toml"
chown "$app:$app" "$install_dir/pict-rs/pict-rs.toml"
# ImageMagick configuration
mkdir -p "$install_dir/.config/ImageMagick"
chown $app:$app -R "$install_dir/.config"
chown "$app:$app" -R "$install_dir/.config"
ynh_add_config --template="policy.xml" --destination="$install_dir/.config/ImageMagick/policy.xml"
chmod 400 "$install_dir/.config/ImageMagick/policy.xml"
chown -R $app:$app "$install_dir/.config"
chown -R "$app:$app" "$install_dir/.config"
#=================================================
# CREATE EXTENSION IF NOT EXISTS pgcrypto
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Creating pgcrypto extension if needed..." --weight=1
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Prep local path for Pict-RS
pictrs_path="$install_dir/pict-rs:$PATH"
@ -173,46 +143,31 @@ pictrs_path="$install_dir/pict-rs:$PATH"
ynh_add_systemd_config --service="$app" --template="lemmy.service"
ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service"
ynh_add_systemd_config --service="$app-pict-rs" --template="pict-rs.service"
#=================================================
# GENERIC FINALIZATION
#=================================================
# SETUP LOGROTATE
#=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
yunohost service add "$app" --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app.log"
yunohost service add "$app-ui" --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app-ui.log"
yunohost service add "$app-pict-rs" --description="Simple image hosting service for Lemmy" --log="/var/log/$app/$app-pict-rs.log"
mkdir -p "/var/log/$app"
chmod 750 "/var/log/$app"
chmod -R o-rwx "/var/log/$app"
chown -R $app:$app "/var/log/$app"
chown -R "$app:$app" "/var/log/$app"
# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app.log"
yunohost service add $app-ui --description="Link aggregator/Reddit clone" --log="/var/log/$app/$app-ui.log"
yunohost service add $app-pict-rs --description="Simple image hosting service for Lemmy" --log="/var/log/$app/$app-pict-rs.log"
# FIXME: TMP rebuild sharp
pushd "$install_dir/lemmy-ui"
ynh_exec_warn_less ynh_exec_as "$app" env $ynh_node_load_PATH npm rebuild sharp
popd
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting $app's systemd services..." --weight=1
# TMP rebuild sharp
pushd $install_dir/lemmy-ui
ynh_use_nodejs
ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH npm rebuild sharp
popd
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name=$app-ui --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name=$app-pict-rs --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log" --line_match="Starting http server at"
ynh_systemd_action --service_name="$app-ui" --action="start" --log_path="/var/log/$app/$app-ui.log" --line_match="http://0.0.0.0"
ynh_systemd_action --service_name="$app-pict-rs" --action="start" --log_path="/var/log/$app/$app-pict-rs.log" --line_match="starting in Actix runtime"
#=================================================
# END OF SCRIPT