1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/openproject_ynh.git synced 2024-09-03 19:56:10 +02:00

Merge pull request #3 from YunoHost-Apps/version-2

Version 2
This commit is contained in:
Éric Gaspar 2023-05-26 14:16:30 +02:00 committed by GitHub
commit c13681395d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 136 additions and 502 deletions

View file

@ -5,7 +5,8 @@ It shall NOT be edited by hand.
# OpenProject for YunoHost # OpenProject for YunoHost
[![Integration level](https://dash.yunohost.org/integration/openproject.svg)](https://dash.yunohost.org/appci/app/openproject) ![](https://ci-apps.yunohost.org/ci/badges/openproject.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/openproject.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/openproject.svg)](https://dash.yunohost.org/appci/app/openproject) ![Working status](https://ci-apps.yunohost.org/ci/badges/openproject.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/openproject.maintain.svg)
[![Install OpenProject with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=openproject) [![Install OpenProject with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=openproject)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
@ -15,8 +16,9 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview ## Overview
## Overview OpenProject is a web-based project management software.
OpenProject is a web-based project management software. Its key features are:
### Features
- Project planning and scheduling - Project planning and scheduling
- Product roadmap and release planning - Product roadmap and release planning
@ -29,34 +31,30 @@ OpenProject is a web-based project management software. Its key features are:
- Meeting agendas and meeting minutes - Meeting agendas and meeting minutes
**Shipped version:** 10.5.1~ynh1 **Shipped version:** 10.5.1~ynh2
## Screenshots ## Screenshots
![](./doc/screenshots/screenshot1.png) ![Screenshot of OpenProject](./doc/screenshots/screenshot1.png)
## Disclaimers / important information
* default user and password is admin / admin
## Documentation and resources ## Documentation and resources
* Official app website: https://www.openproject.org/ * Official app website: <https://www.openproject.org/>
* Official admin documentation: https://www.openproject.org/docs/ * Official admin documentation: <https://www.openproject.org/docs/>
* Upstream app code repository: https://github.com/opf/openproject * Upstream app code repository: <https://github.com/opf/openproject>
* YunoHost documentation for this app: https://yunohost.org/app_openproject * YunoHost documentation for this app: <https://yunohost.org/app_openproject>
* Report a bug: https://github.com/YunoHost-Apps/openproject_ynh/issues * Report a bug: <https://github.com/YunoHost-Apps/openproject_ynh/issues>
## Developer info ## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/openproject_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/openproject_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug
or or
sudo yunohost app upgrade openproject -u https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug sudo yunohost app upgrade openproject -u https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps **More info regarding app packaging:** <https://yunohost.org/packaging_apps>

View file

@ -1,18 +1,24 @@
<!--
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.
-->
# OpenProject pour YunoHost # OpenProject pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/openproject.svg)](https://dash.yunohost.org/appci/app/openproject) ![](https://ci-apps.yunohost.org/ci/badges/openproject.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/openproject.maintain.svg) [![Niveau dintégration](https://dash.yunohost.org/integration/openproject.svg)](https://dash.yunohost.org/appci/app/openproject) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/openproject.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/openproject.maintain.svg)
[![Installer OpenProject avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=openproject) [![Installer OpenProject avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=openproject)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer OpenProject rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet dinstaller OpenProject 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.* Si vous navez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment linstaller et en profiter.*
## Vue d'ensemble ## Vue densemble
## Overview OpenProject is a web-based project management software.
OpenProject is a web-based project management software. Its key features are:
### Features
- Project planning and scheduling - Project planning and scheduling
- Product roadmap and release planning - Product roadmap and release planning
@ -25,34 +31,30 @@ OpenProject is a web-based project management software. Its key features are:
- Meeting agendas and meeting minutes - Meeting agendas and meeting minutes
**Version incluse :** 10.5.1~ynh1 **Version incluse :** 10.5.1~ynh2
## Captures décran
![Capture décran de OpenProject](./doc/screenshots/screenshot1.png)
## Captures d'écran
![](./doc/screenshots/screenshot1.png)
## Avertissements / informations importantes
* default user and password is admin / admin
## Documentations et ressources ## Documentations et ressources
* Site officiel de l'app : https://www.openproject.org/ * Site officiel de lapp : <https://www.openproject.org/>
* Documentation officielle de l'admin : https://www.openproject.org/docs/ * Documentation officielle de ladmin : <https://www.openproject.org/docs/>
* Dépôt de code officiel de l'app : https://github.com/opf/openproject * Dépôt de code officiel de lapp : <https://github.com/opf/openproject>
* Documentation YunoHost pour cette app : https://yunohost.org/app_openproject * Documentation YunoHost pour cette app : <https://yunohost.org/app_openproject>
* Signaler un bug : https://github.com/YunoHost-Apps/openproject_ynh/issues * Signaler un bug : <https://github.com/YunoHost-Apps/openproject_ynh/issues>
## Informations pour les développeurs ## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/openproject_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/openproject_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit. Pour essayer la branche testing, procédez comme suit.
```
``` bash
sudo yunohost app install https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug sudo yunohost app install https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug
ou ou
sudo yunohost app upgrade openproject -u https://github.com/YunoHost-Apps/openproject_ynh/tree/testing --debug sudo yunohost app upgrade openproject -u https://github.com/YunoHost-Apps/openproject_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

@ -1,25 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
language="en"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=0
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
#upgrade=1 from_commit=CommitHash
backup_restore=1
multi_instance=0
port_already_use=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -1,5 +1,6 @@
## Overview OpenProject is a web-based project management software.
OpenProject is a web-based project management software. Its key features are:
### Features
- Project planning and scheduling - Project planning and scheduling
- Product roadmap and release planning - Product roadmap and release planning

View file

@ -1,55 +0,0 @@
{
"name": "OpenProject",
"id": "openproject",
"packaging_format": 1,
"description": {
"en": "web-based project management software"
},
"version": "10.5.1~ynh1",
"url": "https://www.openproject.org/",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://www.openproject.org/",
"admindoc": "https://www.openproject.org/docs/",
"code": "https://github.com/opf/openproject"
},
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Moutonjr \"Geoff\"",
"email": "Moutonjr[at]jserv.fr",
"url": "http://jserv.fr"
},
"requirements": {
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
"nginx"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "is_public",
"type": "boolean",
"default": true,
"help": {
"en": "A public Openproject app could be less secure depending your configuration. Butit can allow external people from your Yunohost instance to participate to project management."
}
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["fr", "en"],
"default": "en"
}
]
}
}

70
manifest.toml Normal file
View file

@ -0,0 +1,70 @@
packaging_format = 2
id = "openproject"
name = "OpenProject"
description.en = "Web-based project management software"
description.fr = "Logiciel de gestion de projet basé sur le web"
version = "10.5.1~ynh2"
maintainers = ["Moutonjr \"Geoff\""]
[upstream]
license = "GPL-3.0-or-later"
website = "https://www.openproject.org/"
admindoc = "https://www.openproject.org/docs/"
code = "https://github.com/opf/openproject"
[integration]
yunohost = ">= 11.1.19"
architectures = "all"
multi_instance = false
ldap = false
sso = false
disk = "50M"
ram.build = "800M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
full_domain = true
[install.init_main_permission]
help.en = "Set to visitors, Openproject could be less secure depending on your configuration, but it can allow visitors to participate to project management."
help.fr = "Réglée sur visiteurs, Openproject peut être moins sécurisée en fonction de votre configuration, mais elle peut permettre aux visiteurs de participer à la gestion du projet."
type = "group"
default = "visitors"
[install.language]
ask.en = "Choose the application language"
ask.fr = "Choisissez la langue de l'application"
type = "string"
choices = ["fr", "en"]
default = "en"
[resources]
[resources.ports]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
api.url = "/api"
api.allowed = "visitors"
api.auth_header = false
api.show_tile = false
api.protected = true
[resources.apt]
packages = "apt-transport-https memcached postgresql postgresql-common"
extras.openproject.repo = "deb https://dl.packager.io/srv/deb/opf/openproject/stable/12/debian 11 main"
extras.openproject.key = "https://dl.packager.io/srv/opf/openproject/key"
extras.openproject.packages = "openproject"
[resources.database]
type = "postgresql"

View file

@ -4,12 +4,6 @@
# COMMON VARIABLES # COMMON VARIABLES
#================================================= #=================================================
PROJECT_VERSION=12
# dependencies used by the app
pkg_dependencies="apt-transport-https memcached postgresql postgresql-common"
extra_pkg_dependencies="openproject"
#================================================= #=================================================
# PERSONAL HELPERS # PERSONAL HELPERS
#================================================= #=================================================

View file

@ -10,26 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
true
}
# 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
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#================================================= #=================================================
# DECLARE DATA AND CONF FILES TO BACKUP # DECLARE DATA AND CONF FILES TO BACKUP
#================================================= #=================================================
@ -47,7 +27,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
# BACKUP VARIOUS FILES # BACKUP VARIOUS FILES
#================================================= #=================================================
ynh_backup --src_path="/etc/$app/" ynh_backup --src_path="/etc/openproject/"
#================================================= #=================================================
# BACKUP THE POSTGRESQL DATABASE # BACKUP THE POSTGRESQL DATABASE

View file

@ -9,60 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers 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..."
# Needed for helper "ynh_add_nginx_config"
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# 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
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
@ -77,29 +23,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#================================================= #=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." ynh_script_progression --message="Updating NGINX web server configuration..."
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf ynh_change_url_nginx_config
# 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
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
@ -111,13 +35,6 @@ ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -9,89 +9,14 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST # RETRIEVE ARGUMENTS FROM THE MANIFEST
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
app=$YNH_APP_INSTANCE_NAME
# Installer variables # Installer variables
_homedir="/var/$app/" _homedir="/var/$app/"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..."
# 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..."
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=language --value=$language
ynh_app_setting_set --app=$app --key=_homedir --value=$_homedir ynh_app_setting_set --app=$app --key=_homedir --value=$_homedir
#=================================================
# STANDARD MODIFICATIONS
#=================================================
# FIND AND OPEN A PORT
#=================================================
ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing OpenProject & its dependencies..."
debian_release=$(lsb_release -r -s)
ynh_install_app_dependencies $pkg_dependencies
ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/opf/openproject/stable/$PROJECT_VERSION/debian $debian_release main" --package="$extra_pkg_dependencies" --key="https://dl.packager.io/srv/opf/openproject/key"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
#=================================================
# CREATE A POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Creating a PostgreSQL database..."
ynh_psql_test_if_first_run
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_psql_setup_db --db_user=$db_user --db_name=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -139,12 +64,12 @@ chmod 750 "/etc/openproject/"
chmod -R o-rwx "/etc/openproject/" chmod -R o-rwx "/etc/openproject/"
chown -R $app:$app "/etc/openproject/" chown -R $app:$app "/etc/openproject/"
openproject config:set PORT=$port ynh_exec_warn_less openproject config:set PORT=$port
openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true" ynh_exec_warn_less openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true"
openproject config:set SERVER_HOSTNAME=$domain ynh_exec_warn_less openproject config:set SERVER_HOSTNAME=$domain
openproject config:set SERVER_PATH_PREFIX=$path_url ynh_exec_warn_less openproject config:set SERVER_PATH_PREFIX=$path
openproject configure >> "$YNH_STDINFO" ynh_exec_warn_less openproject configure >> "$YNH_STDINFO"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
@ -153,7 +78,7 @@ openproject configure >> "$YNH_STDINFO"
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app yunohost service add $app --description="Web-based project management software" --log="systemd"
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -163,28 +88,6 @@ ynh_script_progression --message="Starting a systemd service..."
# Start a systemd service # Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary
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
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -9,18 +9,6 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
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
_homedir=$(ynh_app_setting_get --app=$app --key=_homedir)
#================================================= #=================================================
# STANDARD REMOVE # STANDARD REMOVE
#================================================= #=================================================
@ -42,14 +30,6 @@ ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
#=================================================
# REMOVE THE POSTGRESQL DATABASE
#=================================================
ynh_script_progression --message="Removing the PostgreSQL database..."
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
@ -58,14 +38,6 @@ ynh_script_progression --message="Removing NGINX web server configuration..."
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
@ -76,17 +48,7 @@ ynh_script_progression --message="Removing various files..."
ynh_secure_remove --file="$_homedir" ynh_secure_remove --file="$_homedir"
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/$app" ynh_secure_remove --file="/etc/openproject"
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..."
# Delete a system user
ynh_system_user_delete --username=$app
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,34 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_clean_setup () {
ynh_clean_check_starting
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
port=$(ynh_app_setting_get --app=$app --key=port)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..."
#================================================= #=================================================
# STANDARD RESTORATION STEPS # STANDARD RESTORATION STEPS
#================================================= #=================================================
@ -47,33 +19,11 @@ ynh_script_progression --message="Restoring the NGINX web server configuration..
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
debian_release=$(lsb_release -r -s)
ynh_install_app_dependencies $pkg_dependencies
ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/opf/openproject/stable/$PROJECT_VERSION/debian $debian_release main" --package="$extra_pkg_dependencies" --key="https://dl.packager.io/srv/opf/openproject/key"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Restoring the PostgreSQL database..." ynh_script_progression --message="Restoring the PostgreSQL database..."
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#================================================= #=================================================
@ -81,25 +31,25 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
#================================================= #=================================================
ynh_script_progression --message="Restoring various files..." ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/$app/" ynh_restore_file --origin_path="/etc/openproject/"
chmod 750 "/etc/openproject/" chmod 750 "/etc/openproject/"
chmod -R o-rwx "/etc/openproject/" chmod -R o-rwx "/etc/openproject/"
chown -R $app:$app "/etc/openproject/" chown -R $app:$app "/etc/openproject/"
openproject config:set PORT=$port ynh_exec_warn_less openproject config:set PORT=$port
openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true" ynh_exec_warn_less openproject config:set SERVER_PROTOCOL_FORCE_HTTPS="true"
openproject config:set SERVER_HOSTNAME=$domain ynh_exec_warn_less openproject config:set SERVER_HOSTNAME=$domain
openproject config:set SERVER_PATH_PREFIX=$path_url ynh_exec_warn_less openproject config:set SERVER_PATH_PREFIX=$path
openproject configure >> "$YNH_STDINFO" ynh_exec_warn_less openproject configure >> "$YNH_STDINFO"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app yunohost service add $app --description="Web-based project management software" --log=systemd
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE

View file

@ -9,41 +9,12 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) 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)..."
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
ynh_clean_check_starting
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -53,31 +24,6 @@ ynh_script_progression --message="Stopping a systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# 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 a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -86,15 +32,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
debian_release=$(lsb_release -r -s)
ynh_install_app_dependencies $pkg_dependencies
ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/opf/openproject/stable/$PROJECT_VERSION/debian $debian_release main" --package="$extra_pkg_dependencies" --key="https://dl.packager.io/srv/opf/openproject/key"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -102,7 +39,7 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.packager.io/srv/deb/op
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add $app yunohost service add $app --description="Web-based project management software" --log=systemd
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE
@ -111,13 +48,6 @@ ynh_script_progression --message="Starting a systemd service..."
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

7
tests.toml Normal file
View file

@ -0,0 +1,7 @@
test_format = 1.0
[default]
# ------------
# Tests to run
# ------------