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{J6FX~qqR)k&O}Tdff9V9-
zxQXw2NgF5tAwjNPYYIB%e$m&@A2G!|_0;&Snx$gVq-ad^SGI$UH}!6B7syR`djcSn
zNdlq#E(sd=rAYm@vh52UuNhV6eQIbgw|dwT^L+)wyrG{r%<)9h4BpADpHRmEHwC0u
zhi^C8q+2}-SV$K_z_gJapdfc_h6A5CkL#>0Q-V!0gS$0owgvS`OFEV>3v~AM6R!Pq{zJKaPQHQpI%lp`K>q{gM269P&Oh
zzO#*PEn-S^?>msrjM8o^WNu?WOzO>O+K%^hczF02q{W@i{qY8Wg`y?;=1D;G6Y;U?lDu=gIVqdFV|{brA%PgSb0Zs*pdj
zeA1ax8y+R&1>GZ_oOS(11nW(F;g~S}`6`&m<3-ZHXp!J3U^^lJ;_M`?M0`S`^N2TS
zl{hjQE;Kyea3l94l2r&&j&l;y*C{U(=dd+ght=owi&?i#?6c2Gd`QZxRi>LF$!4{v
zc!I6*mAEL-a~$<+%n4OZp;ym~$k?T)nOGl%b>`^zL<}M&B7D~WXr)nKnbaLEamUq#
zPzk%dJUH@h24B*5(jb1lYGr@l85aq~LIi|6UQ!@_eQxWZ$)a*s<*3}dpbBb`K&u`k
zoCT?tGH(XGqUmTsi$&wv7{+t15If^2?|0sr?!w3JuJj1pLslAzHj1_1nf#RyBSsly
z!j_XsR~xwtUt{gj=|j2O{MB1Vu3&YN$0^j3dyec5{w(V!%Q#BxYlFuMI>eKg{7T0L
zZ;O~Y!`V!EtW=b&8UW*hPMyi;Ds;bez8?d$%WVk
zUy2(yCEv=+tT=N|DAiEp{a%BvZ|!<}=S6E-o-cm~>mAEsxk$nvWQEpt=e}J-qfsjm)
UE-)&$xd9C0IsX9d#{5|Pe`qLcKmY&$
diff --git a/manifest.toml b/manifest.toml
index dd9ddc2..4fc010b 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -1,135 +1,53 @@
-#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
-
packaging_format = 2
-id = "example"
-name = "Example app"
-description.en = "Explain in *a few (10~15) words* the purpose of the app or what it actually does (it is meant to give a rough idea to users browsing a catalog of 100+ apps)"
-description.fr = "Expliquez en *quelques* (10~15) mots l'utilité de l'app ou ce qu'elle fait (l'objectif est de donner une idée grossière pour des utilisateurs qui naviguent dans un catalogue de 100+ apps)"
+id = "sharkey"
+name = "Sharkey"
+description.en = "Microblogging platform"
+description.fr = "Platforme de Microblogging"
-version = "1.0~ynh1"
+version = "2023.12.0~ynh1"
-maintainers = ["johndoe"]
+maintainers = ["oufmilo"]
[upstream]
-# NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data
-license = "free"
-website = "https://example.com"
-demo = "https://demo.example.com"
-admindoc = "https://yunohost.org/packaging_apps"
-userdoc = "https://yunohost.org/apps"
-code = "https://some.forge.com/example/example"
-# FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is
-# sort of a standard id for applications defined by the NIST. In particular, YunoHost may use this is in the future
-# to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here:
-# https://nvd.nist.gov/products/cpe/search.
-# For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number)
-cpe = "???"
-
-# FIXME: optional but recommended (or remove if irrelevant / not applicable).
-# This is meant to be an URL where people can financially support this app, especially when its development is based
-# on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin.
-fund = "???"
+license = "AGPL-3.0"
+website = "https://git.joinsharkey.org/Sharkey"
+code = "https://activitypub.software/TransFem-org/Sharkey"
[integration]
yunohost = ">= 11.2"
-# FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"]
architectures = "all"
-multi_instance = true
-
-# FIXME: replace with true, false, or "not_relevant".
-# Not to confuse with the "sso" key: the "ldap" key corresponds to wether or not a user *can* login on the app using
-# its YunoHost credentials.
-ldap = "?"
-
-# FIXME: replace with true, false, or "not_relevant".
-# Not to confuse with the "ldap" key: the "sso" key corresponds to wether or not a user is *automatically logged-in*
-# on the app when logged-in on the YunoHost portal.
-sso = "?"
-
-# FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G...
+multi_instance = false
+ldap = "not_relevant"
+sso = "not_relevant"
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
[install]
[install.domain]
- # this is a generic question - ask strings are automatically handled by YunoHost's core
type = "domain"
-
- [install.path]
- # this is a generic question - ask strings are automatically handled by YunoHost's core
- type = "path"
- default = "/example"
-
+
[install.init_main_permission]
- # this is a generic question - ask strings are automatically handled by YunoHost's core
- # This won't be saved as setting and will instead be used to initialize the SSOwat permission
+ help.en = "If enabled, Misskey will be accessible by people who do not have an account. This can be changed later via the webadmin."
+ help.fr = "Si cette case est cochée, Misskey sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
type = "group"
default = "visitors"
- [install.language]
- ask.en = "Choose the application language"
- ask.fr = "Choisissez la langue de l'application"
- type = "select"
- choices = ["fr", "en"]
- default = "fr"
-
- [install.admin]
- # this is a generic question - ask strings are automatically handled by YunoHost's core
- type = "user"
-
- [install.password]
- # this is a generic question - ask strings are automatically handled by YunoHost's core
- # Note that user-provided passwords questions are not automatically saved as setting
- help.en = "Use the help field to add an information for the admin about this question."
- help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
- type = "password"
-
[resources]
- # See the packaging documentation for the full set
- # of explanation regarding the behavior and properties for each of those
-
- [resources.sources]
-
- [resources.sources.main]
- # This will pre-fetch the asset which can then be deployed during the install/upgrade scripts with :
- # ynh_setup_source --dest_dir="$install_dir"
- # You can also define other assets than "main" and add --source_id="foobar" in the previous command
- url = "https://github.com/foo/bar/archive/refs/tags/v1.2.3.tar.gz"
- sha256 = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
-
- # These infos are used by https://github.com/YunoHost/apps/blob/master/tools/autoupdate_app_sources/autoupdate_app_sources.py
- # to auto-update the previous asset urls and sha256sum + manifest version
- # assuming the upstream's code repo is on github and relies on tags or releases
- # See the 'sources' resource documentation for more details
-
- # autoupdate.strategy = "latest_github_tag"
-
- [resources.system_user]
- # This will provision/deprovision a unix system user
-
- [resources.install_dir]
- # This will create/remove the install dir as /var/www/$app
- # and store the corresponding setting $install_dir
-
- [resources.data_dir]
- # This will create/remove the data dir as /home/yunohost.app/$app
- # and store the corresponding setting $data_dir
-
- [resources.permissions]
- # This will configure SSOwat permission for $domain/$path/
- # The initial allowed group of user is configured via the init_main_permission question (public=visitors, private=all_users)
- main.url = "/"
[resources.ports]
- # This will pick a random port for reverse-proxying and store it as the $port setting
+
+ [resources.system_user]
+
+ [resources.install_dir]
+
+ [resources.permissions]
+ main.url = "/"
[resources.apt]
- # This will automatically install/uninstall the following apt packages
- # and implicitly define the $phpversion setting as 8.0 (if phpX.Y-foobar dependencies are listed)
- packages = "mariadb-server, deb1, deb2, php8.0-foo, php8.0-bar"
+ packages ="ffmpeg postgresql git build-essential"
+
[resources.database]
- # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd
- type = "mysql"
+ type = "postgresql"
diff --git a/scripts/_common.sh b/scripts/_common.sh
index 944a65e..fbc676c 100644
--- a/scripts/_common.sh
+++ b/scripts/_common.sh
@@ -4,6 +4,8 @@
# COMMON VARIABLES
#=================================================
+NODEJS_VERSION="20"
+
#=================================================
# PERSONAL HELPERS
#=================================================
@@ -13,5 +15,43 @@
#=================================================
#=================================================
-# FUTURE OFFICIAL HELPERS
+# REDIS HELPERS
#=================================================
+
+# get the first available redis database
+#
+# usage: ynh_redis_get_free_db
+# | returns: the database number to use
+ynh_redis_get_free_db() {
+ local result max db
+ result="$(redis-cli INFO keyspace)"
+
+ # get the num
+ max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+")
+
+ db=0
+ # default Debian setting is 15 databases
+ for i in $(seq 0 "$max")
+ do
+ if ! echo "$result" | grep -q "db$i"
+ then
+ db=$i
+ break 1
+ fi
+ db=-1
+ done
+
+ test "$db" -eq -1 && ynh_die --message="No available Redis databases..."
+
+ echo "$db"
+}
+
+# Create a master password and set up global settings
+# Please always call this script in install and restore scripts
+#
+# usage: ynh_redis_remove_db database
+# | arg: database - the database to erase
+ynh_redis_remove_db() {
+ local db=$1
+ redis-cli -n "$db" flushall
+}
diff --git a/scripts/backup b/scripts/backup
index a675fe7..0f520f0 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -15,11 +15,6 @@ source /usr/share/yunohost/helpers
#=================================================
ynh_print_info --message="Declaring files to be backed up..."
-### N.B. : the following 'ynh_backup' calls are only a *declaration* of what needs
-### to be backuped and not an actual copy of any file. The actual backup that
-### creates and fills the archive with the files happens in the core after this
-### script is called. Hence ynh_backups calls take basically 0 seconds to run.
-
#=================================================
# BACKUP THE APP MAIN DIR
#=================================================
@@ -27,53 +22,31 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$install_dir"
#=================================================
-# BACKUP THE DATA DIR
+# BACKUP THE NGINX CONFIGURATION
#=================================================
-### Only relevant if there is a "data_dir" resource for this app
-ynh_backup --src_path="$data_dir" --is_big
-
-#=================================================
-# SYSTEM CONFIGURATION
-#=================================================
-
-# Backup the PHP-FPM configuration
-ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
-
-# Backup the nginx configuration
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-# Backup the systemd service unit
-ynh_backup --src_path="/etc/systemd/system/$app.service"
+#=================================================
+# SPECIFIC BACKUP
+#=================================================
+# BACKUP LOGROTATE
+#=================================================
-# Backup the logrotate configuration
ynh_backup --src_path="/etc/logrotate.d/$app"
-# Backup the Fail2Ban config
-ynh_backup --src_path="/etc/fail2ban/jail.d/$app.conf"
-ynh_backup --src_path="/etc/fail2ban/filter.d/$app.conf"
-
#=================================================
-# BACKUP VARIOUS FILES
+# BACKUP SYSTEMD
#=================================================
-ynh_backup --src_path="/etc/cron.d/$app"
-
-ynh_backup --src_path="/etc/$app/"
-
-### For apps with huge logs, you might want to pass --is_big,
-### and in restore script, mkdir and pass --not_mandatory to ynh_restore_file.
-ynh_backup --src_path="/var/log/$app/"
+ynh_backup --src_path="/etc/systemd/system/$app.service"
#=================================================
-# BACKUP THE MYSQL DATABASE
+# BACKUP THE POSTGRESQL DATABASE
#=================================================
-ynh_print_info --message="Backing up the MySQL database..."
+ynh_print_info --message="Backing up the PostgreSQL database..."
-### (However, things like MySQL dumps *do* take some time to run, though the
-### copy of the generated dump to the archive still happens later)
-
-ynh_mysql_dump_db --database="$db_name" > db.sql
+ynh_psql_dump_db --database="$db_name" > db.sql
#=================================================
# END OF SCRIPT
diff --git a/scripts/change_url b/scripts/change_url
deleted file mode 100644
index b2c6c33..0000000
--- a/scripts/change_url
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/bin/bash
-
-## this script is only run if actual change to domain/path is detected, if you're here either $domain or $path changed
-## new location is available via $domain and $path (or $new_domain and $new_path variables if you want to be explicit)
-## old values are available via, you guessed it, $old_domain and $old_path
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source _common.sh
-source /usr/share/yunohost/helpers
-
-#=================================================
-# STANDARD MODIFICATIONS
-#=================================================
-# STOP SYSTEMD SERVICE
-#=================================================
-ynh_script_progression --message="Stopping a systemd service..." --weight=1
-
-ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
-
-#=================================================
-# MODIFY URL IN NGINX CONF
-#=================================================
-ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
-
-# this will most likely adjust NGINX config correctly
-ynh_change_url_nginx_config
-
-#=================================================
-# SPECIFIC MODIFICATIONS
-#=================================================
-# ...
-#=================================================
-
-## do any changes to files that reference specific installation domain/path, i.e. regenerate configs etc
-
-#=================================================
-# GENERIC FINALISATION
-#=================================================
-# 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"
-
-#=================================================
-# END OF SCRIPT
-#=================================================
-
-ynh_script_progression --message="Change of URL completed for $app" --last
diff --git a/scripts/config b/scripts/config
deleted file mode 100644
index 29f78f8..0000000
--- a/scripts/config
+++ /dev/null
@@ -1,101 +0,0 @@
-#!/bin/bash
-# In simple cases, you don't need a config script.
-
-# With a simple config_panel.toml, you can write in the app settings, in the
-# upstream config file or replace complete files (logo ...) and restart services.
-
-# The config scripts allows you to go further, to handle specific cases
-# (validation of several interdependent fields, specific getter/setter for a value,
-# display dynamic informations or choices, pre-loading of config type .cube... ).
-
-#=================================================
-# GENERIC STARTING
-#=================================================
-# IMPORT GENERIC HELPERS
-#=================================================
-
-source /usr/share/yunohost/helpers
-
-ynh_abort_if_errors
-
-#=================================================
-# RETRIEVE ARGUMENTS
-#=================================================
-
-install_dir=$(ynh_app_setting_get --app="$app" --key=install_dir)
-
-#=================================================
-# SPECIFIC GETTERS FOR TOML SHORT KEY
-#=================================================
-
-get__amount() {
- # Here we can imagine to have an API call to stripe to know the amount of donation during a month
- local amount=200
-
- # It's possible to change some properties of the question by overriding it:
- if [ "$amount" -gt 100 ]; then
- cat << EOF
-style: success
-value: $amount
-ask:
- en: A lot of donation this month: **$amount €**
-EOF
- else
- cat << EOF
-style: danger
-value: $amount
-ask:
- en: Not so much donation this month: $amount €
-EOF
- fi
-}
-
-get__prices() {
- local prices
- prices="$(grep "DONATION\['" "$install_dir/settings.py" | sed -r "s@^DONATION\['([^']*)'\]\['([^']*)'\] = '([^']*)'@\1/\2/\3@g" | sed -z 's/\n/,/g;s/,$/\n/')"
- if [ "$prices" == "," ]; then
- # Return YNH_NULL if you prefer to not return a value at all.
- echo YNH_NULL
- else
- echo "$prices"
- fi
-}
-
-
-#=================================================
-# SPECIFIC VALIDATORS FOR TOML SHORT KEYS
-#=================================================
-validate__publishable_key() {
-
- # We can imagine here we test if the key is really a publishable key
- (is_secret_key "$publishable_key") &&
- echo 'This key seems to be a secret key'
-}
-
-#=================================================
-# SPECIFIC SETTERS FOR TOML SHORT KEYS
-#=================================================
-set__prices() {
-
- #---------------------------------------------
- # IMPORTANT: setters are triggered only if a change is detected
- #---------------------------------------------
- for price in $(echo "$prices" | sed "s/,/ /"); do
- frequency=$(echo "$price" | cut -d/ -f1)
- currency=$(echo "$price" | cut -d/ -f2)
- price_id=$(echo "$price" | cut -d/ -f3)
- sed "d/DONATION\['$frequency'\]\['$currency'\]" "$install_dir/settings.py"
-
- echo "DONATION['$frequency']['$currency'] = '$price_id'" >> "$install_dir/settings.py"
- done
-
- #---------------------------------------------
- # IMPORTANT: to be able to upgrade properly, you have to save the value in settings too
- #---------------------------------------------
- ynh_app_setting_set --app="$app" --key=prices --value="$prices"
-}
-
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-ynh_app_config_run "$1"
diff --git a/scripts/install b/scripts/install
index 923f4d6..2ddd556 100755
--- a/scripts/install
+++ b/scripts/install
@@ -9,195 +9,93 @@
source _common.sh
source /usr/share/yunohost/helpers
-### Install parameters are automatically saved as settings
-###
-### Settings are automatically loaded as bash variables
-### in every app script context, therefore typically these will exist:
-### - $domain
-### - $path
-### - $language
-### ... etc
-###
-### Resources defined in the manifest are provisioned prior to this script
-### and corresponding settings are also available, such as:
-### - $install_dir
-### - $port
-### - $db_name
-### ...
-###
-### $app is the app id (i.e. 'example' for first install,
-### or 'example__2', '__3', ... for multi-instance installs)
-
#=================================================
-# INITIALIZE AND STORE SETTINGS
+# INSTALL DEPENDENCIES
#=================================================
+ynh_script_progression --message="Installing dependencies..." --weight=3
-# If you need to, you can define custom settings
-# (or remove this section entirely if not relevant for you)
-foo="bar"
-ynh_app_setting_set --app=$app --key=foo --value=$foo
+ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
-#=================================================
-# APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-ynh_script_progression --message="Setting up source files..." --weight=1
+ynh_script_progression --message="Setting up source files..." --weight=3
-### `ynh_setup_source` is used to install an app from a zip or tar.gz file,
-### downloaded from an upstream source, like a git repository.
-### `ynh_setup_source` use the file manifest.toml
+mkdir -p "$install_dir"
+chown -R $app:www-data "$install_dir"
-# Download, check integrity, uncompress and patch the source from manifest.toml
-ynh_setup_source --dest_dir="$install_dir"
+ynh_exec_warn ynh_exec_as $app git clone --recurse-submodules -b stable https://activitypub.software/TransFem-org/Sharkey.git "$install_dir"
-### $install_dir will automatically be initialized with some decent
-### permission by default ... however, you may need to recursively reapply
-### ownership to all files such as after the ynh_setup_source step
-chown -R "$app:www-data" "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
-# SYSTEM CONFIGURATION
+# NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
+ynh_script_progression --message="Configuring NGINX web server..." --weight=3
-### `ynh_add_fpm_config` is used to set up a PHP config.
-### You can remove it if your app doesn't use PHP.
-### `ynh_add_fpm_config` will use the files conf/extra_php-fpm.conf
-### If you're not using these lines:
-### - You can remove these files in conf/.
-### - Remove the section "BACKUP THE PHP-FPM CONFIGURATION" in the backup script
-### - Remove also the section "REMOVE PHP-FPM CONFIGURATION" in the remove script
-### - As well as the section "RESTORE THE PHP-FPM CONFIGURATION" in the restore script
-### with the reload at the end of the script.
-### - And the section "PHP-FPM CONFIGURATION" in the upgrade script
-
-# Create a PHP-FPM config (with conf/extra_php-fpm.conf being appended to it)
-ynh_add_fpm_config
-
-# Create a dedicated NGINX config using the conf/nginx.conf template
+# Create a dedicated NGINX config
ynh_add_nginx_config
-### `ynh_systemd_config` is used to configure a systemd script for an app.
-### It can be used for apps that use sysvinit (with adaptation) or systemd.
-### Have a look at the app to be sure this app needs a systemd script.
-### `ynh_systemd_config` will use the file conf/systemd.service
-### If you're not using these lines:
-### - You can remove those files in conf/.
-### - Remove the section "BACKUP SYSTEMD" in the backup script
-### - Remove also the section "STOP AND REMOVE SERVICE" in the remove script
-### - As well as the section "RESTORE SYSTEMD" in the restore script
-### - And the section "SETUP SYSTEMD" in the upgrade script
-
-# Create a dedicated systemd config
-ynh_add_systemd_config
-
-### `yunohost service add` integrates a service in YunoHost. It then gets
-### displayed in the admin interface and through the others `yunohost service` commands.
-### (N.B.: this line only makes sense if the app adds a service to the system!)
-### If you're not using these lines:
-### - You can remove these files in conf/.
-### - Remove the section "REMOVE SERVICE INTEGRATION IN YUNOHOST" in the remove script
-### - As well as the section "INTEGRATE SERVICE IN YUNOHOST" in the restore script
-### - And the section "INTEGRATE SERVICE IN YUNOHOST" in the upgrade script
-
-### Additional options starting with 3.8:
-###
-### --needs_exposed_ports "$port" a list of ports that needs to be publicly exposed
-### which will then be checked by YunoHost's diagnosis system
-### (N.B. DO NOT USE THIS if the port is only internal!!!)
-###
-### --test_status "some command" a custom command to check the status of the service
-### (only relevant if 'systemctl status' doesn't do a good job)
-###
-### --test_conf "some command" some command similar to "nginx -t" that validates the conf of the service
-###
-### Re-calling 'yunohost service add' during the upgrade script is the right way
-### to proceed if you later realize that you need to enable some flags that
-### weren't enabled on old installs (be careful it'll override the existing
-### service though so you should re-provide all relevant flags when doing so)
-yunohost service add "$app" --description="A short description of the app" --log="/var/log/$app/$app.log"
-
-### `ynh_use_logrotate` is used to configure a logrotate configuration for the logs of this app.
-### Use this helper only if there is effectively a log file for this app.
-### If you're not using this helper:
-### - Remove the section "BACKUP LOGROTATE" in the backup script
-### - Remove also the section "REMOVE LOGROTATE CONFIGURATION" in the remove script
-### - As well as the section "RESTORE THE LOGROTATE CONFIGURATION" in the restore script
-### - And the section "SETUP LOGROTATE" in the upgrade script
-
-# Use logrotate to manage application logfile(s)
-ynh_use_logrotate
-
-# Create a dedicated Fail2Ban config
-ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
-
-#=================================================
-# APP INITIAL CONFIGURATION
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
-### You can add specific configuration files.
-###
-### Typically, put your template conf file in ../conf/your_config_file
-### The template may contain strings such as __FOO__ or __FOO_BAR__,
-### which will automatically be replaced by the values of $foo and $foo_bar
-###
-### ynh_add_config will also keep track of the config file's checksum,
-### which later during upgrade may allow to automatically backup the config file
-### if it's found that the file was manually modified
-###
-### Check the documentation of `ynh_add_config` for more info.
+# Configure redis
+redis_db=$(ynh_redis_get_free_db)
+ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
-ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file"
-
-# FIXME: this should be handled by the core in the future
-### You may need to use chmod 600 instead of 400,
-### for example if the app is expected to be able to modify its own config
-chmod 400 "$install_dir/some_config_file"
-chown "$app:$app" "$install_dir/some_config_file"
-
-### For more complex cases where you want to replace stuff using regexes,
-### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
-### When doing so, you also need to manually call ynh_store_file_checksum
-###
-### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file"
-### ynh_store_file_checksum --file="$install_dir/some_config_file"
+ynh_add_config --template="../conf/default.yml" --destination="$install_dir/.config/default.yml"
#=================================================
-# SETUP APPLICATION WITH CURL
+# BUILD APP
#=================================================
+ynh_script_progression --message="Building app..." --weight=15
-### Use these lines only if the app installation needs to be finalized through
-### web forms. We generally don't want to ask the final user,
-### so we're going to use curl to automatically fill the fields and submit the
-### forms.
-
-# Installation with curl
-ynh_script_progression --message="Finalizing installation..." --weight=1
-ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
+pushd "$install_dir"
+ ynh_use_nodejs
+ corepack enable
+ corepack prepare pnpm@latest --activate
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm install --frozen-lockfile
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production pnpm build
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm run init
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production pnpm run start
+popd
#=================================================
-# GENERIC FINALIZATION
+# SETUP SYSTEMD
+#=================================================
+ynh_script_progression --message="Configuring a systemd service..." --weight=1
+
+# Create a dedicated systemd config
+ynh_add_systemd_config
+
+#=================================================
+# SETUP LOGROTATE
+#=================================================
+ynh_script_progression --message="Configuring log rotation..." --weight=1
+
+# Use logrotate to manage application logfile(s)
+ynh_use_logrotate
+
+#=================================================
+# INTEGRATE SERVICE IN YUNOHOST
+#=================================================
+ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
+
+yunohost service add $app --description="A interplanetary blogging platform" --log="/var/log/$app/$app.log"
+
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
-### `ynh_systemd_action` is used to start a systemd service for an app.
-### Only needed if you have configure a systemd service
-### If you're not using these lines:
-### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script
-### - As well as the section "START SYSTEMD SERVICE" in the restore script
-### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script
-### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
-
# Start a systemd service
-ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
+ynh_systemd_action --service_name=$app --action="start" --log_path=systemd
#=================================================
# END OF SCRIPT
#=================================================
-ynh_script_progression --message="Installation of $app completed" --last
+
+ynh_script_progression --message="Installation of $app completed"
diff --git a/scripts/remove b/scripts/remove
index 9369d1b..024bc86 100755
--- a/scripts/remove
+++ b/scripts/remove
@@ -9,48 +9,65 @@
source _common.sh
source /usr/share/yunohost/helpers
-### Settings are automatically loaded as bash variables
-### in every app script context, therefore typically these will exist:
-### - $domain
-### - $path
-### - $language
-### - $install_dir
-### - $port
-### ...
-
-### For remove operations :
-### - the core will deprovision every resource defined in the manifest **after** this script is ran
-### this includes removing the install directory, and data directory (if --purge was used)
-
#=================================================
-# REMOVE SYSTEM CONFIGURATIONS
+# STANDARD REMOVE
+#=================================================
+# REMOVE SERVICE INTEGRATION IN YUNOHOST
#=================================================
-ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
-
-### This should be a symetric version of what happens in the install script
# 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
+ ynh_script_progression --message="Removing $app service integration..." --weight=1
+ yunohost service remove $app
fi
-ynh_remove_fail2ban_config
-
-ynh_remove_logrotate
+#=================================================
+# STOP AND REMOVE SERVICE
+#=================================================
+ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
+# Remove the dedicated systemd config
ynh_remove_systemd_config
+#=================================================
+# REMOVE LOGROTATE CONFIGURATION
+#=================================================
+ynh_script_progression --message="Removing logrotate configuration..." --weight=1
+
+# Remove the app-specific logrotate config
+ynh_remove_logrotate
+
+#=================================================
+# REMOVE THE REDIS DATABASE
+#=================================================
+ynh_script_progression --message="Removing the redis database..." --weight=1
+
+ynh_redis_remove_db "$redis_db"
+
+#=================================================
+# REMOVE NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
+
+# Remove the dedicated NGINX config
ynh_remove_nginx_config
-ynh_remove_fpm_config
+#=================================================
+# REMOVE DEPENDENCIES
+#=================================================
+ynh_script_progression --message="Removing dependencies..." --weight=1
-# Remove other various files specific to the app... such as :
+# Remove metapackage and its dependencies
+ynh_remove_nodejs
-ynh_secure_remove --file="/etc/cron.d/$app"
-
-ynh_secure_remove --file="/etc/$app"
+#=================================================
+# SPECIFIC REMOVE
+#=================================================
+# REMOVE VARIOUS FILES
+#=================================================
+# Remove the log files
ynh_secure_remove --file="/var/log/$app"
#=================================================
diff --git a/scripts/restore b/scripts/restore
index 29e7bca..e65409e 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -17,76 +17,68 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir"
-### $install_dir will automatically be initialized with some decent
-### permissions by default ... however, you may need to recursively reapply
-### ownership to all files such as after the ynh_setup_source step
-chown -R "$app:www-data" "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
-# RESTORE THE DATA DIRECTORY
+# SPECIFIC RESTORATION
#=================================================
-ynh_script_progression --message="Restoring the data directory..." --weight=1
+# REINSTALL DEPENDENCIES
+#=================================================
+#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=5
-ynh_restore_file --origin_path="$data_dir" --not_mandatory
-
-### (Same as for install dir)
-chown -R "$app:www-data" "$data_dir"
+# Define and install dependencies
+ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
#=================================================
-# RESTORE THE MYSQL DATABASE
+# RESTORE THE NGINX CONFIGURATION
#=================================================
-ynh_script_progression --message="Restoring the MySQL database..." --weight=1
-
-ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$db_name" < ./db.sql
-
-#=================================================
-# RESTORE SYSTEM CONFIGURATIONS
-#=================================================
-ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
-
-### This should be a symetric version of what happens in the install script
-
-ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
+ynh_script_progression --message="Restoring the NGINX web server configuration..."
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
+#=================================================
+# RESTORE THE POSTGRESQL DATABASE
+#=================================================
+ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
-yunohost service add "$app" --description="A short description of the app" --log="/var/log/$app/$app.log"
+ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
+
+#=================================================
+# RESTORE SYSTEMD
+#=================================================
+ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
+
+ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
+systemctl enable $app.service --quiet
+
+#=================================================
+# RESTORE THE LOGROTATE CONFIGURATION
+#=================================================
+ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
-ynh_restore_file --origin_path="/etc/fail2ban/jail.d/$app.conf"
-ynh_restore_file --origin_path="/etc/fail2ban/filter.d/$app.conf"
-ynh_systemd_action --action=restart --service_name=fail2ban
+#=================================================
+# INTEGRATE SERVICE IN YUNOHOST
+#=================================================
+ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
+
+yunohost service add $app --description="A interplanetary blogging platform" --log="/var/log/$app/$app.log"
#=================================================
-# RESTORE VARIOUS FILES
+# START SYSTEMD SERVICE
#=================================================
+ynh_script_progression --message="Starting a systemd service..." --weight=1
-ynh_restore_file --origin_path="/etc/cron.d/$app"
-ynh_restore_file --origin_path="/etc/$app/"
-
-### For apps with huge logs, you might want to not backup logs every time:
-### The mkdir call is just here in case the log directory was not backed up.
-### mkdir -p "/var/log/$app"
-### chown $app:www-data "/var/log/$app"
-### ynh_restore_file --src_path="/var/log/$app/" --not_mandatory
-###
-### For other apps, the simple way is better:
-ynh_restore_file --origin_path="/var/log/$app/"
+ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# GENERIC FINALIZATION
#=================================================
-# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
+# RELOAD NGINX
#=================================================
-ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
-
-### Typically you only have either $app or php-fpm but not both at the same time...
-ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
-ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
+ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
diff --git a/scripts/upgrade b/scripts/upgrade
index 51c54db..05b3226 100755
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -9,125 +9,97 @@
source _common.sh
source /usr/share/yunohost/helpers
-### Settings are automatically loaded as bash variables
-### in every app script context, therefore typically these will exist:
-### - $domain
-### - $path
-### - $language
-### - $install_dir
-### - $port
-### ...
-
-### In the context of upgrade,
-### - resources are automatically provisioned / updated / deleted (depending on existing resources)
-### - a safety backup is automatically created by the core and will be restored if the upgrade fails
-
-### This variable describes which upgrade type is occurring, allowing the script to handle different modes:
-### - UPGRADE_PACKAGE if only the YunoHost package has changed
-### - UPGRADE_APP if the upstream app version has changed
-### If your package needs to handle other things, like same-version upgrades or downgrades, please
-### check out the $YNH_APP_UPGRADE_TYPE variable that can contain DOWNGRADE and UPGRADE_SAME too.
-# upgrade_type=$(ynh_check_app_version_changed)
-
#=================================================
-# STANDARD UPGRADE STEPS
+# CHECK VERSION
#=================================================
-# ENSURE DOWNWARD COMPATIBILITY
-#=================================================
-#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
-### N.B. : the following setting migration snippets are provided as *EXAMPLES*
-### of what you may want to do in some cases (e.g. a setting was not defined on
-### some legacy installs and you therefore want to initiaze stuff during upgrade)
-
-# If db_name doesn't exist, create it
-# if [ -z "$db_name" ]; then
-# db_name=$(ynh_sanitize_dbid --db_name=$app)
-# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
-# fi
-
-# If install_dir doesn't exist, create it
-# if [ -z "$install_dir" ]; then
-# install_dir=/var/www/$app
-# ynh_app_setting_set --app=$app --key=install_dir --value=$install_dir
-# fi
+upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
-ynh_systemd_action --service_name="$app" --action="stop" --log_path="/var/log/$app/$app.log"
+# Stop bservice before backup, to not loose message in case of failed upgrade and restore
+ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd
-#=================================================
-# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
-ynh_script_progression --message="Upgrading source files..." --weight=1
+if [ "$upgrade_type" == "UPGRADE_APP" ]
+then
+ ynh_script_progression --message="Upgrading source files..."
-# Download, check integrity, uncompress and patch the source from manifest.toml
-ynh_setup_source --dest_dir="$install_dir"
+ # Download, check integrity, uncompress and patch the source from app.src
+ ynh_setup_source --dest_dir="$install_dir" --keep=".config/default.yml"
+fi
-### $install_dir will automatically be initialized with some decent
-### permissions by default ... however, you may need to recursively reapply
-### ownership to all files such as after the ynh_setup_source step
-chown -R "$app:www-data" "$install_dir"
+chmod 750 "$install_dir"
+chmod -R o-rwx "$install_dir"
+chown -R $app:www-data "$install_dir"
#=================================================
-# REAPPLY SYSTEM CONFIGURATIONS
+# UPGRADE DEPENDENCIES
#=================================================
-ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
+ynh_script_progression --message="Upgrading dependencies..." --weight=5
-### This should be a literal copypaste of what happened in the install's "System configuration" section
+ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
-ynh_add_fpm_config
+#=================================================
+# NGINX CONFIGURATION
+#=================================================
+ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
+# Create a dedicated NGINX config
ynh_add_nginx_config
+#=================================================
+# BUILD APP
+#=================================================
+ynh_script_progression --message="Building app..."
+
+pushd "$install_dir"
+ git checkout stable
+ git pull --recurse-submodules
+ ynh_use_nodejs
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm cleanall
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm install --frozen-lockfile
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH NODE_ENV=production pnpm build
+ ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH pnpm migrate
+popd
+
+#=================================================
+# SETUP SYSTEMD
+#=================================================
+ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
+
+# Create a dedicated systemd config
ynh_add_systemd_config
-yunohost service add "$app" --description="A short description of the app" --log="/var/log/$app/$app.log"
+#=================================================
+# GENERIC FINALIZATION
+#=================================================
+# SETUP LOGROTATE
+#=================================================
+ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
+# Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append
-ynh_add_fail2ban_config --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login"
-
#=================================================
-# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
+# INTEGRATE SERVICE IN YUNOHOST
#=================================================
-# UPDATE A CONFIG FILE
-#=================================================
-ynh_script_progression --message="Updating a configuration file..." --weight=1
+ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
-### Same as during install
-###
-### The file will automatically be backed-up if it's found to be manually modified (because
-### ynh_add_config keeps track of the file's checksum)
-
-ynh_add_config --template="some_config_file" --destination="$install_dir/some_config_file"
-
-# FIXME: this should be handled by the core in the future
-### You may need to use chmod 600 instead of 400,
-### for example if the app is expected to be able to modify its own config
-chmod 400 "$install_dir/some_config_file"
-chown "$app:$app" "$install_dir/some_config_file"
-
-### For more complex cases where you want to replace stuff using regexes,
-### you shoud rely on ynh_replace_string (which is basically a wrapper for sed)
-### When doing so, you also need to manually call ynh_store_file_checksum
-###
-### ynh_replace_string --match_string="match_string" --replace_string="replace_string" --target_file="$install_dir/some_config_file"
-### ynh_store_file_checksum --file="$install_dir/some_config_file"
+yunohost service add $app --description="A interplanetary blogging platform" --log="/var/log/$app/$app.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"
-
+ynh_systemd_action --service_name=$app --action="start" --log_path=systemd
#=================================================
# END OF SCRIPT
#=================================================
diff --git a/sources/extra_files/app/.gitignore b/sources/extra_files/app/.gitignore
deleted file mode 100644
index 783a4ae..0000000
--- a/sources/extra_files/app/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*~
-*.sw[op]
diff --git a/sources/patches/.gitignore b/sources/patches/.gitignore
deleted file mode 100644
index 783a4ae..0000000
--- a/sources/patches/.gitignore
+++ /dev/null
@@ -1,2 +0,0 @@
-*~
-*.sw[op]
diff --git a/tests.toml b/tests.toml
index 76f5804..3fbad86 100644
--- a/tests.toml
+++ b/tests.toml
@@ -1,78 +1,7 @@
-#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
-
test_format = 1.0
[default]
- # ------------
- # Tests to run
- # ------------
-
- # -------------------------------------------------------------------------------
- # EVERYTHING PAST THIS POINT IS OPTIONAL AND MOST LIKELY UNNECESSARY FOR NEW APPS
- #--------------------------------------------------------------------------------
- ## Conventions in this sample:
- ## <- An actual comment
- # <- uncommenting this should be a valid entry in 'tests.toml'
-
- ## NB: the tests to run are automatically deduced by the CI script according to the
- ## content of the app's manifest. The declarations below allow to customize which
- ## tests are ran, possibly add special test suite to test special args, or
- ## declare which commits to test upgrade from.
- ##
- ## You can also decide (though this is discouraged!) to ban/ignore some tests,
- ## The test IDs to be used in only/exclude statements are:
- ## * install.root
- ## * install.subdir
- ## * install.nourl
- ## * install.multi
- ## * backup_restore
- ## * upgrade
- ## * upgrade.someCommitId
- ## * change_url
- ## NB: you should NOT need this except if you really have a good reason...
-
- # exclude = ["install.private", "install.multi"]
-
- ## For special usecases, sometimes you need to setup other things on the machine
- ## prior to installing the app (such as installing another app)
- ## (Remove this key entirely if not needed)
-
- # preinstall = """
- # sudo yunohost app install foobar
- # sudo yunohost user list
- # """
-
- # -------------------------------
- # Default args to use for install
- # -------------------------------
-
- ## By default, the CI will automagically fill the 'standard' args
- ## such as domain, path, admin, is_public and password with relevant values
- ## and also install args with a "default" provided in the manifest..
- ## It should only make sense to declare custom args here for args with no default values
- ## NB: you should NOT need those lines unless for custom questions with no obvious/default value
-
- # args.language = "fr_FR"
- # args.multisite = 0
-
# -------------------------------
# Commits to test upgrade from
- # -------------------------------
-
- ## 00a1a6e7 is part of commit SHA, preferrably from 'master' branch
- ## that points to valid install of previous version
-
- # test_upgrade_from.00a1a6e7.name = "Upgrade from 5.4"
- # test_upgrade_from.00a1a6e7.args.foo = "bar"
-
-
-## This is an additional test suite
-# [some_additional_testsuite]
-
- ## On additional tests suites, you can decide to run only specific tests
-
- # only = ["install.subdir"]
-
- # args.language = "en_GB"
- # args.multisite = 1
+ # -------------------------------
\ No newline at end of file