diff --git a/README.md b/README.md index 900152d..f892852 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![Integration level](https://dash.yunohost.org/integration/mobilizon.svg)](https://dash.yunohost.org/appci/app/mobilizon) [![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/mobilizon_ynh%20(yalh76)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/mobilizon_ynh%20(yalh76)/) -[![Install mobilizon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=mobilizon) +[![Install Mobilizon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=mobilizon) > *This package allow you to install Mobilizon 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.* diff --git a/check_process b/check_process index f74dfa7..6281cc6 100644 --- a/check_process +++ b/check_process @@ -1,12 +1,11 @@ ;; Test complet ; Manifest domain="domain.tld" (DOMAIN) - path="/path" (PATH) admin="john" (USER) language="fr" is_public=1 (PUBLIC|public=1|private=0) password="pass" - port="666" (PORT) + name="My Mobilizon" ; Checks pkg_linter=1 setup_sub_dir=0 @@ -34,10 +33,5 @@ Level 9=0 Level 10=0 ;;; 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& - +Email=yalh@yahoo.com +Notification=all diff --git a/conf/.yarnrc b/conf/.yarnrc new file mode 100644 index 0000000..9bc2065 --- /dev/null +++ b/conf/.yarnrc @@ -0,0 +1 @@ +network-timeout 600000 \ No newline at end of file diff --git a/conf/app.src b/conf/app.src index a612bb8..03266c3 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/master/6bf903f9d79dc4f24c35d9e21ebe45abbc0924ed.gz -SOURCE_SUM=074081bd8b688056d7a938d64dfd9da2b7c1d463d4f5bb86a1ddcceec6201cda +SOURCE_URL=https://framagit.org/framasoft/mobilizon/-/archive/master/6bf903f9d79dc4f24c35d9e21ebe45abbc0924ed.tar.gz +SOURCE_SUM=a5cfbdc58a7f7262f7d9b86b151f28097ba5cbacbd227663ebd3b154f06a91eb SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 82b892c..2b05fde 100644 --- a/manifest.json +++ b/manifest.json @@ -6,14 +6,14 @@ "en": "Your federated organization and mobilization platform.", "fr": "Votre plateforme fédérée d'organisation et de mobilisation." }, - "version": "0.1.0-2019-04-12~ynh1", + "version": "0.1.0-2019-04-12~ynh2", "url": "https://joinmobilizon.org/", "license": "AGPL-3.0-or-later", "maintainer": { "name": "yalh76" }, "requirements": { - "yunohost": ">= 3.4" + "yunohost": ">= 3.5" }, "multi_instance": true, "services": [ diff --git a/pull_request_template.md b/pull_request_template.md index fab9f6f..c9bfb76 100644 --- a/pull_request_template.md +++ b/pull_request_template.md @@ -17,7 +17,7 @@ - [ ] **Approval (LGTM)** *Code review and approval have to be from a member of @YunoHost/apps group* - **CI succeeded** : -[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/wikijs_ynh%20-BRANCH-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/wikijs_ynh%20-BRANCH-/) +[![Build Status](https://ci-apps-hq.yunohost.org/jenkins/job/mobilizon_ynh%20-BRANCH-/badge/icon)](https://ci-apps-hq.yunohost.org/jenkins/job/mobilizon_ynh%20-BRANCH-/) *Please replace '-BRANCH-' in this link by the name of the branch used.* *If the PR is from a forked repository. Please provide public results from package_check.* When the PR is marked as ready to merge, you have to wait for 3 days before really merging it. diff --git a/scripts/_common.sh b/scripts/_common.sh index ff6fb78..7f4630a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,9 +6,7 @@ # dependencies used by the app pkg_dependencies="postgresql postgresql-contrib openssl make git postgis " -# build-essential inotify-tools postgresql-client extra_pkg_dependencies="elixir esl-erlang" -# erlang-dev erlang-tools erlang-parsetools #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 431c7f4..33b76f0 100644 --- a/scripts/backup +++ b/scripts/backup @@ -8,7 +8,6 @@ #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_systemd_action source /usr/share/yunohost/helpers #================================================= @@ -57,13 +56,6 @@ ynh_psql_dump_db "$db_name" > db.sql #================================================= # SPECIFIC BACKUP -#================================================= -# BACKUP LOGROTATE -#================================================= -ynh_print_info "Backing up logrotate configuration..." - -ynh_backup "/etc/logrotate.d/$app" - #================================================= # BACKUP SYSTEMD #================================================= diff --git a/scripts/change_url b/scripts/change_url index 321d023..f45bac2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_systemd_action source /usr/share/yunohost/helpers #================================================= diff --git a/scripts/install b/scripts/install index 6023a39..0ef6a6a 100644 --- a/scripts/install +++ b/scripts/install @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_systemd_action source ynh_add_secure_repos__3 source /usr/share/yunohost/helpers @@ -83,6 +82,8 @@ ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs 10 +ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key='https://dl.yarnpkg.com/debian/pubkey.gpg' + #================================================= # INSTALL EXTRA DEPENDENCIES #================================================= @@ -172,13 +173,16 @@ ynh_replace_string "__NAME__" "$name" "../conf/prod.exs" ynh_replace_string "__ADMIN_EMAIL__" "$admin_email" "../conf/prod.exs" cp ../conf/prod.exs "$final_path/$app/config/prod.exs" +# Temprary YARN fix for package material-design-icons +cp ../conf/.yarnrc "$final_path/$app/.yarnrc" + # Give permission to the final_path chown -R "$app":"$app" "$final_path" pushd $final_path/$app/js ynh_use_nodejs - sudo -u $app env PATH=$PATH npm install - sudo -u $app env PATH=$PATH npm run build + sudo -u $app env PATH=$PATH yarn install + sudo -u $app env PATH=$PATH yarn run build popd pushd $final_path/$app @@ -224,21 +228,12 @@ ynh_store_file_checksum "$config" # Set permissions to app files chown -R "$app":"$app" "$final_path" -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_print_info "Configuring log rotation..." - -# Use logrotate to manage application logfile(s) -ynh_use_logrotate - #================================================= # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -#yunohost service add $app --log "/var/log/$app/APP.log" # if using yunohost version 3.2 or more in the 'manifest.json', a description can be added -yunohost service add $app --description "$app daemon for Mobilizon" --log "/var/log/$app/$app.log" +yunohost service add $app --description "$app daemon for Mobilizon" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index dbfdd95..bf80249 100644 --- a/scripts/remove +++ b/scripts/remove @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_systemd_action source /usr/share/yunohost/helpers #================================================= @@ -20,6 +19,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) port=$(ynh_app_setting_get $app port) db_name=$(ynh_app_setting_get $app db_name) +db_user=$db_name final_path=$(ynh_app_setting_get $app final_path) #================================================= @@ -58,7 +58,7 @@ ynh_psql_execute_as_root "\connect $db_name SELECT pg_terminate_backend (pg_stat_activity.pid) FROM pg_stat_activity WHERE pg_stat_activity.datname = '$db_name';" # Remove a database if it exists, along with the associated user -ynh_psql_remove_db "$db_name" "$db_name" +ynh_psql_remove_db --db_user="$db_user" --db_name="$db_name" #================================================= # REMOVE DEPENDENCIES @@ -86,14 +86,6 @@ ynh_print_info "Removing nginx web server configuration" # Remove the dedicated nginx config ynh_remove_nginx_config -#================================================= -# REMOVE LOGROTATE CONFIGURATION -#================================================= -ynh_print_info "Removing logrotate configuration" - -# Remove the app-specific logrotate config -ynh_remove_logrotate - #================================================= # CLOSE A PORT #================================================= diff --git a/scripts/restore b/scripts/restore index d261694..9e4a8ca 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,7 +8,6 @@ #Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh -source ../settings/scripts/ynh_systemd_action source ../settings/scripts/ynh_add_secure_repos__3 source /usr/share/yunohost/helpers @@ -34,6 +33,7 @@ path_url=$(ynh_app_setting_get $app path) final_path=$(ynh_app_setting_get $app final_path) port=$(ynh_app_setting_get $app port) db_name=$(ynh_app_setting_get $app db_name) +db_user=$db_name db_pwd=$(ynh_app_setting_get $app db_pwd) #================================================= @@ -88,6 +88,8 @@ ynh_install_app_dependencies $pkg_dependencies ynh_install_nodejs 10 +ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key='https://dl.yarnpkg.com/debian/pubkey.gpg' + #================================================= # REINSTALL EXTRA DEPENDENCIES #================================================= @@ -102,8 +104,7 @@ ynh_install_extra_app_dependencies --repo="deb http://packages.erlang-solutions. ynh_print_info "Restoring the PostgreSQL database..." ynh_psql_test_if_first_run -db_user=$db_name -ynh_psql_create_user "$app" "$db_pwd" +ynh_psql_create_user "$db_user" "$db_pwd" ynh_psql_execute_as_root "CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' template=template0 OWNER $db_user;" ynh_psql_execute_as_root "\connect $db_name create extension if not exists postgis;" @@ -126,13 +127,7 @@ systemctl daemon-reload # ADVERTISE SERVICE IN ADMIN PANEL #================================================= -yunohost service add $app --description "$app daemon for Mobilizon" --log "/var/log/$app/$app.log" - -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file "/etc/logrotate.d/$app" +yunohost service add $app --description "$app daemon for Mobilizon" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index a868086..33c5514 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -7,7 +7,6 @@ #================================================= source _common.sh -source ynh_systemd_action source ynh_add_secure_repos__3 source /usr/share/yunohost/helpers @@ -185,14 +184,6 @@ ynh_backup_if_checksum_is_different "$config" # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum "$config" -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_print_info "Upgrading logrotate configuration..." - -# Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append - #================================================= # SETUP SYSTEMD #================================================= diff --git a/scripts/ynh_systemd_action b/scripts/ynh_systemd_action deleted file mode 100644 index 6bed6be..0000000 --- a/scripts/ynh_systemd_action +++ /dev/null @@ -1,89 +0,0 @@ -#!/bin/bash - -# Start (or other actions) a service, print a log in case of failure and optionnaly wait until the service is completely started -# -# usage: ynh_systemd_action [-n service_name] [-a action] [ [-l "line to match"] [-p log_path] [-t timeout] [-e length] ] -# | arg: -n, --service_name= - Name of the service to reload. Default : $app -# | arg: -a, --action= - Action to perform with systemctl. Default: start -# | arg: -l, --line_match= - Line to match - The line to find in the log to attest the service have finished to boot. -# If not defined it don't wait until the service is completely started. -# | arg: -p, --log_path= - Log file - Path to the log file. Default : /var/log/$app/$app.log -# | arg: -t, --timeout= - Timeout - The maximum time to wait before ending the watching. Default : 300 seconds. -# | arg: -e, --length= - Length of the error log : Default : 20 -ynh_systemd_action() { - # Declare an array to define the options of this helper. - declare -Ar args_array=( [n]=service_name= [a]=action= [l]=line_match= [p]=log_path= [t]=timeout= [e]=length= ) - local service_name - local action - local line_match - local length - local log_path - local timeout - - # Manage arguments with getopts - ynh_handle_getopts_args "$@" - - local service_name="${service_name:-$app}" - local action=${action:-start} - local log_path="${log_path:-/var/log/$service_name/$service_name.log}" - local length=${length:-20} - local timeout=${timeout:-300} - - # Start to read the log - if [[ -n "${line_match:-}" ]] - then - local templog="$(mktemp)" - # Following the starting of the app in its log - if [ "$log_path" == "systemd" ] ; then - # Read the systemd journal - journalctl -u $service_name -f --since=-45 > "$templog" & - else - # Read the specified log file - tail -F -n0 "$log_path" > "$templog" & - fi - # Get the PID of the tail command - local pid_tail=$! - fi - - echo "${action^} the service $service_name" >&2 - systemctl $action $service_name \ - || ( journalctl --lines=$length -u $service_name >&2 \ - ; test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 \ - ; false ) - - # Start the timeout and try to find line_match - if [[ -n "${line_match:-}" ]] - then - local i=0 - for i in $(seq 1 $timeout) - do - # Read the log until the sentence is found, that means the app finished to start. Or run until the timeout - if grep --quiet "$line_match" "$templog" - then - echo "The service $service_name has correctly started." >&2 - break - fi - echo -n "." >&2 - sleep 1 - done - if [ $i -eq $timeout ] - then - echo "The service $service_name didn't fully started before the timeout." >&2 - journalctl --lines=$length -u $service_name >&2 - test -n "$log_path" && echo "--" && tail --lines=$length "$log_path" >&2 - fi - - echo "" - ynh_clean_check_starting - fi -} - -# Clean temporary process and file used by ynh_check_starting -# (usually used in ynh_clean_setup scripts) -# -# usage: ynh_clean_check_starting -ynh_clean_check_starting () { - # Stop the execution of tail. - kill -s 15 $pid_tail 2>&1 - ynh_secure_remove "$templog" 2>&1 -}