From 5047128790da78e627ade9d2e70ee00100f37b5b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Jun 2021 19:03:56 +0200 Subject: [PATCH 1/8] Fix --- scripts/_common.sh | 16 ++-------------- scripts/install | 2 +- scripts/upgrade | 2 +- 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 8c27940..4dda438 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -6,7 +6,7 @@ pkg_dependencies="g++ libjemalloc1|libjemalloc2 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-dev libapr1-dev libxslt1-dev libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle brotli" -RUBY_VERSION="3.0.1" +RUBY_VERSION="2.7.3" #================================================= # PERSONAL HELPERS @@ -18,19 +18,7 @@ RUBY_VERSION="3.0.1" exec_login_as() { local user=$1 shift 1 - exec_as $user --login "$@" -} -# Execute a command as another user -# usage: exec_as USER COMMAND [ARG ...] -exec_as() { - local user=$1 - shift 1 - - if [[ $user = $(whoami) ]]; then - eval "$@" - else - sudo -u "$user" "$@" - fi + ynh_exec_as $user --login "$@" } # Returns true if a swap partition is enabled, false otherwise diff --git a/scripts/install b/scripts/install index 474a44f..53fa060 100644 --- a/scripts/install +++ b/scripts/install @@ -199,7 +199,7 @@ pushd "$final_path" # Install bundler, a gems installer ynh_gem install bundler # Install without documentation - exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc" + ynh_exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc" popd # Specific actions on ARM architecture diff --git a/scripts/upgrade b/scripts/upgrade index bb7afcd..c9a87a5 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -274,7 +274,7 @@ then # Install bundler, a gems installer ynh_gem install bundler # Install without documentation - exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc" + ynh_exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc" popd # Specific actions on ARM architecture From 12e22fb41363f16f38f71c0eb4013596a67de7cf Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Jun 2021 20:02:37 +0200 Subject: [PATCH 2/8] Set sleep --- scripts/change_url | 1 + scripts/install | 1 + scripts/restore | 1 + scripts/upgrade | 1 + 4 files changed, 4 insertions(+) diff --git a/scripts/change_url b/scripts/change_url index 1a5dbd5..18d0666 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -150,6 +150,7 @@ ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" +sleep 60 #================================================= # RELOAD NGINX diff --git a/scripts/install b/scripts/install index 53fa060..7a3e2b6 100644 --- a/scripts/install +++ b/scripts/install @@ -344,6 +344,7 @@ ynh_script_progression --message="Starting a systemd service..." # Start a systemd service ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" +sleep 60 #================================================= # SETUP SSOWAT diff --git a/scripts/restore b/scripts/restore index a723f6e..a9b6b9c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -136,6 +136,7 @@ else fi ynh_app_setting_set --app=$app --key=unicorn_workers --value=$unicorn_workers ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" +sleep 60 #================================================= # RESTORE THE LOGROTATE CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index c9a87a5..0240b94 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -398,6 +398,7 @@ yunohost service add $app --log "$final_path/log/unicorn.stderr.log" "$final_pat ynh_script_progression --message="Starting a systemd service..." ynh_systemd_action --service_name=$app --action="start" --log_path="$final_path/log/unicorn.stderr.log" --line_match="INFO -- : worker=$((unicorn_workers-1)) ready" +sleep 60 #================================================= # DISABLE MAINTENANCE MODE From 99f528c777d935586e0b5325b99289b7fa4cf3a0 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Jun 2021 20:21:07 +0200 Subject: [PATCH 3/8] Update _common.sh --- scripts/_common.sh | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 4dda438..f0360f0 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -270,11 +270,11 @@ ynh_install_ruby () { ynh_print_info --message="rbenv already seems installed in \`$rbenv'." pushd "${rbenv%/*/*}" if git remote -v 2>/dev/null | grep "https://github.com/rbenv/rbenv.git"; then - ynh_print_info --message="Trying to update with git..." + ynh_print_info --message="Trying to update with Git..." git pull -q --tags origin master ynh_ruby_try_bash_extension else - ynh_print_info --message="Reinstalling rbenv with git..." + ynh_print_info --message="Reinstalling rbenv with Git..." cd .. ynh_secure_remove --file=$rbenv_install_dir mkdir -p $rbenv_install_dir @@ -287,7 +287,7 @@ ynh_install_ruby () { fi popd else - ynh_print_info --message="Installing rbenv with git..." + ynh_print_info --message="Installing rbenv with Git..." mkdir -p $rbenv_install_dir pushd $rbenv_install_dir git init -q @@ -308,7 +308,7 @@ ynh_install_ruby () { fi popd else - ynh_print_info --message="Installing ruby-build with git..." + ynh_print_info --message="Installing ruby-build with Git..." mkdir -p "${rbenv_install_dir}/plugins" git clone -q https://github.com/rbenv/ruby-build.git "${rbenv_install_dir}/plugins/ruby-build" fi @@ -323,7 +323,7 @@ ynh_install_ruby () { fi popd else - ynh_print_info --message="Installing rbenv-aliases with git..." + ynh_print_info --message="Installing rbenv-aliases with Git..." mkdir -p "${rbenv_install_dir}/plugins" git clone -q https://github.com/tpope/rbenv-aliases.git "${rbenv_install_dir}/plugins/rbenv-aliase" fi @@ -338,7 +338,7 @@ ynh_install_ruby () { fi popd else - ynh_print_info --message="Installing xxenv-latest with git..." + ynh_print_info --message="Installing xxenv-latest with Git..." mkdir -p "${rbenv_install_dir}/plugins" git clone -q https://github.com/momo-lab/xxenv-latest.git "${rbenv_install_dir}/plugins/xxenv-latest" fi @@ -380,10 +380,10 @@ ynh_install_ruby () { # Set environment for Ruby users echo "#rbenv -export RBENV_ROOT=$rbenv_install_dir -export PATH=\"$rbenv_install_dir/bin:$PATH\" -eval \"\$(rbenv init -)\" -#rbenv" > /etc/profile.d/rbenv.sh + export RBENV_ROOT=$rbenv_install_dir + export PATH=\"$rbenv_install_dir/bin:$PATH\" + eval \"\$(rbenv init -)\" + #rbenv" > /etc/profile.d/rbenv.sh # Load the environment eval "$(rbenv init -)" From c7e1e4df9acfb336d58bac67c50a8416e9b62d7e Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Jun 2021 20:26:49 +0200 Subject: [PATCH 4/8] Update DISCLAIMER.md --- doc/DISCLAIMER.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 08c94c4..5ac5325 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -30,7 +30,7 @@ $ RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails c $ UserEmail.create!(user: User.find_by_username("foo"), email: "foo@theirexternalmail.com") ``` -Discourse can now receive mail from `foo@theirexternalmail.com` and give it to the user account with mail address `foo@myyunohostdomain.org`. +Discourse can now receive email from `foo@theirexternalmail.com` and give it to the user account with mail address `foo@myyunohostdomain.org`. #### Multi-user support @@ -47,4 +47,3 @@ When disabling Local Login and other authentication services, clicking the `Logi ![Disable Local](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/disable_local.png) ![LDAP Login Popup](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/ldap_popup.png) - From 31641a9659752268cb21c4b0eb80b43369af4474 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Thu, 3 Jun 2021 18:26:58 +0000 Subject: [PATCH 5/8] Auto-update README --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index d070ecc..58814fa 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ $ RAILS_ENV=production /opt/rbenv/versions/2.6.0/bin/bundle exec rails c $ UserEmail.create!(user: User.find_by_username("foo"), email: "foo@theirexternalmail.com") ``` -Discourse can now receive mail from `foo@theirexternalmail.com` and give it to the user account with mail address `foo@myyunohostdomain.org`. +Discourse can now receive email from `foo@theirexternalmail.com` and give it to the user account with mail address `foo@myyunohostdomain.org`. #### Multi-user support @@ -77,7 +77,6 @@ When disabling Local Login and other authentication services, clicking the `Logi ![LDAP Login Popup](https://raw.githubusercontent.com/jonmbake/screenshots/master/discourse-ldap-auth/ldap_popup.png) - ## Documentation and resources * Official app website: http://Discourse.org From c2b52cf95fd76832b426eaf6e4099352e18f5bb4 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Jun 2021 23:18:46 +0200 Subject: [PATCH 6/8] remove duplicats --- scripts/install | 12 ++++++------ scripts/upgrade | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/scripts/install b/scripts/install index 7a3e2b6..0670f06 100644 --- a/scripts/install +++ b/scripts/install @@ -190,9 +190,9 @@ secret="$(ynh_string_random)" ynh_add_config --template="../conf/secrets.yml" --destination="$final_path/config/secrets.yml" # Set permissions to app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +# chmod 750 "$final_path" +# chmod -R o-rwx "$final_path" +# chown -R $app:www-data "$final_path" pushd "$final_path" ynh_use_ruby @@ -316,9 +316,9 @@ mkdir -p "public/forum" cd public/forum && ln -s ../uploads && ln -s ../backups ) -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +# chmod 750 "$final_path" +# chmod -R o-rwx "$final_path" +# chown -R $app:www-data "$final_path" #================================================= # SETUP LOGROTATE diff --git a/scripts/upgrade b/scripts/upgrade index 0240b94..984961d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -266,9 +266,9 @@ then ynh_add_config --template="../conf/secrets.yml" --destination="$final_path/config/secrets.yml" # Set permissions to app files - chmod 750 "$final_path" - chmod -R o-rwx "$final_path" - chown -R $app:www-data "$final_path" + # chmod 750 "$final_path" + # chmod -R o-rwx "$final_path" + # chown -R $app:www-data "$final_path" pushd "$final_path" # Install bundler, a gems installer @@ -371,9 +371,9 @@ mkdir -p "$final_path/tmp/sockets" ) # Set permissions to app files -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" +# chmod 750 "$final_path" +# chmod -R o-rwx "$final_path" +# chown -R $app:www-data "$final_path" #================================================= # SETUP LOGROTATE From ebff5863f6e3d4e559c9ecbf5f113e4720f7882a Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Jun 2021 23:20:35 +0200 Subject: [PATCH 7/8] Fix --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 0670f06..94698a6 100644 --- a/scripts/install +++ b/scripts/install @@ -61,7 +61,7 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= ynh_script_progression --message="Installing dependencies..." -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_install_ruby --ruby_version=$RUBY_VERSION #================================================= diff --git a/scripts/restore b/scripts/restore index a9b6b9c..d7ffd25 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,7 +82,7 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_install_ruby --ruby_version=$RUBY_VERSION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 984961d..d3b2977 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -186,7 +186,7 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Upgrading dependencies..." -ynh_install_app_dependencies $pkg_dependencies +ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies ynh_install_ruby --ruby_version=$RUBY_VERSION ynh_use_ruby From 1cd6e29c8f6fbf378e8037108daaf3ec6a5babb2 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Thu, 3 Jun 2021 23:34:41 +0200 Subject: [PATCH 8/8] Fix --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 94698a6..0670f06 100644 --- a/scripts/install +++ b/scripts/install @@ -61,7 +61,7 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin #================================================= ynh_script_progression --message="Installing dependencies..." -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies ynh_install_ruby --ruby_version=$RUBY_VERSION #================================================= diff --git a/scripts/restore b/scripts/restore index d7ffd25..a9b6b9c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -82,7 +82,7 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies ynh_install_ruby --ruby_version=$RUBY_VERSION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index d3b2977..984961d 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -186,7 +186,7 @@ ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= ynh_script_progression --message="Upgrading dependencies..." -ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies +ynh_install_app_dependencies $pkg_dependencies ynh_install_ruby --ruby_version=$RUBY_VERSION ynh_use_ruby