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

enh-Testing (#58)

* Update check_process
This commit is contained in:
Éric Gaspar 2021-05-06 18:28:44 +02:00 committed by GitHub
parent 0e839f4724
commit 67d95de3f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 47 additions and 91 deletions

View file

@ -1,10 +1,10 @@
# Baïkal for YunoHost # Baïkal for YunoHost
[![Integration level](https://dash.yunohost.org/integration/baikal.svg)](https://dash.yunohost.org/appci/app/baikal) ![](https://ci-apps.yunohost.org/ci/badges/baikal.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/baikal.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/baikal.svg)](https://dash.yunohost.org/appci/app/baikal) ![](https://ci-apps.yunohost.org/ci/badges/baikal.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/baikal.maintain.svg)
[![Install Baïkal with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=baikal) [![Install Baïkal with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=baikal)
> *This package allow you to install Baïkal quickly and simply on a YunoHost server. > *This package allow you to install Baïkal quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* If you don't have YunoHost, please see [here](https://yunohost.org/install) to know how to install and enjoy it.*
## Overview ## Overview
[Baïkal](http://baikal-server.com/) is a CalDAV and CardDAV server, based on [Baïkal](http://baikal-server.com/) is a CalDAV and CardDAV server, based on
@ -14,6 +14,8 @@ sabre/dav, that includes an administration interface for easy management.
## Screenshots ## Screenshots
![](http://www.baikal-server.com/res/img/screenshots/dashboard.png)
## Demo ## Demo
* [YunoHost demo](https://demo.yunohost.org/baikal/admin/) * [YunoHost demo](https://demo.yunohost.org/baikal/admin/)
@ -25,7 +27,7 @@ sabre/dav, that includes an administration interface for easy management.
## Documentation ## Documentation
* Official documentation: http://sabre.io/baikal/ * Official documentation: http://sabre.io/baikal/
* YunoHost documentation: https://yunohost.org/#/app_baikal * YunoHost documentation: https://yunohost.org/en/app_baikal
## YunoHost specific features ## YunoHost specific features
@ -37,14 +39,14 @@ In addition to Baïkal core features, the following are made available with this
#### Supported architectures #### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/baikal%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/baikal/) * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/baikal.svg)](https://ci-apps.yunohost.org/ci/apps/baikal/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/baikal%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/baikal/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/baikal.svg)](https://ci-apps-arm.yunohost.org/ci/apps/baikal/)
## Limitations ## Limitations
## Additional information ## Additional information
* There is a breaking change in the management of the administrator password when upgrading to 0.7.0. You must change the admin password! * There is a breaking change in the management of the administrator password when upgrading to 0.7.0 You must change the admin password!
* To be able to change the admin password, please visit the page: `https://you.domain.tld/yunohost/admin/#/apps/baikal/actions` and set a new password. * To be able to change the admin password, please visit the page: `https://you.domain.tld/yunohost/admin/#/apps/baikal/actions` and set a new password.
## Links ## Links

View file

@ -11,18 +11,14 @@
setup_private=0 setup_private=0
setup_public=0 setup_public=0
upgrade=1 upgrade=1
upgrade=1 from_commit=1aea3f3c4943c83135f7f287e6ac10c03df56323 upgrade=1 from_commit=099f63413f120982232a77fd4ff5f62530d546ad
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
incorrect_path=1
port_already_use=0
change_url=1 change_url=1
;;; Levels
Level 5=auto
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none
;;; Upgrade options ;;; Upgrade options
; commit=1aea3f3c4943c83135f7f287e6ac10c03df56323 ; commit=099f63413f120982232a77fd4ff5f62530d546ad
name=Fix install + refactoring name=Testing (#57)
manifest_arg=domain=DOMAIN&path=PATH&password=mysecret& manifest_arg=domain=DOMAIN&path=PATH&password=mysecret&

View file

@ -5,7 +5,7 @@ system:
cal_enabled: true cal_enabled: true
invite_from: 'noreply@localhost' invite_from: 'noreply@localhost'
dav_auth_type: 'LDAP-UserBind' dav_auth_type: 'LDAP-UserBind'
admin_passwordhash: __PASSWORDHASH__ admin_passwordhash: __PASSWORD_HASH__
auth_realm: BaikalDAV auth_realm: BaikalDAV
base_uri: '__PATH__' base_uri: '__PATH__'
# Auth Backend LDAP-UserBind; LDAP URI # Auth Backend LDAP-UserBind; LDAP URI
@ -24,6 +24,6 @@ database:
sqlite_file: "absolute/path/to/Specific/db/db.sqlite" sqlite_file: "absolute/path/to/Specific/db/db.sqlite"
mysql: true mysql: true
mysql_host: 'localhost' mysql_host: 'localhost'
mysql_dbname: '__DBNAME__' mysql_dbname: '__DB_NAME__'
mysql_username: '__DBUSER__' mysql_username: '__DB_NAME__'
mysql_password: '__DBPASS__' mysql_password: '__DB_PWD__'

View file

@ -1,6 +1,7 @@
location = /.well-known/carddav { location = /.well-known/carddav {
return 301 https://$server_name__PATH__/card.php; return 301 https://$server_name__PATH__/card.php;
} }
location = /.well-known/caldav { location = /.well-known/caldav {
return 301 https://$server_name__PATH__/cal.php; return 301 https://$server_name__PATH__/cal.php;
} }

View file

@ -6,7 +6,7 @@
"en": "Lightweight CalDAV and CardDAV server", "en": "Lightweight CalDAV and CardDAV server",
"fr": "Serveur CalDAV et CardDAV léger" "fr": "Serveur CalDAV et CardDAV léger"
}, },
"version": "0.7.1~ynh1", "version": "0.7.1~ynh2",
"url": "http://baikal-server.com/", "url": "http://baikal-server.com/",
"license": "GPL-3.0", "license": "GPL-3.0",
"maintainer": { "maintainer": {
@ -14,12 +14,12 @@
"email": "julien.malik@paraiso.me" "email": "julien.malik@paraiso.me"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.8.1" "yunohost": ">= 4.1.7"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
@ -27,29 +27,17 @@
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain",
"ask": {
"en": "Choose a domain for Baïkal",
"fr": "Choisissez un domaine pour Baïkal"
},
"example": "domain.org" "example": "domain.org"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Baïkal",
"fr": "Choisissez un chemin pour Baïkal"
},
"example": "/baikal", "example": "/baikal",
"default": "/baikal" "default": "/baikal"
}, },
{ {
"name": "password", "name": "password",
"type": "password", "type": "password",
"ask": {
"en": "Set the password for the administration",
"fr": "Définissez le mot de passe pour l'administration"
},
"example": "mysecret" "example": "mysecret"
} }
] ]

View file

@ -11,14 +11,6 @@
- [ ] Upgrade from last version tested. - [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested. - [ ] Can be reviewed and tested.
## Validation ## Package_check results
--- ---
*Minor decision* * An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
- **Upgrade previous version** :
- [ ] **Code review** :
- [ ] **Approval (LGTM)** :
- [ ] **Approval (LGTM)** :
- **CI succeeded** :
[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/baikal_ynh%20PR-NUM-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/baikal_ynh%20PR-NUM-/)
*Please replace '-NUM-' in this link by the PR number.*
When the PR is marked as ready to merge, you have to wait for 3 days before really merging it.

View file

@ -116,25 +116,14 @@ ynh_mysql_connect_as --user=$db_name --password="$db_pwd" --database=$db_name \
#================================================= #=================================================
bk_conf="${final_path}/config/baikal.yaml" bk_conf="${final_path}/config/baikal.yaml"
cp ../conf/baikal.yaml "$bk_conf" timezone=$(cat /etc/timezone)
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="$bk_conf"
# Create admin password hash
password_hash=$(echo -n admin:BaikalDAV:$password | sha256sum | cut -d ' ' -f 1) password_hash=$(echo -n admin:BaikalDAV:$password | sha256sum | cut -d ' ' -f 1)
ynh_replace_string --match_string="__PASSWORDHASH__" --replace_string="${password_hash}" --target_file="$bk_conf"
ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash
path=${path_url%/}
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$bk_conf"
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$bk_conf"
ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$bk_conf"
ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$bk_conf"
deskey=$(ynh_string_random 24) deskey=$(ynh_string_random 24)
ynh_app_setting_set --app=$app --key=encrypt_key --value="$deskey" ynh_app_setting_set --app=$app --key=encrypt_key --value="$deskey"
ynh_replace_string --match_string="__DESKEY__" --replace_string="$deskey" --target_file="$bk_conf"
# Store the config file checksum into the app settings ynh_add_config --template="../conf/baikal.yaml" --destination="$bk_conf"
ynh_store_file_checksum --file="$bk_conf"
# Disable installation # Disable installation
touch "${final_path}/Specific/INSTALL_DISABLED" touch "${final_path}/Specific/INSTALL_DISABLED"
@ -153,12 +142,12 @@ chmod 640 "$final_path/config/baikal.yaml"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=2 ynh_script_progression --message="Configuring permissions..." --weight=2
# Allow public access on / # Allow public access on /
ynh_permission_update --permission "main" --add "visitors" ynh_permission_update --permission="main" --add="visitors"
# But restrain on /admin # But restrain on /admin
ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users" ynh_permission_create --permission="admin" --url="/admin" --allowed="all_users"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX

View file

@ -20,6 +20,9 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
password_hash=$(ynh_app_setting_get --app=$app --key=password_hash)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -44,6 +47,18 @@ if [ -z "$db_name" ]; then
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi 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
if ! ynh_permission_exists --permission="admin"; then
# Create the required permissions
ynh_permission_create --permission="admin" --url="/admin" --allowed="all_users"
fi
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#================================================= #=================================================
@ -91,7 +106,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
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# UPGRADE DEPENDENCIES # UPGRADE DEPENDENCIES
@ -129,29 +143,19 @@ then
#================================================= #=================================================
ynh_script_progression --message="Upgrading Baïkal configuration..." --weight=2 ynh_script_progression --message="Upgrading Baïkal configuration..." --weight=2
bk_conf="${final_path}/config/baikal.yaml"
ynh_backup_if_checksum_is_different --file="$bk_conf"
cp ../conf/baikal.yaml "$bk_conf"
ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="$bk_conf"
password_hash=$(ynh_app_setting_get --app=$app --key=password_hash)
# If the password_hash is not in the app's config, recreate it from the password.
if [ -z "$password_hash" ]; then if [ -z "$password_hash" ]; then
password=$(ynh_app_setting_get --app=$app --key=password) password=$(ynh_app_setting_get --app=$app --key=password)
password_hash=$(echo -n admin:BaikalDAV:$password | md5sum | cut -d ' ' -f 1) password_hash=$(echo -n admin:BaikalDAV:$password | md5sum | cut -d ' ' -f 1)
ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash ynh_app_setting_set --app=$app --key=password_hash --value=$password_hash
fi fi
ynh_replace_string --match_string="__PASSWORDHASH__" --replace_string="${password_hash}" --target_file="$bk_conf"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url%/}" --target_file="$bk_conf"
ynh_replace_string --match_string="__DBNAME__" --replace_string="$db_name" --target_file="$bk_conf"
ynh_replace_string --match_string="__DBUSER__" --replace_string="$db_name" --target_file="$bk_conf"
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_replace_string --match_string="__DBPASS__" --replace_string="$db_pwd" --target_file="$bk_conf"
bk_conf="${final_path}/config/baikal.yaml"
timezone=$(cat /etc/timezone)
path=${path_url%/}
deskey=$(ynh_app_setting_get --app=$app --key=encrypt_key) deskey=$(ynh_app_setting_get --app=$app --key=encrypt_key)
ynh_app_setting_set --app=$app --key=encrypt_key --value="$deskey" ynh_app_setting_set --app=$app --key=encrypt_key --value="$deskey"
ynh_replace_string --match_string="__DESKEY__" --replace_string="$deskey" --target_file="$bk_conf"
ynh_add_config --template="../conf/baikal.yaml" --destination="$bk_conf"
#================================================= #=================================================
# UPGRADE BAIKAL # UPGRADE BAIKAL
@ -183,22 +187,6 @@ chown -R root: "$final_path"
chown $app "$final_path/config/baikal.yaml" chown $app "$final_path/config/baikal.yaml"
chmod 640 "$final_path/config/baikal.yaml" chmod 640 "$final_path/config/baikal.yaml"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=2
# Upgrade from the legacy permissions system
protected_uris=$(ynh_app_setting_get --app="$app" --key=protected_uris)
if [ -n "${protected_uris}" ]; then
ynh_app_setting_delete --app="$app" --key=protected_uris
# Allow public access on /
ynh_permission_update --permission "main" --add "visitors"
# But restrain on /admin
ynh_permission_create --permission "admin" --url "/admin" --allowed "all_users"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================