mirror of
https://github.com/YunoHost-Apps/gancio_ynh.git
synced 2024-09-03 20:36:19 +02:00
commit
444dc04d19
14 changed files with 122 additions and 227 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||
location __PATH__/ {
|
||||
|
||||
proxy_pass http://127.0.0.1:__PORT__;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[Unit]
|
||||
Description=Gancio : federated agenda
|
||||
Description=Gancio: federated agenda
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
|
|
|
@ -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.
|
||||
|
|
1
doc/DESCRIPTION_fr.md
Normal file
1
doc/DESCRIPTION_fr.md
Normal file
|
@ -0,0 +1 @@
|
|||
Gancio propose un agenda en ligne ouvert aux contributions, et fédéré avec le fediverse via ActivityPub.
|
|
@ -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
|
||||
|
||||
[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"
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#=================================================
|
||||
|
||||
nodejs_version=16
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
51
scripts/change_url
Normal file
51
scripts/change_url
Normal file
|
@ -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
|
|
@ -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,33 +24,29 @@ 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"
|
||||
|
||||
# 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
|
||||
#=================================================
|
||||
|
@ -81,36 +56,17 @@ 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
|
||||
#=================================================
|
||||
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
|
||||
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 +77,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
|
||||
#=================================================
|
||||
|
|
|
@ -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
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
|
|
|
@ -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
|
||||
#=================================================
|
||||
|
@ -13,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
|
||||
#=================================================
|
||||
|
@ -20,9 +25,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,30 +36,35 @@ 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"
|
||||
|
||||
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
|
||||
|
||||
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/$app/"
|
||||
|
||||
chown $app:$app "/var/log/$app"
|
||||
|
||||
yunohost service add $app --description="Federated shared agenda for local communities" --log="/var/log/$app/$app.log"
|
||||
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
|
@ -67,7 +74,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
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -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 # Install/upgrade dependencies
|
||||
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
|
||||
#=================================================
|
||||
|
|
Loading…
Reference in a new issue