1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/castopod_ynh.git synced 2024-09-03 18:16:14 +02:00

Merge pull request #97 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2023-03-08 22:47:14 +01:00 committed by GitHub
commit 66553f7836
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 168 additions and 630 deletions

View file

@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# Castopod for YunoHost
[![Integration level](https://dash.yunohost.org/integration/castopod.svg)](https://dash.yunohost.org/appci/app/castopod) ![Working status](https://ci-apps.yunohost.org/ci/badges/castopod.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/castopod.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/castopod.svg)](https://dash.yunohost.org/appci/app/castopod) ![Working status](https://ci-apps.yunohost.org/ci/badges/castopod.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/castopod.maintain.svg)
[![Install Castopod with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=castopod)
*[Lire ce readme en français.](./README_fr.md)*
@ -16,31 +17,22 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
Castopod is a free & open-source hosting platform made for podcasters who want engage and interact with their audience.
Castopod is easy to install and was built on top of CodeIgniter4, a powerful PHP framework with a very small footprint.
### Status
Castopod is currently in beta but already quite stable and used by podcasters around the world!
### Features
- Free & open-source (AGPL v3 License)
- Focused on data sovereignty: your content, audience, and analytics belong to you, and you only
- Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, …
- Built-in social network
- Built-in analytics
- Built-in marketing tools
- Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites…
- Built-in social network, analytics, marketing tools
- Monetization
- Publish your episodes everywhere with RSS:
- Podcast import: move your existing podcast into Castopod
- Move your podcast out of Castopod
- Multi-tenant: host as many podcasts as you want
- Multi-user: add contributors and set roles
- i18n support: translated in English, French & Polish with more to come!
**Shipped version:** 1.1.2~ynh1
**Shipped version:** 1.1.2~ynh2
**Demo:** https://podcast.podlibre.org/@podlibre_fr
@ -48,21 +40,6 @@ Castopod is currently in beta but already quite stable and used by podcasters ar
![Screenshot of Castopod](./doc/screenshots/screenshot.png)
## Disclaimers / important information
## Configuration
* How to configure this app: Go to `domain.ltd/cp-admin` to connect to the administration panel.
#### Multi-user support
* Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users? **Yes**
## Limitations
* :warning: Installation possible only on a root domain or subdomain.
## Documentation and resources
* Official app website: <https://castopod.org/>

View file

@ -5,69 +5,45 @@ It shall NOT be edited by hand.
# Castopod pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/castopod.svg)](https://dash.yunohost.org/appci/app/castopod) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/castopod.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/castopod.maintain.svg)
[![Niveau dintégration](https://dash.yunohost.org/integration/castopod.svg)](https://dash.yunohost.org/appci/app/castopod) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/castopod.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/castopod.maintain.svg)
[![Installer Castopod avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=castopod)
*[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Castopod 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.*
> *Ce package vous permet dinstaller Castopod rapidement et simplement sur un serveur YunoHost.
Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble
## Vue densemble
Castopod is a free & open-source hosting platform made for podcasters who want engage and interact with their audience.
Castopod is easy to install and was built on top of CodeIgniter4, a powerful PHP framework with a very small footprint.
### Status
Castopod is currently in beta but already quite stable and used by podcasters around the world!
Castopod est une plate-forme d'hébergement gratuite et open source conçue pour les podcasteurs qui souhaitent interagir avec leur public.
### Features
### Caractéristiques
- Free & open-source (AGPL v3 License)
- Focused on data sovereignty: your content, audience, and analytics belong to you, and you only
- Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, …
- Built-in social network
- Built-in analytics
- Built-in marketing tools
- Monetization
- Publish your episodes everywhere with RSS:
- Podcast import: move your existing podcast into Castopod
- Move your podcast out of Castopod
- Multi-tenant: host as many podcasts as you want
- Multi-user: add contributors and set roles
- i18n support: translated in English, French & Polish with more to come!
- Axé sur la souveraineté des données : votre contenu, votre audience et vos analyses vous appartiennent, et vous seul
- Fonctionnalités du podcasting 2.0 : GUID, verrouillé, transcriptions, financement, chapitres, localisation, personnes, extraits sonores…
- Réseau social intégré, outils d'analyse et de marketing
- Monétisation
- Publiez vos épisodes partout avec RSS
- Importation de podcast : déplacez votre podcast existant dans Castopod
- Déplacez votre podcast hors de Castopod
- Multi-locataire : hébergez autant de podcasts que vous le souhaitez
- Multi-utilisateur : ajouter des contributeurs et définir des rôles
**Version incluse :** 1.1.2~ynh1
**Version incluse :** 1.1.2~ynh2
**Démo :** https://podcast.podlibre.org/@podlibre_fr
## Captures d'écran
## Captures décran
![Capture d'écran de Castopod](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes
## Configuration
* Comment configurer cette application : Accédez à `domain.ltd/cp-admin` pour vous connecter au panneau d'administration.
#### Prise en charge multi-utilisateurs
* Les authentifications LDAP et HTTP sont-elles prises en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
## Limites
* :warning : Installation possible uniquement sur un domaine racine ou un sous-domaine.
![Capture décran de Castopod](./doc/screenshots/screenshot.png)
## Documentations et ressources
* Site officiel de l'app : <https://castopod.org/>
* Documentation officielle de l'admin : <https://docs.castopod.org/>
* Dépôt de code officiel de l'app : <https://code.castopod.org/adaures/castopod>
* Site officiel de lapp : <https://castopod.org/>
* Documentation officielle de ladmin : <https://docs.castopod.org/>
* Dépôt de code officiel de lapp : <https://code.castopod.org/adaures/castopod>
* Documentation YunoHost pour cette app : <https://yunohost.org/app_castopod>
* Signaler un bug : <https://github.com/YunoHost-Apps/castopod_ynh/issues>
@ -83,4 +59,4 @@ ou
sudo yunohost app upgrade castopod -u https://github.com/YunoHost-Apps/castopod_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** <https://yunohost.org/packaging_apps>
**Plus dinfos sur le packaging dapplications :** <https://yunohost.org/packaging_apps>

View file

@ -31,7 +31,9 @@ database.default.DBPrefix="cp_"
# Email configuration
#--------------------------------------------------------------------
# email.fromEmail="your_email_address"
# email.SMTPHost="your_smtp_host"
# email.fromName="Castopod"
# email.SMTPHost="localhost"
# email.SMTPPort="25"
# email.SMTPUser="your_smtp_user"
# email.SMTPPass="your_smtp_password"
@ -55,4 +57,3 @@ cache.redis.database=__REDIS_DB__
# REST API configuration
#--------------------------------------------------------------------
# restapi.enabled=true

View file

@ -1,4 +1,4 @@
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/public/index.php scheduled-activities
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/public/index.php scheduled-video-clips
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __FINALPATH__/public/index.php scheduled-websub-publish
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/public/index.php scheduled-activities
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/public/index.php scheduled-video-clips
* * * * * __APP__ /usr/bin/php__PHPVERSION__ __INSTALL_DIR__/public/index.php scheduled-websub-publish

View file

@ -2,7 +2,7 @@
location __PATH__/ {
# Path to source
alias __FINALPATH__/public/;
alias __INSTALL_DIR__/public/;
index index.php;

1
doc/ADMIN.md Normal file
View file

@ -0,0 +1 @@
How to configure this app: Go to `__DOMAIN__/cp-admin` to connect to the administration panel.

1
doc/ADMIN_fr.md Normal file
View file

@ -0,0 +1 @@
Comment configurer cette application : Accédez à `__DOMAIN__/cp-admin` pour vous connecter au panneau d'administration.

View file

@ -1,24 +1,15 @@
Castopod is a free & open-source hosting platform made for podcasters who want engage and interact with their audience.
Castopod is easy to install and was built on top of CodeIgniter4, a powerful PHP framework with a very small footprint.
### Status
Castopod is currently in beta but already quite stable and used by podcasters around the world!
### Features
- Free & open-source (AGPL v3 License)
- Focused on data sovereignty: your content, audience, and analytics belong to you, and you only
- Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites, …
- Built-in social network
- Built-in analytics
- Built-in marketing tools
- Podcasting 2.0 features: GUID, locked, transcripts, funding, chapters, location, persons, soundbites…
- Built-in social network, analytics, marketing tools
- Monetization
- Publish your episodes everywhere with RSS:
- Podcast import: move your existing podcast into Castopod
- Move your podcast out of Castopod
- Multi-tenant: host as many podcasts as you want
- Multi-user: add contributors and set roles
- i18n support: translated in English, French & Polish with more to come!
- Multi-user: add contributors and set roles

14
doc/DESCRIPTION_fr.md Normal file
View file

@ -0,0 +1,14 @@
Castopod est une plate-forme d'hébergement gratuite et open source conçue pour les podcasteurs qui souhaitent interagir avec leur public.
### Caractéristiques
- Axé sur la souveraineté des données : votre contenu, votre audience et vos analyses vous appartiennent, et vous seul
- Fonctionnalités du podcasting 2.0 : GUID, verrouillé, transcriptions, financement, chapitres, localisation, personnes, extraits sonores…
- Réseau social intégré, outils d'analyse et de marketing
- Monétisation
- Publiez vos épisodes partout avec RSS
- Importation de podcast : déplacez votre podcast existant dans Castopod
- Déplacez votre podcast hors de Castopod
- Multi-locataire : hébergez autant de podcasts que vous le souhaitez
- Multi-utilisateur : ajouter des contributeurs et définir des rôles

View file

@ -1,12 +0,0 @@
## Configuration
* How to configure this app: Go to `domain.ltd/cp-admin` to connect to the administration panel.
#### Multi-user support
* Are LDAP and HTTP auth supported? **No**
* Can the app be used by multiple users? **Yes**
## Limitations
* :warning: Installation possible only on a root domain or subdomain.

View file

@ -1,12 +0,0 @@
## Configuration
* Comment configurer cette application : Accédez à `domain.ltd/cp-admin` pour vous connecter au panneau d'administration.
#### Prise en charge multi-utilisateurs
* Les authentifications LDAP et HTTP sont-elles prises en charge ? **Non**
* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui**
## Limites
* :warning : Installation possible uniquement sur un domaine racine ou un sous-domaine.

1
doc/POST_INSTALL.md Normal file
View file

@ -0,0 +1 @@
After post-installation configuration, go to `__DOMAIN__/cp-admin` to connect to the administration panel.

1
doc/POST_INSTALL_fr.md Normal file
View file

@ -0,0 +1 @@
Après la configuration post-installation, accédez à `__DOMAIN__/cp-admin` pour vous connecter au panneau d'administration.

1
doc/PRE_UPGRADE.md Normal file
View file

@ -0,0 +1 @@
Castopod will not upgrade from previous beta versions.

1
doc/PRE_UPGRADE_fr.md Normal file
View file

@ -0,0 +1 @@
Castopod ne mettra pas à jour les versions bêta précédentes.

View file

@ -1,53 +0,0 @@
{
"name": "Castopod",
"id": "castopod",
"packaging_format": 1,
"description": {
"en": "Hosting platform made for podcasters",
"fr": "Plateforme d'hébergement conçue pour les podcasteurs"
},
"version": "1.1.2~ynh1",
"url": "https://castopod.org/",
"upstream": {
"license": "GPL-3.0-only",
"website": "https://castopod.org/",
"demo": "https://podcast.podlibre.org/@podlibre_fr",
"admindoc": "https://docs.castopod.org/",
"code": "https://code.castopod.org/adaures/castopod"
},
"license": "GPL-3.0-only",
"maintainer": {
"name": "eric_G",
"email": ""
},
"requirements": {
"yunohost": ">= 11.0.9"
},
"multi_instance": true,
"services": [
"nginx",
"php8.1-fpm",
"mysql"
],
"arguments": {
"install" : [
{
"name": "domain",
"type": "domain",
"help": {
"en": "Castopod needs to be installed in a dedicated domain or sub-domain.",
"fr": "Castopod doit être installé dans un domaine ou sous-domaine dédié."
}
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, Castopod will be accessible by people who do not have an account. This can be changed later via the webadmin.",
"fr": "Si cette case est cochée, Castopod sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
}

54
manifest.toml Normal file
View file

@ -0,0 +1,54 @@
packaging_format = 2
id = "castopod"
name = "Castopod"
description.en = "Hosting platform made for podcasters"
description.fr = "Plateforme d'hébergement conçue pour les podcasteurs"
version = "1.1.2~ynh2"
maintainers = ["eric_G"]
[upstream]
license = "GPL-3.0-only"
website = "https://castopod.org/"
demo = "https://podcast.podlibre.org/@podlibre_fr"
admindoc = "https://docs.castopod.org/"
code = "https://code.castopod.org/adaures/castopod"
[integration]
yunohost = ">= 11.1.13"
architectures = "all"
multi_instance = true
ldap = false
sso = false
disk = "50M"
ram.build = "100M"
ram.runtime = "50M"
[install]
[install.domain]
help.en = "Castopod needs to be installed in a dedicated domain or sub-domain."
help.fr = "Castopod doit être installé dans un domaine ou sous-domaine dédié."
type = "domain"
full_domain = true
[install.init_main_permission]
help.en = "If enabled, Castopod will be accessible by people who do not have an account. This can be changed later via the webadmin."
help.fr = "Si cette case est cochée, Castopod sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
type = "group"
default = "visitors"
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "mariadb-server ffmpeg php8.1-fpm php8.1-mysql php8.1-gd php8.1-intl php8.1-curl php8.1-mbstring php8.1-xml php8.1-mysqlnd"
[resources.database]
type = "mysql"

View file

@ -4,10 +4,6 @@
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="8.1"
pkg_dependencies="ffmpeg php${YNH_PHP_VERSION}-fpm php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-mysqlnd"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -9,25 +9,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -37,7 +18,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,94 +9,12 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path="/"
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=5
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_change_url_nginx_config
#=================================================
# END OF SCRIPT

View file

@ -1,11 +0,0 @@
SET AUTOCOMMIT = 0;
START TRANSACTION;
ALTER TABLE `cp_settings`
ADD COLUMN context VARCHAR(255) NULL AFTER `type`;
ALTER TABLE cp_podcasts ADD COLUMN published_at DATETIME DEFAULT NULL AFTER
updated_by;
UPDATE cp_podcasts SET published_at = created_at;
COMMIT;

View file

@ -9,109 +9,49 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
phpversion=$YNH_PHP_VERSION
app=$YNH_APP_INSTANCE_NAME
fpm_footprint="low"
fpm_free_footprint=0
fpm_usage="low"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=2
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
ynh_setup_source --dest_dir="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# PHP-FPM CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# SPECIFIC SETUP
#=================================================
@ -124,38 +64,9 @@ redis_db=$(ynh_redis_get_free_db)
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
#redis_number=$(( $YNH_APP_INSTANCE_NUMBER - 1 ))
ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
chmod 600 $final_path/.env
chown $app:www-data "$final_path/.env"
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..." --weight=1
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=10
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
ynh_add_config --template="../conf/.env.example" --destination="$install_dir/.env"
chmod 600 $install_dir/.env
chown $app:www-data "$install_dir/.env"
#=================================================
# END OF SCRIPT

View file

@ -12,63 +12,23 @@ source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
# redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#=================================================
# REMOVE THE REDIS DATABASE
#=================================================
ynh_script_progression --message="Removing the Redis database..." --weight=1
ynh_script_progression --message="Removing Redis database..." --weight=1
ynh_redis_remove_db "$redis_db"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE VARIOUS FILES
#=================================================
@ -76,16 +36,6 @@ ynh_remove_app_dependencies
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,98 +10,33 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
#### Remove this function if there's nothing to clean before calling the remove script.
true
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=2
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#=================================================
# RESTORE VARIOUS FILES
# RESTORE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Restoring cron job..." --weight=1
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=3
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
@ -110,9 +45,9 @@ chmod 644 "/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -9,95 +9,35 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
phpversion=$YNH_PHP_VERSION
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# 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 final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# If fpm_footprint doesn't exist, create it
if [ -z "$fpm_footprint" ]; then
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=low
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "$fpm_free_footprint" ]; then
if [ -z "${fpm_free_footprint:-}" ]; then
fpm_free_footprint=0
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "$fpm_usage" ]; then
if [ -z "${fpm_usage:-}" ]; then
fpm_usage=low
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -106,73 +46,40 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_secure_remove --file="$final_path/app"
ynh_secure_remove --file="$final_path/public/assets"
ynh_secure_remove --file="$install_dir/app"
ynh_secure_remove --file="$install_dir/public/assets"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep=".env"
ynh_setup_source --dest_dir="$install_dir" --keep=".env"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
#=================================================
# MYSQL CONFIGURATION
# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)
#=================================================
if ynh_compare_current_package_version --comparison eq --version 1.0.0-96~ynh1
then
ynh_script_progression --message="Upgrading MySQL configuration..." --weight=1
ynh_mysql_connect_as --user=$db_name --password=$db_pwd --database=$db_name < ./from_beta_16.sql
fi
# UPDATE A CONFIG FILE
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
ynh_script_progression --message="Updating a configuration file..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=10
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# CONFIGURE CASTOPOD
#=================================================
# ynh_script_progression --message="Configuring Castopod..." --weight=1
# ynh_add_config --template="../conf/.env.example" --destination="$final_path/.env"
# chmod 600 $final_path/.env
# chown $app:www-data "$final_path/.env"
#=================================================
# SETUP CRON
#=================================================
ynh_script_progression --message="Setuping cron..." --weight=1
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# RELOAD NGINX
# CONFIGURE CASTOPOD
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
# ynh_script_progression --message="Configuring Castopod..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
# ynh_add_config --template="../conf/.env.example" --destination="$install_dir/.env"
# chmod 600 $install_dir/.env
# chown $app:www-data "$install_dir/.env"
#=================================================
# END OF SCRIPT

9
tests.toml Normal file
View file

@ -0,0 +1,9 @@
test_format = 1.0
[default]
# -------------------------------
# Commits to test upgrade from
# -------------------------------
test_upgrade_from.72a5f668.name = "Upgrade from 1.1.2"