mirror of
https://github.com/YunoHost-Apps/gancio_ynh.git
synced 2024-09-03 20:36:19 +02:00
Merge pull request #1 from YunoHost-Apps/testing
Initial version (1.6.17)
This commit is contained in:
commit
04d811cf05
17 changed files with 799 additions and 0 deletions
45
README.md
Normal file
45
README.md
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
<!--
|
||||||
|
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||||
|
It shall NOT be edited by hand.
|
||||||
|
-->
|
||||||
|
|
||||||
|
# Gancio for YunoHost
|
||||||
|
|
||||||
|
[](https://dash.yunohost.org/appci/app/gancio)  
|
||||||
|
|
||||||
|
[](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
|
||||||
|
|
||||||
|
Gancio provide an online agenda open to contributions, and federated with the fediverse using ActivityPub.
|
||||||
|
|
||||||
|
|
||||||
|
**Shipped version:** 1.6.17~ynh1
|
||||||
|
|
||||||
|
**Demo:** https://demo.gancio.org/
|
||||||
|
## Documentation and resources
|
||||||
|
|
||||||
|
* Official app website: <https://gancio.org>
|
||||||
|
* Official user documentation: <https://gancio.org/usage>
|
||||||
|
* Official admin documentation: <https://gancio.org/install/>
|
||||||
|
* Upstream app code repository: <https://framagit.org/les/gancio>
|
||||||
|
* Report a bug: <https://github.com/YunoHost-Apps/gancio_ynh/issues>
|
||||||
|
|
||||||
|
## 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:** <https://yunohost.org/packaging_apps>
|
44
README_fr.md
Normal file
44
README_fr.md
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
<!--
|
||||||
|
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
|
||||||
|
It shall NOT be edited by hand.
|
||||||
|
-->
|
||||||
|
|
||||||
|
# Gancio pour YunoHost
|
||||||
|
|
||||||
|
[](https://dash.yunohost.org/appci/app/gancio)  
|
||||||
|
|
||||||
|
[](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
|
||||||
|
|
||||||
|
Gancio propose un agenda en ligne ouvert aux contributions, et fédéré avec le fediverse via ActivityPub.
|
||||||
|
|
||||||
|
**Version incluse :** 1.6.17~ynh1
|
||||||
|
|
||||||
|
**Démo :** https://demo.gancio.org/
|
||||||
|
## Documentations et ressources
|
||||||
|
|
||||||
|
* Site officiel de l’app : <https://gancio.org>
|
||||||
|
* Documentation officielle utilisateur : <https://gancio.org/usage>
|
||||||
|
* Documentation officielle de l’admin : <https://gancio.org/install/>
|
||||||
|
* Dépôt de code officiel de l’app : <https://framagit.org/les/gancio>
|
||||||
|
* Signaler un bug : <https://github.com/YunoHost-Apps/gancio_ynh/issues>
|
||||||
|
|
||||||
|
## 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 :** <https://yunohost.org/packaging_apps>
|
24
conf/config.json
Normal file
24
conf/config.json
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
{
|
||||||
|
"baseurl": "https://__DOMAIN__",
|
||||||
|
"server": {
|
||||||
|
"host": "localhost",
|
||||||
|
"port": "__PORT__"
|
||||||
|
},
|
||||||
|
"log_level": "debug",
|
||||||
|
"log_path": "/var/log/__APP__/logs",
|
||||||
|
"db": {
|
||||||
|
"dialect": "postgres",
|
||||||
|
"storage": "",
|
||||||
|
"host": "localhost",
|
||||||
|
"database": "__DB_NAME__",
|
||||||
|
"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"
|
||||||
|
}
|
11
conf/nginx.conf
Normal file
11
conf/nginx.conf
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
|
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;
|
||||||
|
}
|
48
conf/systemd.service
Normal file
48
conf/systemd.service
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
[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_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
|
||||||
|
# .. 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
|
1
doc/DESCRIPTION.md
Normal file
1
doc/DESCRIPTION.md
Normal file
|
@ -0,0 +1 @@
|
||||||
|
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.
|
84
manifest.toml
Normal file
84
manifest.toml
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
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"
|
||||||
|
|
||||||
|
version = "1.6.17~ynh1"
|
||||||
|
|
||||||
|
maintainers = ["Lapineige"]
|
||||||
|
|
||||||
|
[upstream]
|
||||||
|
license = "AGPL-3.0-only"
|
||||||
|
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"
|
||||||
|
|
||||||
|
[integration]
|
||||||
|
yunohost = ">= 11.2"
|
||||||
|
architectures = "all"
|
||||||
|
multi_instance = false
|
||||||
|
ldap = false
|
||||||
|
sso = false
|
||||||
|
disk = "50M"
|
||||||
|
ram.build = "50M"
|
||||||
|
ram.runtime = "50M"
|
||||||
|
|
||||||
|
[install]
|
||||||
|
|
||||||
|
[install.domain]
|
||||||
|
type = "domain"
|
||||||
|
|
||||||
|
[install.init_main_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]
|
||||||
|
type = "user"
|
||||||
|
|
||||||
|
[install.password]
|
||||||
|
help.en = "Choose admin user password"
|
||||||
|
help.fr = "Choisissez le mot de passe du compte d'administration."
|
||||||
|
type = "password"
|
||||||
|
|
||||||
|
[resources]
|
||||||
|
|
||||||
|
[resources.sources]
|
||||||
|
|
||||||
|
[resources.sources.main]
|
||||||
|
url = "https://gancio.org/releases/gancio-v1.6.17.tgz"
|
||||||
|
sha256 = "fd9b0869d4c733c4b7de9f3bec0889918170822f1b12104ec32923c30648746f"
|
||||||
|
|
||||||
|
[resources.system_user]
|
||||||
|
allow_email = true
|
||||||
|
|
||||||
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
subdirs = ['uploads', 'user_locale', 'plugins']
|
||||||
|
|
||||||
|
[resources.permissions]
|
||||||
|
main.url = "/"
|
||||||
|
|
||||||
|
[resources.ports]
|
||||||
|
|
||||||
|
[resources.apt]
|
||||||
|
packages = "postgresql"
|
||||||
|
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]
|
||||||
|
type = "postgresql"
|
||||||
|
|
19
scripts/_common.sh
Normal file
19
scripts/_common.sh
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# COMMON VARIABLES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
nodejs_version=16
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# PERSONAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# EXPERIMENTAL HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# FUTURE OFFICIAL HELPERS
|
||||||
|
#=================================================
|
61
scripts/backup
Normal file
61
scripts/backup
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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..."
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE APP MAIN DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="$install_dir"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE DATA DIR
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
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 THE DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Backing up the postgresql database..."
|
||||||
|
|
||||||
|
ynh_psql_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)."
|
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
|
105
scripts/config
Normal file
105
scripts/config
Normal file
|
@ -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
|
86
scripts/install
Normal file
86
scripts/install
Normal file
|
@ -0,0 +1,86 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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 --dest_dir="$install_dir"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
#=================================================
|
||||||
|
# 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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# INSTALL YARN AND APP
|
||||||
|
#=================================================
|
||||||
|
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
|
||||||
|
ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH ./server/cli.js users create __ADMIN__ --admin --config ./config.json
|
||||||
|
popd
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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="systemd"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installation of $app completed" --last
|
38
scripts/remove
Normal file
38
scripts/remove
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
|
#=================================================
|
||||||
|
# REMOVE SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
||||||
|
|
||||||
|
# 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
|
||||||
|
|
||||||
|
ynh_secure_remove --file="/var/log/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Removal of $app completed" --last
|
84
scripts/restore
Normal file
84
scripts/restore
Normal file
|
@ -0,0 +1,84 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="$install_dir"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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"
|
||||||
|
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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="systemd"
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app" --last
|
90
scripts/upgrade
Normal file
90
scripts/upgrade
Normal file
|
@ -0,0 +1,90 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC START
|
||||||
|
#=================================================
|
||||||
|
# IMPORT GENERIC HELPERS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
source _common.sh
|
||||||
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
upgrade_type=$(ynh_check_app_version_changed)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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" --keep="config.json"
|
||||||
|
fi
|
||||||
|
|
||||||
|
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
|
||||||
|
#=================================================
|
||||||
|
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
|
||||||
|
|
||||||
|
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_add_config --template="config.json" --destination="$install_dir/config.json"
|
||||||
|
|
||||||
|
#chmod 400 "$install_dir/config.json"
|
||||||
|
#chown $app:$app "$install_dir/config.json"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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/upgrade dependencies
|
||||||
|
popd
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# 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="Upgrade of $app completed" --last
|
7
tests.toml
Normal file
7
tests.toml
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
test_format = 1.0
|
||||||
|
|
||||||
|
[default]
|
||||||
|
|
||||||
|
# ------------
|
||||||
|
# Tests to run
|
||||||
|
# ------------
|
Loading…
Add table
Reference in a new issue