From 9d3e91ccd1ef5e4c56bda66bc5c12aaac2339494 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 16:49:01 +0200 Subject: [PATCH 01/62] Initial version (1.6.10) --- conf/config.json | 1 + conf/nginx.conf | 1 + conf/php_extra-fpm.conf | 0 conf/systemd.service | 1 + manifest.toml | 113 ++++++++++++++++++++++++++++++++++ scripts/backup | 78 ++++++++++++++++++++++++ scripts/config | 105 ++++++++++++++++++++++++++++++++ scripts/install | 129 +++++++++++++++++++++++++++++++++++++++ scripts/remove | 57 +++++++++++++++++ scripts/restore | 79 ++++++++++++++++++++++++ scripts/upgrade | 132 ++++++++++++++++++++++++++++++++++++++++ 11 files changed, 696 insertions(+) create mode 100644 conf/config.json create mode 100644 conf/nginx.conf create mode 100644 conf/php_extra-fpm.conf create mode 100644 conf/systemd.service create mode 100644 manifest.toml create mode 100644 scripts/backup create mode 100644 scripts/config create mode 100644 scripts/install create mode 100644 scripts/remove create mode 100644 scripts/restore create mode 100644 scripts/upgrade diff --git a/conf/config.json b/conf/config.json new file mode 100644 index 0000000..4541317 --- /dev/null +++ b/conf/config.json @@ -0,0 +1 @@ +%7B%0D%0A%20%20%20%20%22baseurl%22%3A%20%22__DOMAIN__%22%2C%0D%0A%20%20%20%20%22hostname%22%3A%20%22__HOSTNAME__%22%2C%0D%0A%20%20%20%20%22server%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%22host%22%3A%20%22localhost%22%2C%0D%0A%20%20%20%20%20%20%20%20%22port%22%3A%20__PORT__%0D%0A%20%20%20%20%20%20%20%20%7D%2C%0D%0A%20%20%20%20%22log_level%22%3A%20%22debug%22%2C%0D%0A%20%20%20%20%22log_path%22%3A%20%22%2Fvar%2Flog%2F__APP__%2Flogs%22%2C%0D%0A%20%20%20%20%22db%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%22dialect%22%3A%20%22postgres%22%2C%0D%0A%20%20%20%20%20%20%20%20%22storage%22%3A%20%22%22%2C%0D%0A%20%20%20%20%20%20%20%20%22host%22%3A%20%22localhost%22%2C%0D%0A%20%20%20%20%20%20%20%20%22database%22%3A%20%22__APP__%22%2C%0D%0A%20%20%20%20%20%20%20%20%22username%22%3A%20%22__DB_USER__%22%2C%0D%0A%20%20%20%20%20%20%20%20%22password%22%3A%20%22__DB_PWD__%22%2C%0D%0A%20%20%20%20%20%20%20%20%22logging%22%3A%20false%2C%0D%0A%20%20%20%20%20%20%20%20%22dialectOptions%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%22autoJsonMap%22%3A%20true%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%2C%0D%0A%20%20%20%20%22user_locale%22%3A%20%22__DATA_DIR__%2Fuser_locale%22%2C%0D%0A%20%20%20%20%22upload_path%22%3A%20%22__DATA_DIR__%2Fuploads%22%2C%0D%0A%20%20%20%20%22plugins_path%22%3A%20%22__DATA_DIR__%2Fplugins%22%2C%0D%0A%7D \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf new file mode 100644 index 0000000..0b28d19 --- /dev/null +++ b/conf/nginx.conf @@ -0,0 +1 @@ +location%20__PATH__%2F%20%7B%0D%0A%20%20%20%20%0D%0A%20%20%20%20proxy_pass%20%20%20%20%20%20%20http%3A%2F%2F127.0.0.1%3A__PORT__%3B%0D%0A%20%20%20%20proxy_set_header%20X-Real-IP%20%24remote_addr%3B%0D%0A%20%20%20%20proxy_set_header%20Host%20%24host%3B%0D%0A%20%20%20%20proxy_set_header%20X-Forwarded-For%20%24proxy_add_x_forwarded_for%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20%23%20Include%20SSOWAT%20user%20panel.%0D%0A%20%20%20%20include%20conf.d%2Fyunohost_panel.conf.inc%3B%0D%0A%20%20%20%20%7D%22 \ No newline at end of file diff --git a/conf/php_extra-fpm.conf b/conf/php_extra-fpm.conf new file mode 100644 index 0000000..e69de29 diff --git a/conf/systemd.service b/conf/systemd.service new file mode 100644 index 0000000..9a01bde --- /dev/null +++ b/conf/systemd.service @@ -0,0 +1 @@ +%5BUnit%5D%0D%0ADescription%3DGancio%20%3A%20federated%20agenda%0D%0AAfter%3Dnetwork.target%0D%0A%0D%0A%5BService%5D%0D%0AType%3Dsimple%0D%0AUser%3D__APP__%0D%0AGroup%3D__APP__%0D%0AWorkingDirectory%3D__INSTALL_DIR__%2F%0D%0AEnvironment%3D%22__YNH_NODE_LOAD_PATH__%22%0D%0AExecStart%3D__YNH_NPM__%20gancio%20start%20--config%20.%2Fconfig.json%0D%0A%0D%0A%23%20Sandboxing%20options%20to%20harden%20security%0D%0A%23%20Depending%20on%20specificities%20of%20your%20service%2Fapp%2C%20you%20may%20need%20to%20tweak%20these%0D%0A%23%20..%20but%20this%20should%20be%20a%20good%20baseline%0D%0A%23%20Details%20for%20these%20options%3A%20https%3A%2F%2Fwww.freedesktop.org%2Fsoftware%2Fsystemd%2Fman%2Fsystemd.exec.html%0D%0ANoNewPrivileges%3Dyes%0D%0APrivateTmp%3Dyes%0D%0APrivateDevices%3Dyes%0D%0ARestrictAddressFamilies%3DAF_UNIX%20AF_INET%20AF_INET6%20AF_NETLINK%0D%0ARestrictNamespaces%3Dyes%0D%0ARestrictRealtime%3Dyes%0D%0ADevicePolicy%3Dclosed%0D%0AProtectClock%3Dyes%0D%0AProtectHostname%3Dyes%0D%0AProtectProc%3Dinvisible%0D%0AProtectSystem%3Dfull%0D%0AProtectControlGroups%3Dyes%0D%0AProtectKernelModules%3Dyes%0D%0AProtectKernelTunables%3Dyes%0D%0ALockPersonality%3Dyes%0D%0ASystemCallArchitectures%3Dnative%0D%0ASystemCallFilter%3D~%40clock%20%40debug%20%40module%20%40mount%20%40obsolete%20%40reboot%20%40setuid%20%40swap%20%40cpu-emulation%20%40privileged%0D%0A%0D%0A%23%20Denying%20access%20to%20capabilities%20that%20should%20not%20be%20relevant%20for%20webapps%0D%0A%23%20Doc%3A%20https%3A%2F%2Fman7.org%2Flinux%2Fman-pages%2Fman7%2Fcapabilities.7.html%0D%0ACapabilityBoundingSet%3D~CAP_RAWIO%20CAP_MKNOD%0D%0ACapabilityBoundingSet%3D~CAP_AUDIT_CONTROL%20CAP_AUDIT_READ%20CAP_AUDIT_WRITE%0D%0ACapabilityBoundingSet%3D~CAP_SYS_BOOT%20CAP_SYS_TIME%20CAP_SYS_MODULE%20CAP_SYS_PACCT%0D%0ACapabilityBoundingSet%3D~CAP_LEASE%20CAP_LINUX_IMMUTABLE%20CAP_IPC_LOCK%0D%0ACapabilityBoundingSet%3D~CAP_BLOCK_SUSPEND%20CAP_WAKE_ALARM%0D%0ACapabilityBoundingSet%3D~CAP_SYS_TTY_CONFIG%0D%0ACapabilityBoundingSet%3D~CAP_MAC_ADMIN%20CAP_MAC_OVERRIDE%0D%0ACapabilityBoundingSet%3D~CAP_NET_ADMIN%20CAP_NET_BROADCAST%20CAP_NET_RAW%0D%0ACapabilityBoundingSet%3D~CAP_SYS_ADMIN%20CAP_SYS_PTRACE%20CAP_SYSLOG%0D%0A%0D%0A%5BInstall%5D%0D%0AWantedBy%3Dmulti-user.target \ No newline at end of file diff --git a/manifest.toml b/manifest.toml new file mode 100644 index 0000000..74b5759 --- /dev/null +++ b/manifest.toml @@ -0,0 +1,113 @@ +packaging_format = 2 + +id = "gancio" +name = "Gancio" + +description.en = "A shared agenda for local communities, federated with the fediverse." +description.fr = "Un agenda partagé pour les communautés locales, fédéré avec le fédiverse." + +version = "1.6.10~ynh1" + +maintainers = ["Lapineige"] + +[upstream] +# NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data +license = "AGPL v3" +website = "https://gancio.org" +demo = "https://demo.gancio.org/" +admindoc = "https://gancio.org/install/" +userdoc = "https://gancio.org/usage" +code = "https://framagit.org/les/gancio" +# 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 = "???" + + +[integration] +yunohost = ">= 11.1.21" +# List of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386'] +architectures = "['all']" +multi_instance = "False" +ldap = "false" +sso = "false" +# FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G... You may have have a look at CI results +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.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 + type = "group" + default = "visitors" + + [install.language] + ask.en = "Choose the application language" + ask.fr = "Choisissez la langue de l'application" + type = "select" + choices = "['en', 'fr', 'en', 'it', 'zh', 'pt', 'nl', 'ru']" + default = "en" + + [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 = "" + sha256 = "" + + # 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 + subdirs = ['uploads', 'user_locale'] + [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.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 = "" + # This will configure an extra repository to install yarn dependency + 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" + [resources.database] + # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd + type = postgresql + \ No newline at end of file diff --git a/scripts/backup b/scripts/backup new file mode 100644 index 0000000..fe6c17d --- /dev/null +++ b/scripts/backup @@ -0,0 +1,78 @@ +#!/bin/bash +#### App file generated with YoloGen, the Yunohost app generator, version 0.6. +# This is the tutorial version of the app. +# It contains extra commands to explain what should be done in case you want to adjust some part of the script. +# Once you are done, you may remove them. +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +source ../settings/scripts/_common.sh +source /usr/share/yunohost/helpers + +#================================================= +# DECLARE DATA AND CONF FILES TO BACKUP +#================================================= +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 fill the archive with the files happens in the core after this +### script is called. Hence ynh_backups calls takes basically 0 seconds to run. +#================================================= +# BACKUP THE APP MAIN DIR +#================================================= + +ynh_backup --src_path="$install_dir" + +#================================================= +# BACKUP THE DATA DIR +#================================================= + + # The --is_big parameters ensure this folder is not included in the backup by default (taking less space), except if BACKUP_CORE_ONLY=0 is passed before the backup command. You might want to document that for your users. + # Only relevant if there is a "data_dir" resource for this app +ynh_backup --src_path="$data_dir" --is_big +#================================================= +# BACKUP THE NGINX 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" +#================================================= +# BACKUP VARIOUS FILES +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" + +ynh_backup --src_path="/etc/$app/" + + +#================================================= +# BACKUP THE 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 +#================================================= +# END OF SCRIPT +#================================================= + +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." \ No newline at end of file diff --git a/scripts/config b/scripts/config new file mode 100644 index 0000000..90cd7aa --- /dev/null +++ b/scripts/config @@ -0,0 +1,105 @@ +#!/bin/bash +#### App file generated with YoloGen, the Yunohost app generator, version 0.6. +# This is the tutorial version of the app. +# It contains extra commands to explain what should be done in case you want to adjust some part of the script. +# Once you are done, you may remove them. +# 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 = "$(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 publisheable key + (is_secret_key $publishable_key) && + echo 'This key seems to be a secret key' +} + +#================================================= +# SPECIFIC SETTERS FOR TOML SHORT KEYS +#================================================= +set__prices() { + + #--------------------------------------------- + # IMPORTANT: setter are trigger 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 saved the value in settings too + #--------------------------------------------- + ynh_app_setting_set $app prices $prices +} + +#================================================= +# GENERIC FINALIZATION +#================================================= +ynh_app_config_run $1 \ No newline at end of file diff --git a/scripts/install b/scripts/install new file mode 100644 index 0000000..e7fd9cb --- /dev/null +++ b/scripts/install @@ -0,0 +1,129 @@ +#!/bin/bash +#### App file generated with YoloGen, the Yunohost app generator, version 0.6. +# This is the tutorial version of the app. +# It contains extra commands to explain what should be done in case you want to adjust some part of the script. +# Once you are done, you may remove them. +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= +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) +# +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=10 + +# Install Nodejs +ynh_exec_warn_less 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_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" + +# $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" + + +#================================================= +# SYSTEM CONFIGURATION +#================================================= +ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +# Create a dedicated NGINX config using the conf/nginx.conf template +ynh_add_nginx_config + +# Create a dedicated systemd config +ynh_add_systemd_config + + yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" + + # Use logrotate to manage application logfile(s) +ynh_use_logrotate + + +#================================================= +# APP INITIAL CONFIGURATION +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="config.json" --destination="$install_dir/config.json" + +# 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.json" +chown $app:$app "$install_dir/config.json" + +### 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" + +#================================================= +# INSTALL YARN +#================================================= +ynh_script_progression --message="Installing yarn dependency..." --weight=15 + +pushd $install_dir + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install +popd +#================================================= +# SETUP APPLICATION WITH CURL +#================================================= + +#### TODO in Yunohost App Generator +# Installation with curl +ynh_script_progression --message="Finalizing installation..." --weight=1 +ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# START SYSTEMD SERVICE +#================================================= +ynh_script_progression --message="Starting a systemd service..." --weight=1 + + +# Start a systemd service +ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +#================================================= +# END OF SCRIPT +#================================================= +ynh_script_progression --message="Installation of $app completed" --last \ No newline at end of file diff --git a/scripts/remove b/scripts/remove new file mode 100644 index 0000000..a691112 --- /dev/null +++ b/scripts/remove @@ -0,0 +1,57 @@ +#!/bin/bash +#### App file generated with YoloGen, the Yunohost app generator, version 0.6. +# This is the tutorial version of the app. +# It contains extra commands to explain what should be done in case you want to adjust some part of the script. +# Once you are done, you may remove them. +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= +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 +#================================================= +# REMOVE SYSTEMD SERVICE +#================================================= +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 +fi + +ynh_remove_systemd_config +ynh_remove_nginx_config + +ynh_remove_logrotate +# Remove other various files specific to the app... such as : + +ynh_secure_remove --file="/etc/cron.d/$app" + +ynh_secure_remove --file="/etc/$app" + +ynh_secure_remove --file="/var/log/$app" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Removal of $app completed" --last \ No newline at end of file diff --git a/scripts/restore b/scripts/restore new file mode 100644 index 0000000..efe99ab --- /dev/null +++ b/scripts/restore @@ -0,0 +1,79 @@ +#!/bin/bash +#### App file generated with YoloGen, the Yunohost app generator, version 0.6. +# This is the tutorial version of the app. +# It contains extra commands to explain what should be done in case you want to adjust some part of the script. +# Once you are done, you may remove them. +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +source ../settings/scripts/_common.sh +source /usr/share/yunohost/helpers + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 + +ynh_restore_file --origin_path="$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" + +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 + +ynh_restore_file --origin_path="$data_dir" --not_mandatory + +# (Same as for install dir) +chown -R $app:www-data "$data_dir" +#================================================= +# RESTORE THE MYSQL DATABASE +#================================================= + ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 + +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql + #================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +# RESTORE THE PHP-FPM CONFIGURATION +#================================================= +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/nginx/conf.d/$domain.d/$app.conf" + +ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +systemctl enable $app.service --quiet + +yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" +# Other various files... + +ynh_restore_file --origin_path="/etc/cron.d/$app" +ynh_restore_file --origin_path="/etc/$app/" + +#================================================= +# GENERIC FINALIZATION +#================================================= +# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE +#================================================= +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=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Restoration completed for $app" --last \ No newline at end of file diff --git a/scripts/upgrade b/scripts/upgrade new file mode 100644 index 0000000..46cd020 --- /dev/null +++ b/scripts/upgrade @@ -0,0 +1,132 @@ +#!/bin/bash +#### App file generated with YoloGen, the Yunohost app generator, version 0.6. +# This is the tutorial version of the app. +# It contains extra commands to explain what should be done in case you want to adjust some part of the script. +# Once you are done, you may remove them. +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + +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) + +#================================================= +# STANDARD UPGRADE STEPS +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# +# N.B. : the followings setting migrations 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 +#================================================= +# 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" +#================================================= +# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= + +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=1 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$install_dir" +fi + +# $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" + +#================================================= +# REAPPLY SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 + +# This should be a literal copypasta of what happened in the install's "System configuration" section +ynh_add_nginx_config + +ynh_add_systemd_config + +yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" +ynh_use_logrotate --non-append +#================================================= +# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) +#================================================= +# 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_add_config --template="config.json" --destination="$install_dir/config.json" + +# 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" +#================================================= +# 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="Upgrade of $app completed" --last \ No newline at end of file From 85d52a3d614b777d3925c50d3b5ff78a9ba260d2 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:09:47 +0200 Subject: [PATCH 02/62] Update manifest.toml --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 74b5759..f85c469 100644 --- a/manifest.toml +++ b/manifest.toml @@ -109,5 +109,5 @@ ram.runtime = "50M" extras.yarn.packages = "yarn" [resources.database] # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd - type = postgresql - \ No newline at end of file + type = "postgresql" + From e4bf7f45277d482aecc092780e2c7c45303cdd7c Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 23 Sep 2023 15:09:50 +0000 Subject: [PATCH 03/62] Auto-update README --- README.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ README_fr.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) create mode 100644 README.md create mode 100644 README_fr.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..9ccdc55 --- /dev/null +++ b/README.md @@ -0,0 +1,45 @@ + + +# Gancio for YunoHost + +[![Integration level](https://dash.yunohost.org/integration/gancio.svg)](https://dash.yunohost.org/appci/app/gancio) ![Working status](https://ci-apps.yunohost.org/ci/badges/gancio.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/gancio.maintain.svg) + +[![Install Gancio with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=gancio) + +*[Lire ce readme en français.](./README_fr.md)* + +> *This package allows you to install Gancio quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* + +## Overview + +A shared agenda for local communities, federated with the fediverse. + +**Shipped version:** 1.6.10~ynh1 + +**Demo:** https://demo.gancio.org/ +## Documentation and resources + +* Official app website: +* Official user documentation: +* Official admin documentation: +* Upstream app code repository: +* YunoHost documentation for this app: +* Report a bug: + +## Developer info + +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/gancio_ynh/tree/testing). + +To try the testing branch, please proceed like that. + +``` bash +sudo yunohost app install https://github.com/YunoHost-Apps/gancio_ynh/tree/testing --debug +or +sudo yunohost app upgrade gancio -u https://github.com/YunoHost-Apps/gancio_ynh/tree/testing --debug +``` + +**More info regarding app packaging:** diff --git a/README_fr.md b/README_fr.md new file mode 100644 index 0000000..47becfe --- /dev/null +++ b/README_fr.md @@ -0,0 +1,45 @@ + + +# Gancio pour YunoHost + +[![Niveau d’intégration](https://dash.yunohost.org/integration/gancio.svg)](https://dash.yunohost.org/appci/app/gancio) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/gancio.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/gancio.maintain.svg) + +[![Installer Gancio avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=gancio) + +*[Read this readme in english.](./README.md)* + +> *Ce package vous permet d’installer Gancio rapidement et simplement sur un serveur YunoHost. +Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l’installer et en profiter.* + +## Vue d’ensemble + +Un agenda partagé pour les communautés locales, fédéré avec le fédiverse. + +**Version incluse :** 1.6.10~ynh1 + +**Démo :** https://demo.gancio.org/ +## Documentations et ressources + +* Site officiel de l’app : +* Documentation officielle utilisateur : +* Documentation officielle de l’admin : +* Dépôt de code officiel de l’app : +* Documentation YunoHost pour cette app : +* Signaler un bug : + +## Informations pour les développeurs + +Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/gancio_ynh/tree/testing). + +Pour essayer la branche testing, procédez comme suit. + +``` bash +sudo yunohost app install https://github.com/YunoHost-Apps/gancio_ynh/tree/testing --debug +ou +sudo yunohost app upgrade gancio -u https://github.com/YunoHost-Apps/gancio_ynh/tree/testing --debug +``` + +**Plus d’infos sur le packaging d’applications :** \ No newline at end of file From e08a6ef9cdc44c2e76ebbb6d70cd8ca8a47c937e Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:18:54 +0200 Subject: [PATCH 04/62] fix syntax --- manifest.toml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/manifest.toml b/manifest.toml index f85c469..2eb0a8e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -18,19 +18,15 @@ demo = "https://demo.gancio.org/" admindoc = "https://gancio.org/install/" userdoc = "https://gancio.org/usage" code = "https://framagit.org/les/gancio" -# 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 = "???" [integration] yunohost = ">= 11.1.21" # List of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386'] -architectures = "['all']" -multi_instance = "False" -ldap = "false" -sso = "false" +architectures = "all" +multi_instance = false +ldap = false +sso = false # FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G... You may have have a look at CI results disk = "50M" ram.build = "50M" From 13a3cc2da45c9bce64f7ddba6b758d90c30c1ea2 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:20:02 +0200 Subject: [PATCH 05/62] Delete conf/php_extra-fpm.conf --- conf/php_extra-fpm.conf | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 conf/php_extra-fpm.conf diff --git a/conf/php_extra-fpm.conf b/conf/php_extra-fpm.conf deleted file mode 100644 index e69de29..0000000 From e319681dbbbd2e0845340fc3b99fd5aaaf6bafbd Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:25:56 +0200 Subject: [PATCH 06/62] fix encoding --- conf/config.json | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/conf/config.json b/conf/config.json index 4541317..9dd1246 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1 +1,25 @@ -%7B%0D%0A%20%20%20%20%22baseurl%22%3A%20%22__DOMAIN__%22%2C%0D%0A%20%20%20%20%22hostname%22%3A%20%22__HOSTNAME__%22%2C%0D%0A%20%20%20%20%22server%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%22host%22%3A%20%22localhost%22%2C%0D%0A%20%20%20%20%20%20%20%20%22port%22%3A%20__PORT__%0D%0A%20%20%20%20%20%20%20%20%7D%2C%0D%0A%20%20%20%20%22log_level%22%3A%20%22debug%22%2C%0D%0A%20%20%20%20%22log_path%22%3A%20%22%2Fvar%2Flog%2F__APP__%2Flogs%22%2C%0D%0A%20%20%20%20%22db%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%22dialect%22%3A%20%22postgres%22%2C%0D%0A%20%20%20%20%20%20%20%20%22storage%22%3A%20%22%22%2C%0D%0A%20%20%20%20%20%20%20%20%22host%22%3A%20%22localhost%22%2C%0D%0A%20%20%20%20%20%20%20%20%22database%22%3A%20%22__APP__%22%2C%0D%0A%20%20%20%20%20%20%20%20%22username%22%3A%20%22__DB_USER__%22%2C%0D%0A%20%20%20%20%20%20%20%20%22password%22%3A%20%22__DB_PWD__%22%2C%0D%0A%20%20%20%20%20%20%20%20%22logging%22%3A%20false%2C%0D%0A%20%20%20%20%20%20%20%20%22dialectOptions%22%3A%20%7B%0D%0A%20%20%20%20%20%20%20%20%20%20%20%20%22autoJsonMap%22%3A%20true%0D%0A%20%20%20%20%20%20%20%20%7D%0D%0A%20%20%20%20%7D%2C%0D%0A%20%20%20%20%22user_locale%22%3A%20%22__DATA_DIR__%2Fuser_locale%22%2C%0D%0A%20%20%20%20%22upload_path%22%3A%20%22__DATA_DIR__%2Fuploads%22%2C%0D%0A%20%20%20%20%22plugins_path%22%3A%20%22__DATA_DIR__%2Fplugins%22%2C%0D%0A%7D \ No newline at end of file +{ + "baseurl": "__DOMAIN__", + "hostname": "__HOSTNAME__", + "server": { + "host": "localhost", + "port": __PORT__ + }, + "log_level": "debug", + "log_path": "/var/log/__APP__/logs", + "db": { + "dialect": "postgres", + "storage": "", + "host": "localhost", + "database": "__APP__", + "username": "__DB_USER__", + "password": "__DB_PWD__", + "logging": false, + "dialectOptions": { + "autoJsonMap": true + } + }, + "user_locale": "__DATA_DIR__/user_locale", + "upload_path": "__DATA_DIR__/uploads", + "plugins_path": "__DATA_DIR__/plugins", +} From 81e8441ef6b2f4e8e492bddb57424780a97ca84c Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:26:20 +0200 Subject: [PATCH 07/62] fix syntax --- conf/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/config.json b/conf/config.json index 9dd1246..26932fc 100644 --- a/conf/config.json +++ b/conf/config.json @@ -3,7 +3,7 @@ "hostname": "__HOSTNAME__", "server": { "host": "localhost", - "port": __PORT__ + "port": "__PORT__" }, "log_level": "debug", "log_path": "/var/log/__APP__/logs", From 48cccb2aeeefe290d5e11ebf5e918b1e383e56ec Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:34:07 +0200 Subject: [PATCH 08/62] fix encoding --- conf/nginx.conf | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index 0b28d19..1c84f07 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1 +1,10 @@ -location%20__PATH__%2F%20%7B%0D%0A%20%20%20%20%0D%0A%20%20%20%20proxy_pass%20%20%20%20%20%20%20http%3A%2F%2F127.0.0.1%3A__PORT__%3B%0D%0A%20%20%20%20proxy_set_header%20X-Real-IP%20%24remote_addr%3B%0D%0A%20%20%20%20proxy_set_header%20Host%20%24host%3B%0D%0A%20%20%20%20proxy_set_header%20X-Forwarded-For%20%24proxy_add_x_forwarded_for%3B%0D%0A%20%20%20%20%0D%0A%20%20%20%20%23%20Include%20SSOWAT%20user%20panel.%0D%0A%20%20%20%20include%20conf.d%2Fyunohost_panel.conf.inc%3B%0D%0A%20%20%20%20%7D%22 \ No newline at end of file +location __PATH__/ { + + proxy_pass http://127.0.0.1:__PORT__; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; +} From dcbd902169bb23ccc982d48c665726dfef8e6d32 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:34:11 +0200 Subject: [PATCH 09/62] fix encoding --- conf/systemd.service | 49 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 9a01bde..ee9bdf9 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1 +1,48 @@ -%5BUnit%5D%0D%0ADescription%3DGancio%20%3A%20federated%20agenda%0D%0AAfter%3Dnetwork.target%0D%0A%0D%0A%5BService%5D%0D%0AType%3Dsimple%0D%0AUser%3D__APP__%0D%0AGroup%3D__APP__%0D%0AWorkingDirectory%3D__INSTALL_DIR__%2F%0D%0AEnvironment%3D%22__YNH_NODE_LOAD_PATH__%22%0D%0AExecStart%3D__YNH_NPM__%20gancio%20start%20--config%20.%2Fconfig.json%0D%0A%0D%0A%23%20Sandboxing%20options%20to%20harden%20security%0D%0A%23%20Depending%20on%20specificities%20of%20your%20service%2Fapp%2C%20you%20may%20need%20to%20tweak%20these%0D%0A%23%20..%20but%20this%20should%20be%20a%20good%20baseline%0D%0A%23%20Details%20for%20these%20options%3A%20https%3A%2F%2Fwww.freedesktop.org%2Fsoftware%2Fsystemd%2Fman%2Fsystemd.exec.html%0D%0ANoNewPrivileges%3Dyes%0D%0APrivateTmp%3Dyes%0D%0APrivateDevices%3Dyes%0D%0ARestrictAddressFamilies%3DAF_UNIX%20AF_INET%20AF_INET6%20AF_NETLINK%0D%0ARestrictNamespaces%3Dyes%0D%0ARestrictRealtime%3Dyes%0D%0ADevicePolicy%3Dclosed%0D%0AProtectClock%3Dyes%0D%0AProtectHostname%3Dyes%0D%0AProtectProc%3Dinvisible%0D%0AProtectSystem%3Dfull%0D%0AProtectControlGroups%3Dyes%0D%0AProtectKernelModules%3Dyes%0D%0AProtectKernelTunables%3Dyes%0D%0ALockPersonality%3Dyes%0D%0ASystemCallArchitectures%3Dnative%0D%0ASystemCallFilter%3D~%40clock%20%40debug%20%40module%20%40mount%20%40obsolete%20%40reboot%20%40setuid%20%40swap%20%40cpu-emulation%20%40privileged%0D%0A%0D%0A%23%20Denying%20access%20to%20capabilities%20that%20should%20not%20be%20relevant%20for%20webapps%0D%0A%23%20Doc%3A%20https%3A%2F%2Fman7.org%2Flinux%2Fman-pages%2Fman7%2Fcapabilities.7.html%0D%0ACapabilityBoundingSet%3D~CAP_RAWIO%20CAP_MKNOD%0D%0ACapabilityBoundingSet%3D~CAP_AUDIT_CONTROL%20CAP_AUDIT_READ%20CAP_AUDIT_WRITE%0D%0ACapabilityBoundingSet%3D~CAP_SYS_BOOT%20CAP_SYS_TIME%20CAP_SYS_MODULE%20CAP_SYS_PACCT%0D%0ACapabilityBoundingSet%3D~CAP_LEASE%20CAP_LINUX_IMMUTABLE%20CAP_IPC_LOCK%0D%0ACapabilityBoundingSet%3D~CAP_BLOCK_SUSPEND%20CAP_WAKE_ALARM%0D%0ACapabilityBoundingSet%3D~CAP_SYS_TTY_CONFIG%0D%0ACapabilityBoundingSet%3D~CAP_MAC_ADMIN%20CAP_MAC_OVERRIDE%0D%0ACapabilityBoundingSet%3D~CAP_NET_ADMIN%20CAP_NET_BROADCAST%20CAP_NET_RAW%0D%0ACapabilityBoundingSet%3D~CAP_SYS_ADMIN%20CAP_SYS_PTRACE%20CAP_SYSLOG%0D%0A%0D%0A%5BInstall%5D%0D%0AWantedBy%3Dmulti-user.target \ No newline at end of file +[Unit] +Description=Gancio : federated agenda +After=network.target + +[Service] +Type=simple +User=__APP__ +Group=__APP__ +WorkingDirectory=__INSTALL_DIR__/ +Environment="__YNH_NODE_LOAD_PATH__" +ExecStart=__YNH_NPM__ gancio start --config ./config.json + +# Sandboxing options to harden security +# Depending on specificities of your service/app, you may need to tweak these +# .. but this should be a good baseline +# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html +NoNewPrivileges=yes +PrivateTmp=yes +PrivateDevices=yes +RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK +RestrictNamespaces=yes +RestrictRealtime=yes +DevicePolicy=closed +ProtectClock=yes +ProtectHostname=yes +ProtectProc=invisible +ProtectSystem=full +ProtectControlGroups=yes +ProtectKernelModules=yes +ProtectKernelTunables=yes +LockPersonality=yes +SystemCallArchitectures=native +SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged + +# Denying access to capabilities that should not be relevant for webapps +# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html +CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD +CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE +CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT +CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK +CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM +CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG +CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE +CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW +CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG + +[Install] +WantedBy=multi-user.target From b79b9e56606da38a3b84cd7b45068fe08f35dcdb Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 17:52:35 +0200 Subject: [PATCH 10/62] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 2eb0a8e..4767655 100644 --- a/manifest.toml +++ b/manifest.toml @@ -47,7 +47,7 @@ ram.runtime = "50M" ask.en = "Choose the application language" ask.fr = "Choisissez la langue de l'application" type = "select" - choices = "['en', 'fr', 'en', 'it', 'zh', 'pt', 'nl', 'ru']" + choices = ['en', 'fr', 'en', 'it', 'zh', 'pt', 'nl', 'ru'] default = "en" [install.admin] From 1acc559f458128f2d21925c5a7a47a9ae3e5fa5e Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 18:03:32 +0200 Subject: [PATCH 11/62] fix source --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 4767655..eb5b0dd 100644 --- a/manifest.toml +++ b/manifest.toml @@ -69,8 +69,8 @@ ram.runtime = "50M" # 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 = "" - sha256 = "" + url = "https://framagit.org/les/gancio/-/archive/v1.6.10/gancio-v1.6.10.tar.gz" + sha256 = "da148304572a78977397534907ca024b5bede696ae434273f769e76fdc6b7241" # 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 From 2fa4f03a2f63d9bcb693ba7931cbdffb236ae194 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 18:11:04 +0200 Subject: [PATCH 12/62] Update config.json --- conf/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/config.json b/conf/config.json index 26932fc..4a0a6d2 100644 --- a/conf/config.json +++ b/conf/config.json @@ -11,7 +11,7 @@ "dialect": "postgres", "storage": "", "host": "localhost", - "database": "__APP__", + "database": "__DB_NAME__", "username": "__DB_USER__", "password": "__DB_PWD__", "logging": false, From 10e27a0afb85169b97851a049f5c76cf7eb8595f Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 19:08:36 +0200 Subject: [PATCH 13/62] add postgresql dependency --- manifest.toml | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/manifest.toml b/manifest.toml index eb5b0dd..3aa0caa 100644 --- a/manifest.toml +++ b/manifest.toml @@ -79,30 +79,32 @@ ram.runtime = "50M" # 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 - subdirs = ['uploads', 'user_locale'] + # 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 + subdirs = ['uploads', 'user_locale'] + [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.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 = "" - # This will configure an extra repository to install yarn dependency - 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" + # 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.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 = "postgresql" + # This will configure an extra repository to install yarn dependency + 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" [resources.database] # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd type = "postgresql" From 58ee5780c7417aadd650b590c891964a00059ed8 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 19:13:24 +0200 Subject: [PATCH 14/62] Create _common.sh --- scripts/_common.sh | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 scripts/_common.sh diff --git a/scripts/_common.sh b/scripts/_common.sh new file mode 100644 index 0000000..bbbed30 --- /dev/null +++ b/scripts/_common.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +#================================================= +# COMMON VARIABLES +#================================================= + +nodejs_version=16 +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= From 54929ddab1535acb95f0a07dc70b939c4f69d99b Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 19:29:07 +0200 Subject: [PATCH 15/62] Update config.json --- conf/config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/config.json b/conf/config.json index 4a0a6d2..7330de9 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,6 +1,6 @@ { "baseurl": "__DOMAIN__", - "hostname": "__HOSTNAME__", + "hostname": "__DOMAIN__", "server": { "host": "localhost", "port": "__PORT__" From 33feb1042e5a8e4d7b2505c5ee423a1eb0e05bb7 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 19:46:37 +0200 Subject: [PATCH 16/62] fix startup command --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index ee9bdf9..809f828 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NPM__ gancio start --config ./config.json +ExecStart=gancio start --config ./config.json # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these From 4c94910b8cdfdd654adefde44d74181cccb8f323 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 19:49:08 +0200 Subject: [PATCH 17/62] remove hostname https://framagit.org/les/gancio/-/blob/master/server/config.js?ref_type=heads#L42 --- conf/config.json | 1 - 1 file changed, 1 deletion(-) diff --git a/conf/config.json b/conf/config.json index 7330de9..2d8f59c 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,6 +1,5 @@ { "baseurl": "__DOMAIN__", - "hostname": "__DOMAIN__", "server": { "host": "localhost", "port": "__PORT__" From 059a8b891bd1b740cf0299f2ff6a140fb49c0377 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 19:51:23 +0200 Subject: [PATCH 18/62] Create description.md --- doc/description.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 doc/description.md diff --git a/doc/description.md b/doc/description.md new file mode 100644 index 0000000..4821b65 --- /dev/null +++ b/doc/description.md @@ -0,0 +1,3 @@ +This app provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. + +*Note that this package is still work in progress, don't consider it as stable.* From 16accb836991a7e3a1d208d1e205762d594ad909 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 22:51:08 +0200 Subject: [PATCH 19/62] remove not used files in backup --- scripts/backup | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/scripts/backup b/scripts/backup index fe6c17d..a758c5b 100644 --- a/scripts/backup +++ b/scripts/backup @@ -53,14 +53,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" #================================================= ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -ynh_backup --src_path="/etc/cron.d/$app" - -ynh_backup --src_path="/etc/$app/" - #================================================= # BACKUP THE DATABASE @@ -75,4 +67,4 @@ ynh_mysql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." \ No newline at end of file +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." From 167ab375094b802e98254a6a4bbbffcbae2cdf76 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 22:52:49 +0200 Subject: [PATCH 20/62] remove admin/pwd --- manifest.toml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/manifest.toml b/manifest.toml index 3aa0caa..c3731fc 100644 --- a/manifest.toml +++ b/manifest.toml @@ -50,16 +50,6 @@ ram.runtime = "50M" choices = ['en', 'fr', 'en', 'it', 'zh', 'pt', 'nl', 'ru'] default = "en" - [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 From ff7732f3b3095d66b198bea8837fd6a0046cda6b Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:08:19 +0200 Subject: [PATCH 21/62] fix json typo + URL --- conf/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/config.json b/conf/config.json index 2d8f59c..6100205 100644 --- a/conf/config.json +++ b/conf/config.json @@ -1,5 +1,5 @@ { - "baseurl": "__DOMAIN__", + "baseurl": "https://__DOMAIN__", "server": { "host": "localhost", "port": "__PORT__" @@ -20,5 +20,5 @@ }, "user_locale": "__DATA_DIR__/user_locale", "upload_path": "__DATA_DIR__/uploads", - "plugins_path": "__DATA_DIR__/plugins", + "plugins_path": "__DATA_DIR__/plugins" } From 211a0567c63b594c6c5525e2fe3964f4b2ebceab Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:10:35 +0200 Subject: [PATCH 22/62] fix yarn build command --- scripts/install | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index e7fd9cb..28e4fd7 100644 --- a/scripts/install +++ b/scripts/install @@ -96,13 +96,13 @@ chown $app:$app "$install_dir/config.json" ### ynh_store_file_checksum --file="$install_dir/some_config_file" #================================================= -# INSTALL YARN +# INSTALL YARN AND APP #================================================= -ynh_script_progression --message="Installing yarn dependency..." --weight=15 +ynh_script_progression --message="Installing yarn dependency and building the app..." --weight=15 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build --config $install_dir/config.json# there is no "install" command, only build popd #================================================= # SETUP APPLICATION WITH CURL @@ -126,4 +126,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last \ No newline at end of file +ynh_script_progression --message="Installation of $app completed" --last From 99903d7425d090a187c6fc7b8573c87d8d895675 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:17:38 +0200 Subject: [PATCH 23/62] fix npm syntax --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 28e4fd7..d30d1c5 100644 --- a/scripts/install +++ b/scripts/install @@ -102,7 +102,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build --config $install_dir/config.json# there is no "install" command, only build + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH run build --config $install_dir/config.json# there is no "install" command, only build popd #================================================= # SETUP APPLICATION WITH CURL From 8a1ee553bf527d9b02cc8c30c4068ea65153091c Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:33:04 +0200 Subject: [PATCH 24/62] create log folder + fix build app typo --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index d30d1c5..e3084a8 100644 --- a/scripts/install +++ b/scripts/install @@ -87,6 +87,7 @@ ynh_add_config --template="config.json" --destination="$install_dir/config.json" # for example if the app is expected to be able to modify its own config chmod 400 "$install_dir/config.json" chown $app:$app "$install_dir/config.json" +chown $app:$app "/var/log/$app" ### 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) @@ -102,7 +103,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH run build --config $install_dir/config.json# there is no "install" command, only build + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= # SETUP APPLICATION WITH CURL From b8c2029fc41d37a5c5a1b81254ea4b10726b982d Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:33:25 +0200 Subject: [PATCH 25/62] fix start command --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 809f828..9428457 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=gancio start --config ./config.json +ExecStart=run start --config ./config.json # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these From 40a2789d194528946e2ec258a9e45092478a48d0 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:36:52 +0200 Subject: [PATCH 26/62] allow emails --- manifest.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/manifest.toml b/manifest.toml index c3731fc..52a53b9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -87,6 +87,7 @@ ram.runtime = "50M" [resources.ports] # This will pick a random port for reverse-proxying and store it as the $port setting + [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) @@ -95,7 +96,11 @@ ram.runtime = "50M" 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" + [resources.database] # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd type = "postgresql" + + [resources.system_user] + allow_email = true From 03ffc9657444f1159107705e23d7d817eb4f7142 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:38:30 +0200 Subject: [PATCH 27/62] Rename doc/description.md to DESCRIPTION.md --- doc/description.md => DESCRIPTION.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename doc/description.md => DESCRIPTION.md (100%) diff --git a/doc/description.md b/DESCRIPTION.md similarity index 100% rename from doc/description.md rename to DESCRIPTION.md From d2e6ac17d283580ee7981c4e6b0f60dd87c3f214 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:39:56 +0200 Subject: [PATCH 28/62] fix spacing and syntax --- scripts/install | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/install b/scripts/install index e3084a8..3fa3bb0 100644 --- a/scripts/install +++ b/scripts/install @@ -67,12 +67,11 @@ ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config - yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" +yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" - # Use logrotate to manage application logfile(s) +# Use logrotate to manage application logfile(s) ynh_use_logrotate - #================================================= # APP INITIAL CONFIGURATION #================================================= @@ -103,7 +102,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH run build --config $install_dir/config.json #There is no "install" command, only build + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= # SETUP APPLICATION WITH CURL From 46693e0ae3e4f81d739120bd813d34efa08dd346 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:42:54 +0200 Subject: [PATCH 29/62] fix email location --- manifest.toml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index 52a53b9..fc57e0b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -70,6 +70,8 @@ ram.runtime = "50M" # autoupdate.strategy = "latest_github_tag" [resources.system_user] # This will provision/deprovision a unix system user + + allow_email = true [resources.install_dir] # This will create/remove the install dir as /var/www/$app @@ -100,7 +102,4 @@ ram.runtime = "50M" [resources.database] # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd type = "postgresql" - - [resources.system_user] - allow_email = true From bdb83c8dc597fce9f0113815884b6d89f34faa7c Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:48:49 +0200 Subject: [PATCH 30/62] use ynh_npm --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 3fa3bb0..fd2987a 100644 --- a/scripts/install +++ b/scripts/install @@ -102,7 +102,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH run build --config $install_dir/config.json #There is no "install" command, only build + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= # SETUP APPLICATION WITH CURL From 5b8ae786bc9a41f54cd5ef114ad870b731b01fd8 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:51:17 +0200 Subject: [PATCH 31/62] Rename DESCRIPTION.md to doc/DESCRIPTION.md --- DESCRIPTION.md => doc/DESCRIPTION.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename DESCRIPTION.md => doc/DESCRIPTION.md (100%) diff --git a/DESCRIPTION.md b/doc/DESCRIPTION.md similarity index 100% rename from DESCRIPTION.md rename to doc/DESCRIPTION.md From 936c86f3a3af966177a4ec587f4cdc77e3b416ce Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sat, 23 Sep 2023 21:51:21 +0000 Subject: [PATCH 32/62] Auto-update README --- README.md | 5 ++++- README_fr.md | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9ccdc55..4019119 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -A shared agenda for local communities, federated with the fediverse. +This app provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. + +*Note that this package is still work in progress, don't consider it as stable.* + **Shipped version:** 1.6.10~ynh1 diff --git a/README_fr.md b/README_fr.md index 47becfe..48a9a23 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,7 +16,10 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -Un agenda partagé pour les communautés locales, fédéré avec le fédiverse. +This app provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. + +*Note that this package is still work in progress, don't consider it as stable.* + **Version incluse :** 1.6.10~ynh1 From 01844b0a948039af53ef9ef61a642cd0d219c897 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:56:30 +0200 Subject: [PATCH 33/62] fix syntax --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index fd2987a..11aaa99 100644 --- a/scripts/install +++ b/scripts/install @@ -102,7 +102,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= # SETUP APPLICATION WITH CURL From 10aa05757f56563ceb2d46b95d38ac80011ab9a6 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 23 Sep 2023 23:59:58 +0200 Subject: [PATCH 34/62] nuxt is required --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 11aaa99..127080d 100644 --- a/scripts/install +++ b/scripts/install @@ -102,6 +102,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm yarn add nuxt ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= From e4366f6de6ac6666f7eec5a68c34df972504b740 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sun, 24 Sep 2023 00:06:28 +0200 Subject: [PATCH 35/62] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 127080d..85e3072 100644 --- a/scripts/install +++ b/scripts/install @@ -102,7 +102,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm yarn add nuxt + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add nuxt ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= From a6742f4afcd3161ce891eaecbab7d9657fefc436 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sun, 24 Sep 2023 00:18:44 +0200 Subject: [PATCH 36/62] Update install --- scripts/install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 85e3072..43b05ec 100644 --- a/scripts/install +++ b/scripts/install @@ -102,7 +102,8 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add nuxt + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add nuxt ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= From 322d1bffea25334d9ff607fedb7ec39e66ca8ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 1 Oct 2023 18:02:35 +0200 Subject: [PATCH 37/62] Fix linter --- manifest.toml | 6 +++--- tests.toml | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) create mode 100644 tests.toml diff --git a/manifest.toml b/manifest.toml index fc57e0b..9ccceac 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,8 +3,8 @@ packaging_format = 2 id = "gancio" name = "Gancio" -description.en = "A shared agenda for local communities, federated with the fediverse." -description.fr = "Un agenda partagé pour les communautés locales, fédéré avec le fédiverse." +description.en = "Shared agenda for local communities, federated with the fediverse." +description.fr = "Agenda partagé pour les communautés locales, fédéré avec le fédiverse." version = "1.6.10~ynh1" @@ -12,7 +12,7 @@ maintainers = ["Lapineige"] [upstream] # NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data -license = "AGPL v3" +license = "AGPL-3.0-only" website = "https://gancio.org" demo = "https://demo.gancio.org/" admindoc = "https://gancio.org/install/" diff --git a/tests.toml b/tests.toml new file mode 100644 index 0000000..91daf17 --- /dev/null +++ b/tests.toml @@ -0,0 +1,7 @@ +test_format = 1.0 + +[default] + + # ------------ + # Tests to run + # ------------ \ No newline at end of file From 40d9c1bbb9da4f16f86072d42eb9904bf1b05615 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 1 Oct 2023 16:02:40 +0000 Subject: [PATCH 38/62] Auto-update README --- README.md | 1 - README_fr.md | 1 - 2 files changed, 2 deletions(-) diff --git a/README.md b/README.md index 4019119..4be788a 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,6 @@ This app provide an online agenda open to contributions, and federated with the * Official user documentation: * Official admin documentation: * Upstream app code repository: -* YunoHost documentation for this app: * Report a bug: ## Developer info diff --git a/README_fr.md b/README_fr.md index 48a9a23..070ee3f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -30,7 +30,6 @@ This app provide an online agenda open to contributions, and federated with the * Documentation officielle utilisateur : * Documentation officielle de l’admin : * Dépôt de code officiel de l’app : -* Documentation YunoHost pour cette app : * Signaler un bug : ## Informations pour les développeurs From 2e50bf5d95bfe1a1155534710f2c954a289a1cfb Mon Sep 17 00:00:00 2001 From: lesion Date: Tue, 3 Oct 2023 12:23:39 +0200 Subject: [PATCH 39/62] there is no need to rebuild it --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 43b05ec..81677ef 100644 --- a/scripts/install +++ b/scripts/install @@ -103,8 +103,8 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add nuxt - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build + #ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add nuxt + #ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build popd #================================================= # SETUP APPLICATION WITH CURL From 8084be2420c3a579f6b883678b40ed5a15451a1b Mon Sep 17 00:00:00 2001 From: lesion Date: Tue, 3 Oct 2023 12:24:00 +0200 Subject: [PATCH 40/62] get the last release --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 9ccceac..947c506 100644 --- a/manifest.toml +++ b/manifest.toml @@ -59,8 +59,8 @@ ram.runtime = "50M" # 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://framagit.org/les/gancio/-/archive/v1.6.10/gancio-v1.6.10.tar.gz" - sha256 = "da148304572a78977397534907ca024b5bede696ae434273f769e76fdc6b7241" + url = "https://gancio.org/releases/gancio-v1.6.14.tgz" + sha256 = "d4b655c9084d4b8b978dd2842e01c1cebe74fac996d3552e8fc1a0764729dd11" # 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 From 29f633c98e80f9bc985d356143f27c48dc52dbb1 Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 20:19:47 +0200 Subject: [PATCH 41/62] Use admin user --- manifest.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/manifest.toml b/manifest.toml index 947c506..b16bd93 100644 --- a/manifest.toml +++ b/manifest.toml @@ -49,6 +49,16 @@ ram.runtime = "50M" type = "select" choices = ['en', 'fr', 'en', 'it', 'zh', 'pt', 'nl', 'ru'] default = "en" + + [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 = "Choose admin user password" + help.fr = "Choisissez le mot de passe du compte d'administration." + type = "password" [resources] # See the packaging documentation for the full set From 4d21964fec465a9af220d2b08e768fbf1c18c8c3 Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 20:20:51 +0200 Subject: [PATCH 42/62] cleanup --- scripts/install | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 81677ef..a5fad12 100644 --- a/scripts/install +++ b/scripts/install @@ -102,9 +102,7 @@ ynh_script_progression --message="Installing yarn dependency and building the ap pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install - #ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add nuxt - #ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $ynh_npm run build --config $install_dir/config.json #There is no "install" command, only build + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install dependencies popd #================================================= # SETUP APPLICATION WITH CURL From 8c631c9c74db67cf574432530e09cf898566e247 Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 20:22:07 +0200 Subject: [PATCH 43/62] cleanup --- scripts/install | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/scripts/install b/scripts/install index a5fad12..b98ce8a 100644 --- a/scripts/install +++ b/scripts/install @@ -98,20 +98,13 @@ chown $app:$app "/var/log/$app" #================================================= # INSTALL YARN AND APP #================================================= -ynh_script_progression --message="Installing yarn dependency and building the app..." --weight=15 +ynh_script_progression --message="Installing app dependencies..." --weight=15 pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install dependencies popd -#================================================= -# SETUP APPLICATION WITH CURL -#================================================= -#### TODO in Yunohost App Generator -# Installation with curl -ynh_script_progression --message="Finalizing installation..." --weight=1 -ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" #================================================= # GENERIC FINALIZATION From 522dc64b8dc73e39151c90a1f6f82e46108729a7 Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 20:35:22 +0200 Subject: [PATCH 44/62] Create admin user --- scripts/install | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/scripts/install b/scripts/install index b98ce8a..c27d989 100644 --- a/scripts/install +++ b/scripts/install @@ -105,6 +105,14 @@ pushd $install_dir ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install dependencies popd +#================================================= +# CREATE ADMIN USER +#================================================= +ynh_script_progression --message="Creating admin user..." --weight=15 + +pushd $install_dir + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ./server/cli.js users create __ADMIN__ --admin +popd #================================================= # GENERIC FINALIZATION From c2e52ac399451da50317f967a0a2d75904e84fb4 Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 20:35:45 +0200 Subject: [PATCH 45/62] use config file --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index c27d989..404c5b2 100644 --- a/scripts/install +++ b/scripts/install @@ -111,7 +111,7 @@ popd ynh_script_progression --message="Creating admin user..." --weight=15 pushd $install_dir - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ./server/cli.js users create __ADMIN__ --admin + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ./server/cli.js users create __ADMIN__ --admin --config ./config.json popd #================================================= From 41998a92676ea9993fdc6651c14661379d65ec98 Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 20:36:23 +0200 Subject: [PATCH 46/62] fix start command https://github.com/YunoHost-Apps/gancio_ynh/pull/2#discussion_r1346425334 --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 9428457..f66f977 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=run start --config ./config.json +ExecStart=./server/cli.js start --config ./config.json # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these From 3a100c71c59a3eec94eaa00e83f71d4b49d6f25f Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 20:42:59 +0200 Subject: [PATCH 47/62] fix syntax --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index f66f977..29c4331 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=./server/cli.js start --config ./config.json +ExecStart=server/cli.js start --config ./config.json # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these From 50656007a245ac526d0c1d0b4cf7b90ac902886d Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 22:52:17 +0200 Subject: [PATCH 48/62] use ynh_node --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 29c4331..0b1029b 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -8,7 +8,7 @@ User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=server/cli.js start --config ./config.json +ExecStart=__YNH_NODE__ server/cli.js start --config ./config.json # Sandboxing options to harden security # Depending on specificities of your service/app, you may need to tweak these From b41b9eaa2829e4de0bf6b154571dac2120d65be0 Mon Sep 17 00:00:00 2001 From: lapineige Date: Thu, 5 Oct 2023 22:56:29 +0200 Subject: [PATCH 49/62] v1.6.17 --- manifest.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifest.toml b/manifest.toml index b16bd93..5ce1104 100644 --- a/manifest.toml +++ b/manifest.toml @@ -6,7 +6,7 @@ name = "Gancio" description.en = "Shared agenda for local communities, federated with the fediverse." description.fr = "Agenda partagé pour les communautés locales, fédéré avec le fédiverse." -version = "1.6.10~ynh1" +version = "1.6.17~ynh1" maintainers = ["Lapineige"] @@ -69,8 +69,8 @@ ram.runtime = "50M" # 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://gancio.org/releases/gancio-v1.6.14.tgz" - sha256 = "d4b655c9084d4b8b978dd2842e01c1cebe74fac996d3552e8fc1a0764729dd11" + url = "https://gancio.org/releases/gancio-v1.6.17.tgz" + sha256 = "fd9b0869d4c733c4b7de9f3bec0889918170822f1b12104ec32923c30648746f" # 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 From 9931d69d170e1ab510ae3d5aa7fe32a1a3bb4be2 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 5 Oct 2023 20:56:32 +0000 Subject: [PATCH 50/62] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4be788a..c0e9ba3 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ This app provide an online agenda open to contributions, and federated with the *Note that this package is still work in progress, don't consider it as stable.* -**Shipped version:** 1.6.10~ynh1 +**Shipped version:** 1.6.17~ynh1 **Demo:** https://demo.gancio.org/ ## Documentation and resources diff --git a/README_fr.md b/README_fr.md index 070ee3f..93b0422 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ This app provide an online agenda open to contributions, and federated with the *Note that this package is still work in progress, don't consider it as stable.* -**Version incluse :** 1.6.10~ynh1 +**Version incluse :** 1.6.17~ynh1 **Démo :** https://demo.gancio.org/ ## Documentations et ressources From 3d0f720086ed620403fc10a00ac291a589cc4682 Mon Sep 17 00:00:00 2001 From: lapineige Date: Fri, 6 Oct 2023 08:52:55 +0200 Subject: [PATCH 51/62] spacing --- scripts/upgrade | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 46cd020..a9f0246 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -93,7 +93,9 @@ ynh_add_nginx_config ynh_add_systemd_config yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" + ynh_use_logrotate --non-append + #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= @@ -129,4 +131,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last \ No newline at end of file +ynh_script_progression --message="Upgrade of $app completed" --last From e6297b74d0d55a5daed474b4d63c4b6d664ea45f Mon Sep 17 00:00:00 2001 From: lapineige Date: Fri, 6 Oct 2023 08:56:57 +0200 Subject: [PATCH 52/62] Add nodeJS during upgrade + upgrade dependencies --- scripts/upgrade | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index a9f0246..ea11838 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -82,6 +82,14 @@ fi # ownership to all files such as after the ynh_setup_source step chown -R $app:www-data "$install_dir" +#================================================= +# UPGRADE DEPENDENCIES +#================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=10 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= @@ -115,12 +123,16 @@ ynh_add_config --template="config.json" --destination="$install_dir/config.json" 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" +#================================================= +# CONFIGURE THE APP +#================================================= +ynh_script_progression --message="Updating app dependencies..." --weight=15 + +pushd $install_dir + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install dependencies +popd + #================================================= # START SYSTEMD SERVICE #================================================= From c493d90707b8f15bc918a920480e9fd5020d8f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 6 Oct 2023 13:52:35 +0200 Subject: [PATCH 53/62] cleaning --- conf/nginx.conf | 1 + conf/systemd.service | 2 +- doc/DESCRIPTION.md | 4 +-- doc/DESCRIPTION_fr.md | 1 + manifest.toml | 53 ++++++---------------------- scripts/_common.sh | 1 + scripts/backup | 17 +++------ scripts/change_url | 51 +++++++++++++++++++++++++++ scripts/install | 60 ++++--------------------------- scripts/remove | 27 +++----------- scripts/restore | 25 +++++-------- scripts/upgrade | 82 +++++++------------------------------------ 12 files changed, 103 insertions(+), 221 deletions(-) create mode 100644 doc/DESCRIPTION_fr.md create mode 100644 scripts/change_url diff --git a/conf/nginx.conf b/conf/nginx.conf index 1c84f07..74bcc57 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,3 +1,4 @@ +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { proxy_pass http://127.0.0.1:__PORT__; diff --git a/conf/systemd.service b/conf/systemd.service index 0b1029b..93f2bbf 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Gancio : federated agenda +Description=Gancio: federated agenda After=network.target [Service] diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 4821b65..760caef 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,3 +1 @@ -This app provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. - -*Note that this package is still work in progress, don't consider it as stable.* +Gancio provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. diff --git a/doc/DESCRIPTION_fr.md b/doc/DESCRIPTION_fr.md new file mode 100644 index 0000000..455d1a4 --- /dev/null +++ b/doc/DESCRIPTION_fr.md @@ -0,0 +1 @@ +Gancio propose un agenda en ligne ouvert aux contributions, et fédéré avec le fediverse via ActivityPub. \ No newline at end of file diff --git a/manifest.toml b/manifest.toml index 5ce1104..83179ab 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,15 +3,14 @@ packaging_format = 2 id = "gancio" name = "Gancio" -description.en = "Shared agenda for local communities, federated with the fediverse." -description.fr = "Agenda partagé pour les communautés locales, fédéré avec le fédiverse." +description.en = "Shared agenda for local communities, federated with the fediverse" +description.fr = "Agenda partagé pour les communautés locales, fédéré avec le fédiverse" version = "1.6.17~ynh1" maintainers = ["Lapineige"] [upstream] -# NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data license = "AGPL-3.0-only" website = "https://gancio.org" demo = "https://demo.gancio.org/" @@ -19,27 +18,22 @@ admindoc = "https://gancio.org/install/" userdoc = "https://gancio.org/usage" code = "https://framagit.org/les/gancio" - [integration] -yunohost = ">= 11.1.21" -# List of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386'] +yunohost = ">= 11.2" architectures = "all" multi_instance = false ldap = false sso = false -# FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G... You may have have a look at CI results 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.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 type = "group" default = "visitors" @@ -51,65 +45,40 @@ ram.runtime = "50M" default = "en" [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 = "Choose admin user password" help.fr = "Choisissez le mot de passe du compte d'administration." 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://gancio.org/releases/gancio-v1.6.17.tgz" sha256 = "fd9b0869d4c733c4b7de9f3bec0889918170822f1b12104ec32923c30648746f" - # 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 - - allow_email = true + #allow_email = true [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 - subdirs = ['uploads', 'user_locale'] + subdirs = ['uploads', 'user_locale', 'plugins'] [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.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 = "postgresql" - # This will configure an extra repository to install yarn dependency 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" [resources.database] - # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd type = "postgresql" - + \ No newline at end of file diff --git a/scripts/_common.sh b/scripts/_common.sh index bbbed30..b818f0f 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,6 +5,7 @@ #================================================= nodejs_version=16 + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index a758c5b..129a147 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,8 +1,5 @@ #!/bin/bash -#### App file generated with YoloGen, the Yunohost app generator, version 0.6. -# This is the tutorial version of the app. -# It contains extra commands to explain what should be done in case you want to adjust some part of the script. -# Once you are done, you may remove them. + #================================================= # GENERIC START #================================================= @@ -18,10 +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 fill the archive with the files happens in the core after this -### script is called. Hence ynh_backups calls takes basically 0 seconds to run. #================================================= # BACKUP THE APP MAIN DIR #================================================= @@ -32,9 +25,8 @@ ynh_backup --src_path="$install_dir" # BACKUP THE DATA DIR #================================================= - # The --is_big parameters ensure this folder is not included in the backup by default (taking less space), except if BACKUP_CORE_ONLY=0 is passed before the backup command. You might want to document that for your users. - # Only relevant if there is a "data_dir" resource for this app ynh_backup --src_path="$data_dir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -48,6 +40,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP SYSTEMD #================================================= @@ -59,10 +52,8 @@ ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= 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_psql_dump_db --database="$db_name" > db.sql -ynh_mysql_dump_db --database="$db_name" > db.sql #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/change_url b/scripts/change_url new file mode 100644 index 0000000..6c33e71 --- /dev/null +++ b/scripts/change_url @@ -0,0 +1,51 @@ +#!/bin/bash + +#================================================= +# 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="systemd" + +#================================================= +# MODIFY URL IN NGINX CONF +#================================================= +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 + +ynh_change_url_nginx_config + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +ynh_add_config --template="config.json" --destination="$install_dir/config.json" + +chmod 400 "$install_dir/config.json" +chown $app:$app "$install_dir/config.json" + +#================================================= +# 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="systemd" + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 404c5b2..6f2115a 100644 --- a/scripts/install +++ b/scripts/install @@ -1,36 +1,14 @@ #!/bin/bash -#### App file generated with YoloGen, the Yunohost app generator, version 0.6. -# This is the tutorial version of the app. -# It contains extra commands to explain what should be done in case you want to adjust some part of the script. -# Once you are done, you may remove them. + #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= + 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) -# #================================================= # INSTALL DEPENDENCIES #================================================= @@ -38,6 +16,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=10 # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # APP "BUILD" (DEPLOYING SOURCES, VENV, COMPILING ETC) #================================================= @@ -45,29 +24,22 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 -### `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" -# $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" - #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 + # Create a dedicated NGINX config using the conf/nginx.conf template ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" +yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) ynh_use_logrotate @@ -81,20 +53,10 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="config.json" --destination="$install_dir/config.json" -# 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.json" chown $app:$app "$install_dir/config.json" chown $app:$app "/var/log/$app" -### 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" - #================================================= # INSTALL YARN AND APP #================================================= @@ -103,14 +65,6 @@ ynh_script_progression --message="Installing app dependencies..." --weight=15 pushd $install_dir ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install dependencies -popd - -#================================================= -# CREATE ADMIN USER -#================================================= -ynh_script_progression --message="Creating admin user..." --weight=15 - -pushd $install_dir ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ./server/cli.js users create __ADMIN__ --admin --config ./config.json popd @@ -121,9 +75,9 @@ popd #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=1 - # 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 #================================================= diff --git a/scripts/remove b/scripts/remove index a691112..7d5b107 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,28 +1,14 @@ #!/bin/bash -#### App file generated with YoloGen, the Yunohost app generator, version 0.6. -# This is the tutorial version of the app. -# It contains extra commands to explain what should be done in case you want to adjust some part of the script. -# Once you are done, you may remove them. + #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= + 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 #================================================= @@ -30,7 +16,6 @@ source /usr/share/yunohost/helpers #================================================= 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 @@ -39,14 +24,10 @@ then fi ynh_remove_systemd_config + ynh_remove_nginx_config ynh_remove_logrotate -# Remove other various files specific to the app... such as : - -ynh_secure_remove --file="/etc/cron.d/$app" - -ynh_secure_remove --file="/etc/$app" ynh_secure_remove --file="/var/log/$app" @@ -54,4 +35,4 @@ ynh_secure_remove --file="/var/log/$app" # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last \ No newline at end of file +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index efe99ab..4fb2375 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,8 +1,5 @@ #!/bin/bash -#### App file generated with YoloGen, the Yunohost app generator, version 0.6. -# This is the tutorial version of the app. -# It contains extra commands to explain what should be done in case you want to adjust some part of the script. -# Once you are done, you may remove them. + #================================================= # GENERIC START #================================================= @@ -20,9 +17,6 @@ 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 -# 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" #================================================= @@ -34,32 +28,29 @@ ynh_restore_file --origin_path="$data_dir" --not_mandatory # (Same as for install dir) chown -R $app:www-data "$data_dir" + #================================================= # RESTORE THE MYSQL DATABASE #================================================= - ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 +ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1 ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql - #================================================= + +#================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= # RESTORE THE PHP-FPM CONFIGURATION #================================================= 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/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" -ynh_restore_file --origin_path="/etc/logrotate.d/$app" -# Other various files... +yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" -ynh_restore_file --origin_path="/etc/cron.d/$app" -ynh_restore_file --origin_path="/etc/$app/" +ynh_restore_file --origin_path="/etc/logrotate.d/$app" #================================================= # GENERIC FINALIZATION @@ -69,7 +60,7 @@ ynh_restore_file --origin_path="/etc/$app/" 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=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index ea11838..ada8243 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,8 +1,5 @@ #!/bin/bash -#### App file generated with YoloGen, the Yunohost app generator, version 0.6. -# This is the tutorial version of the app. -# It contains extra commands to explain what should be done in case you want to adjust some part of the script. -# Once you are done, you may remove them. + #================================================= # GENERIC START #================================================= @@ -12,59 +9,15 @@ 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) -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# -# N.B. : the followings setting migrations 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 #================================================= # 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" -#================================================= -# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) +ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -74,12 +27,9 @@ then ynh_script_progression --message="Upgrading source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" + ynh_setup_source --dest_dir="$install_dir" --keep="config.json" fi -# $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" #================================================= @@ -100,28 +50,21 @@ ynh_add_nginx_config ynh_add_systemd_config -yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" - ynh_use_logrotate --non-append +yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" + #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." --weight=1 +#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_add_config --template="config.json" --destination="$install_dir/config.json" +#ynh_add_config --template="config.json" --destination="$install_dir/config.json" -# 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" +#chmod 400 "$install_dir/config.json" +#chown $app:$app "$install_dir/config.json" #================================================= # CONFIGURE THE APP @@ -130,7 +73,7 @@ ynh_script_progression --message="Updating app dependencies..." --weight=15 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install dependencies + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install popd #================================================= @@ -138,7 +81,8 @@ 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" +ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" + #================================================= # END OF SCRIPT #================================================= From f80b9678941bf7680899d2067ab80c45c72d59ef Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 6 Oct 2023 11:52:39 +0000 Subject: [PATCH 54/62] Auto-update README --- README.md | 4 +--- README_fr.md | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c0e9ba3..70a2d00 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in ## Overview -This app provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. - -*Note that this package is still work in progress, don't consider it as stable.* +Gancio provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. **Shipped version:** 1.6.17~ynh1 diff --git a/README_fr.md b/README_fr.md index 93b0422..3a0fda1 100644 --- a/README_fr.md +++ b/README_fr.md @@ -16,10 +16,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po ## Vue d’ensemble -This app provide an online agenda open to contributions, and federated with the fediverse using ActivityPub. - -*Note that this package is still work in progress, don't consider it as stable.* - +Gancio propose un agenda en ligne ouvert aux contributions, et fédéré avec le fediverse via ActivityPub. **Version incluse :** 1.6.17~ynh1 From 6cccdf38254d2d689499baf65ac522c35d7582f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 6 Oct 2023 14:25:09 +0200 Subject: [PATCH 55/62] fix --- scripts/install | 8 +++++--- scripts/restore | 7 ++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 6f2115a..65cb3d0 100644 --- a/scripts/install +++ b/scripts/install @@ -39,11 +39,14 @@ ynh_add_nginx_config # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" - # Use logrotate to manage application logfile(s) ynh_use_logrotate +mkdir -p /var/log/$app +chown $app -R /var/log/$app + +yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" + #================================================= # APP INITIAL CONFIGURATION #================================================= @@ -55,7 +58,6 @@ ynh_add_config --template="config.json" --destination="$install_dir/config.json" chmod 400 "$install_dir/config.json" chown $app:$app "$install_dir/config.json" -chown $app:$app "/var/log/$app" #================================================= # INSTALL YARN AND APP diff --git a/scripts/restore b/scripts/restore index 4fb2375..5693046 100644 --- a/scripts/restore +++ b/scripts/restore @@ -18,6 +18,7 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chown -R $app:www-data "$install_dir" +chown $app:$app "/var/log/$app" #================================================= # RESTORE THE DATA DIRECTORY @@ -48,10 +49,10 @@ 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 -yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" - ynh_restore_file --origin_path="/etc/logrotate.d/$app" +yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" + #================================================= # GENERIC FINALIZATION #================================================= @@ -67,4 +68,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last \ No newline at end of file +ynh_script_progression --message="Restoration completed for $app" --last From 75fa92387d830da3f886d74e992babf9a9099dc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 6 Oct 2023 14:40:47 +0200 Subject: [PATCH 56/62] Update restore --- scripts/restore | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 5693046..fddbb8b 100644 --- a/scripts/restore +++ b/scripts/restore @@ -18,7 +18,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" chown -R $app:www-data "$install_dir" -chown $app:$app "/var/log/$app" #================================================= # RESTORE THE DATA DIRECTORY @@ -46,11 +45,14 @@ ynh_script_progression --message="Restoring system configurations related to $ap ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +mkdir -p /var/log/$app +chown $app -R /var/log/$app + ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet ynh_restore_file --origin_path="/etc/logrotate.d/$app" - +chown $app:$app "/var/log/$app" yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" #================================================= From bc7513653181dc3e84c965dc1aa2d1b43bad10d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 6 Oct 2023 15:02:39 +0200 Subject: [PATCH 57/62] Update restore --- scripts/restore | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/restore b/scripts/restore index fddbb8b..961e5f1 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,6 +10,14 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." --weight=10 + +# Install Nodejs +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -53,6 +61,7 @@ systemctl enable $app.service --quiet ynh_restore_file --origin_path="/etc/logrotate.d/$app" chown $app:$app "/var/log/$app" + yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log" #================================================= From e9d9a7c1a5395a48b0fbbef7faa96b566e0aa56b Mon Sep 17 00:00:00 2001 From: lapineige Date: Fri, 6 Oct 2023 19:16:12 +0200 Subject: [PATCH 58/62] psql dump, not mysql --- scripts/backup | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/backup b/scripts/backup index a758c5b..b94dbdb 100644 --- a/scripts/backup +++ b/scripts/backup @@ -62,7 +62,7 @@ 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 #================================================= From 9f5aae8dc6decbe9e6c59c78246387db48b4be9b Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 7 Oct 2023 08:01:39 +0200 Subject: [PATCH 59/62] remove cron restoration --- scripts/restore | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/restore b/scripts/restore index efe99ab..e5a34f7 100644 --- a/scripts/restore +++ b/scripts/restore @@ -57,8 +57,6 @@ systemctl enable $app.service --quiet yunohost service add $app --description="A federated shared agenda for local communities." --log="/var/log/$app/$app.log" ynh_restore_file --origin_path="/etc/logrotate.d/$app" # Other various files... - -ynh_restore_file --origin_path="/etc/cron.d/$app" ynh_restore_file --origin_path="/etc/$app/" #================================================= @@ -76,4 +74,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last \ No newline at end of file +ynh_script_progression --message="Restoration completed for $app" --last From 7fddf86e1c54a2b7c0bd351fac298e0e253d0aa8 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 7 Oct 2023 08:05:09 +0200 Subject: [PATCH 60/62] allow_email --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index 83179ab..1cc2df3 100644 --- a/manifest.toml +++ b/manifest.toml @@ -61,7 +61,7 @@ ram.runtime = "50M" sha256 = "fd9b0869d4c733c4b7de9f3bec0889918170822f1b12104ec32923c30648746f" [resources.system_user] - #allow_email = true + allow_email = true [resources.install_dir] @@ -81,4 +81,4 @@ ram.runtime = "50M" [resources.database] type = "postgresql" - \ No newline at end of file + From 6a990363cc6f93ce48f42f7f868fbb3a595d6f50 Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 7 Oct 2023 08:05:36 +0200 Subject: [PATCH 61/62] more verbosity --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 65cb3d0..4118fb1 100644 --- a/scripts/install +++ b/scripts/install @@ -62,7 +62,7 @@ chown $app:$app "$install_dir/config.json" #================================================= # INSTALL YARN AND APP #================================================= -ynh_script_progression --message="Installing app dependencies..." --weight=15 +ynh_script_progression --message="Installing app dependencies and creating admin user..." --weight=15 pushd $install_dir ynh_use_nodejs From 54723703d8b883f1c542817861bf19efa9f8112e Mon Sep 17 00:00:00 2001 From: lapineige Date: Sat, 7 Oct 2023 08:06:23 +0200 Subject: [PATCH 62/62] restore better comments --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index ada8243..0f45e8f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -73,7 +73,7 @@ ynh_script_progression --message="Updating app dependencies..." --weight=15 pushd $install_dir ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install # Install/upgrade dependencies popd #=================================================