mirror of
https://github.com/YunoHost-Apps/trilium_ynh.git
synced 2024-10-01 13:34:49 +02:00
Removing example_ynh boilerplate comments.
Signed-off-by: John Schmidt <john@schmidthaus.rocks>
This commit is contained in:
parent
16b5faac8c
commit
bd3622b532
4 changed files with 3 additions and 198 deletions
103
scripts/install
103
scripts/install
|
@ -44,10 +44,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..." --weight=10
|
||||
|
||||
### `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 conf/app.src
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source --dest_dir="$install_dir"
|
||||
|
||||
|
@ -78,72 +74,14 @@ popd
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
|
||||
|
||||
### `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/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 dedicated NGINX config using the conf/nginx.conf template
|
||||
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
|
||||
|
||||
yunohost service add $app --description="Trilium Notes app" --log="systemd"
|
||||
|
||||
### 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 is 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)
|
||||
|
||||
### `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
|
||||
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -152,46 +90,13 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd"
|
|||
ynh_script_progression --message="Adding a configuration file..."
|
||||
|
||||
### 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.
|
||||
|
||||
ynh_add_config --template="../conf/config.ini" --destination="$install_dir/config.ini"
|
||||
ln -sf $install_dir/config.ini $data_dir/config.ini
|
||||
|
||||
# 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/config.ini"
|
||||
chown $app:$app "$install_dir/config.ini"
|
||||
|
||||
### 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"
|
||||
|
||||
#=================================================
|
||||
# SETUP APPLICATION WITH CURL
|
||||
#=================================================
|
||||
|
||||
### 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"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
@ -199,14 +104,6 @@ chown $app:$app "$install_dir/config.ini"
|
|||
#=================================================
|
||||
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"
|
||||
|
||||
|
|
|
@ -9,19 +9,6 @@
|
|||
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
|
||||
#=================================================
|
||||
|
|
|
@ -9,25 +9,6 @@
|
|||
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 helper will compare the version of the currently installed app and the version of the upstream package.
|
||||
### $upgrade_type can have 2 different values
|
||||
### - UPGRADE_APP if the upstream app version has changed
|
||||
### - UPGRADE_PACKAGE if only the YunoHost package has changed
|
||||
### ynh_check_app_version_changed will stop the upgrade if the app is up to date.
|
||||
### UPGRADE_APP should be used to upgrade the core app only if there's an upgrade to do.
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
|
@ -58,7 +39,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=60
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||
|
||||
|
@ -123,33 +104,18 @@ yunohost service add $app --description="Trilium Notes app" --log="systemd"
|
|||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --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_script_progression --message="Updating a configuration file..."
|
||||
|
||||
ynh_add_config --template="../conf/config.ini" --destination="$install_dir/config.ini"
|
||||
ln -sf $install_dir/config.ini $data_dir/config.ini
|
||||
|
||||
# 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/config.ini"
|
||||
chown $app:$app "$install_dir/config.ini"
|
||||
|
||||
### 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"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Listening on port"
|
||||
|
||||
|
|
45
tests.toml
45
tests.toml
|
@ -2,53 +2,8 @@ test_format = 1.0
|
|||
|
||||
[default]
|
||||
|
||||
# ------------
|
||||
# Tests to run
|
||||
# ------------
|
||||
|
||||
# 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,
|
||||
|
||||
#exclude = ["install.private", "install.multi"] # NB : you should NOT need this except if you really have a good reason ...
|
||||
|
||||
# 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
|
||||
|
||||
#args.language = "fr_FR" # NB : you should NOT need those lines unless for custom questions with no obvious/default value
|
||||
#args.multisite = 0
|
||||
|
||||
# -------------------------------
|
||||
# Commits to test upgrade from
|
||||
# -------------------------------
|
||||
|
||||
test_upgrade_from.85a53b5.name = "Merge pull request #36 from YunoHost-Apps/testing"
|
||||
#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
|
Loading…
Reference in a new issue