From 1c4461e674a17f0d7393282776f619f1e5f02725 Mon Sep 17 00:00:00 2001 From: eric_G <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 24 Dec 2023 18:20:53 +0100 Subject: [PATCH] Testing (#87) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * cleaning (#77) * Update upgrade * 2.4.2 (#79) * 2.4.2 * Auto-update README Co-authored-by: yunohost-bot * [autopatch] Add Common Platform Enumeration id to `manifest.json` (#81) * Testing (#80) * cleaning (#77) * Update upgrade * 2.4.2 (#79) * 2.4.2 * Auto-update README Co-authored-by: yunohost-bot Co-authored-by: yunohost-bot * [autopatch] Add Common Platform Enumeration id to `manifest.json` Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> Co-authored-by: Yunohost-Bot <> * set relative path for --keep opt * Auto-update README * Update install * Auto-update README * Upgrade auto-updater (#84) * [autopatch] Upgrade auto-updater * Auto-update README --------- Co-authored-by: tituspijean * Update manifest.json * v2 (#85) * v2 * v2 * Auto-update README --------- Co-authored-by: yunohost-bot * Update manifest.toml * Auto-update README * Update manifest.toml * Update manifest.toml * Update manifest.toml * Auto-update README * Update _common.sh * cleaning * Auto-update README * Update _common.sh --------- Co-authored-by: yunohost-bot Co-authored-by: YunoHost Bot Co-authored-by: tituspijean --- README.md | 2 +- README_fr.md | 2 +- doc/ADMIN.md | 2 +- doc/ADMIN_fr.md | 2 +- manifest.toml | 10 ++++++---- scripts/change_url | 2 +- scripts/install | 43 +++++++++++++++---------------------------- scripts/remove | 20 +------------------- scripts/restore | 32 +++++--------------------------- 9 files changed, 32 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index 6a69d3b..671bb8b 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ CodiMD is the free software version of HackMD, developed and opened source by th CodiMD is perfect for open communities, while HackMD emphasizes on permission and access controls for commercial use cases. -**Shipped version:** 2.4.2~ynh2 +**Shipped version:** 2.4.2~ynh3 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 7938e4e..1ad9974 100644 --- a/README_fr.md +++ b/README_fr.md @@ -20,7 +20,7 @@ CodiMD est la version logicielle libre de HackMD, développée et ouverte par l' CodiMD est parfait pour les communautés ouvertes, tandis que HackMD met l'accent sur les autorisations et les contrôles d'accès pour les cas d'utilisation commerciale. -**Version incluse :** 2.4.2~ynh2 +**Version incluse :** 2.4.2~ynh3 ## Captures d’écran diff --git a/doc/ADMIN.md b/doc/ADMIN.md index e974bf9..9722dc3 100644 --- a/doc/ADMIN.md +++ b/doc/ADMIN.md @@ -1 +1 @@ -You can configure CodiMD by editing this file `/var/www/codimd/config.json` using the [documentation](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration) +You can configure CodiMD by editing this file `__INSTALL_DIR__/config.json` using the [documentation](https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration) diff --git a/doc/ADMIN_fr.md b/doc/ADMIN_fr.md index 0ac335e..1b2cf9d 100644 --- a/doc/ADMIN_fr.md +++ b/doc/ADMIN_fr.md @@ -1 +1 @@ -Vous pouvez configurer CodiMD en éditant ce fichier `/var/www/codimd/config.json` en utilisant la [documentation](https://hakmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration) +Vous pouvez configurer CodiMD en éditant ce fichier `__INSTALL_DIR__/config.json` en utilisant la [documentation](https://hakmd.io/c/codimd-documentation/%2Fs%2Fcodimd-configuration) diff --git a/manifest.toml b/manifest.toml index 437a208..bfa721f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "CodiMD" description.en = "Collaborative editor to work on notes written in Markdown" description.fr = "Éditeur collaboratif pour travailler sur des notes en Markdown" -version = "2.4.2~ynh2" +version = "2.4.2~ynh3" maintainers = ["eric_G"] @@ -17,11 +17,14 @@ userdoc = "https://hackmd.io/c/codimd-documentation/%2Fs%2Fcodimd-documentation# code = "https://github.com/hackmdio/codimd" [integration] -yunohost = ">= 11.1.18" +yunohost = ">= 11.2" architectures = ["amd64"] multi_instance = false + ldap = true + sso = true + disk = "50M" ram.build = "50M" ram.runtime = "50M" @@ -29,7 +32,6 @@ ram.runtime = "50M" [install] [install.domain] type = "domain" - full_domain = true [install.init_main_permission] help.en = "If enabled, CodiMD will be accessible by people who do not have an account. This can be changed later via the webadmin." @@ -53,7 +55,7 @@ ram.runtime = "50M" main.url = "/" [resources.apt] - packages = "postgresql libssl-dev" + packages = "postgresql, libssl-dev" [resources.database] type = "postgresql" diff --git a/scripts/change_url b/scripts/change_url index 9e8049d..4922e49 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -31,7 +31,7 @@ ynh_change_url_nginx_config path=${path:1} domain=new_domain -ynh_add_config --template="../conf/config.json.example" --destination="$install_dir/config.json" +ynh_add_config --template="config.json.example" --destination="$install_dir/config.json" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 0545ad8..513b473 100644 --- a/scripts/install +++ b/scripts/install @@ -22,7 +22,6 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Setting up source files..." --weight=2 -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$install_dir chmod -R o-rwx "$install_dir" @@ -34,9 +33,23 @@ chmod +x $install_dir/app.js #================================================= ynh_script_progression --message="Configuring NGINX web server..." --weight=2 -# Create a dedicated NGINX config ynh_add_nginx_config +ynh_add_systemd_config + +yunohost service add $app --description="Collaborative Markdown notes" --log="/var/log/$app/$app.log" + +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Modifying a config file..." --weight=1 + +ynh_add_config --template="config.json.example" --destination="$install_dir/config.json" +ynh_add_config --template=".sequelizerc.example" --destination="$install_dir/.sequelizerc" + +chmod 600 $install_dir/config.json +chmod 600 $install_dir/.sequelizerc + #================================================= # SPECIFIC SETUP #================================================= @@ -50,32 +63,6 @@ pushd $install_dir ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Modifying a config file..." --weight=1 - -ynh_add_config --template="../conf/config.json.example" --destination="$install_dir/config.json" -ynh_add_config --template="../conf/.sequelizerc.example" --destination="$install_dir/.sequelizerc" - -chmod 600 $install_dir/config.json -chmod 600 $install_dir/.sequelizerc - -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Configuring a systemd service..." --weight=1 - -# Create a dedicated systemd config -ynh_add_systemd_config - -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Collaborative Markdown notes" --log="/var/log/$app/$app.log" - #================================================= # START SYSTEMD SERVICE #================================================= diff --git a/scripts/remove b/scripts/remove index a814340..64802ec 100644 --- a/scripts/remove +++ b/scripts/remove @@ -14,36 +14,18 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= +ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_exec_warn_less yunohost service status $app >/dev/null then ynh_script_progression --message="Removing $app service..." --weight=1 yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - -# Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5 - -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies ynh_remove_nodejs #================================================= diff --git a/scripts/restore b/scripts/restore index e0dcdda..d3361ec 100644 --- a/scripts/restore +++ b/scripts/restore @@ -6,19 +6,9 @@ # IMPORT GENERIC HELPERS #================================================= -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -26,7 +16,6 @@ ynh_script_progression --message="Restoring the app main directory..." --weight= ynh_restore_file --origin_path="$install_dir" - chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -37,7 +26,6 @@ chown -R $app:www-data "$install_dir" #================================================= ynh_script_progression --message="Reinstalling dependencies..." --weight=7 -# Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -45,37 +33,27 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=6 -ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=5 +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 + +ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." - yunohost service add $app --description="Collaborative Markdown notes" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #=================================================