diff --git a/README.md b/README.md index 9be4c9e..910804c 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Finally, if installing on a low-end ARM device (e.g. Raspberry Pi): To learn more about the philosophy and goals of the project, [visit **discourse.org**](http://www.discourse.org). -**Shipped version:** 2.3.10 +**Shipped version:** 2.5.4 ## Screenshots @@ -139,8 +139,7 @@ systemctl restart discourse --- -Developer info ----------------- +## Developer info Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/discourse_ynh/tree/testing). diff --git a/conf/app.src b/conf/app.src index d73b146..b52569c 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.3.10.tar.gz -SOURCE_SUM=1f7a9672b983d876ed2719b3d347575a76000cc189bfa3e045341728f92fd3f8 +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.5.4.tar.gz +SOURCE_SUM=aa2b2cd9efdde3d50c930593e2ab13a634759f77d4d6dcd613a714ccbc30ec86 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/conf/ldap-auth.src b/conf/ldap-auth.src index 6cef53e..5a4f6b5 100644 --- a/conf/ldap-auth.src +++ b/conf/ldap-auth.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/jonmbake/discourse-ldap-auth/archive/v0.4.0.tar.gz -SOURCE_SUM=5fedfe5f287f0ec49e5acf0591fda38084024676de490c6c35e9194de3440185 +SOURCE_URL=https://github.com/jonmbake/discourse-ldap-auth/archive/v0.4.1.tar.gz +SOURCE_SUM=08afddecc236cb04f515fe510553c1530bfbec32470682bee89cde1760f4c81f SOURCE_FORMAT=tar.gz diff --git a/conf/nginx.conf b/conf/nginx.conf index bf3b225..063886b 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -27,7 +27,7 @@ log_not_found off; } - #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { alias __FINALPATH__/public/; proxy_hide_header ETag; diff --git a/conf/systemd.service b/conf/systemd.service index 35beda8..1962bc5 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -13,6 +13,7 @@ Environment=__ADDITIONAL_ENV__ Environment=RAILS_ENV=production Environment=UNICORN_SIDEKIQS=1 Environment=LD_PRELOAD=__LIBJEMALLOC__ +Environment=UNICORN_LISTENER=__FINALPATH__/tmp/sockets/unicorn.sock ExecStart=__RBENVROOT__/shims/bundle exec unicorn --config config/unicorn.conf.rb -E production Restart=always RestartSec=10 diff --git a/manifest.json b/manifest.json index 99b0585..c3dbd7a 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.3.10~ynh2", + "version": "2.5.4~ynh1", "url": "http://Discourse.org", "license": "GPL-2.0", "maintainer": { @@ -15,7 +15,7 @@ "url": "" }, "requirements": { - "yunohost": ">= 3.5" + "yunohost": ">= 4.0" }, "multi_instance": true, "services": [ diff --git a/scripts/_common.sh b/scripts/_common.sh index b1c3267..ecc6bb3 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-openssl-dev libapr1-dev libxslt1-dev libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle brotli" -RUBY_VERSION="2.6.5" +RUBY_VERSION="2.7.1" #================================================= # PERSONAL HELPERS @@ -183,8 +183,8 @@ SOURCE_SUM=80ad89ffe04c0b481503bd375f05c212bbc7d44ef5f5e649e0acdf25eba86736" > " # Build an app.src for ruby-build mkdir -p "../conf" - echo "SOURCE_URL=https://github.com/rbenv/ruby-build/archive/v20191004.tar.gz -SOURCE_SUM=6f053957acb0af6d621ebf2b9dacc9c265844b2dc6842a021eb10f0a70094fe8" > "../conf/ruby-build.src" + echo "SOURCE_URL=https://github.com/rbenv/ruby-build/archive/v20200520.tar.gz +SOURCE_SUM=52be6908a94fbd4a94f5064e8b19d4a3baa4b773269c3884165518d83bcc8922" > "../conf/ruby-build.src" # Download and extract ruby-build ynh_setup_source "$rbenv_install_dir/plugins/ruby-build" ruby-build @@ -240,7 +240,10 @@ ynh_install_ruby () { if ! type rbenv > /dev/null 2>&1 then ynh_install_rbenv - elif dpkg --compare-versions "$(/opt/rbenv/bin/rbenv --version | cut -d" " -f2)" lt "1.1.2" + elif dpkg --compare-versions "$($rbenv_install_dir/bin/rbenv --version | cut -d" " -f2)" lt "1.1.2" + then + ynh_install_rbenv + elif dpkg --compare-versions "$($rbenv_install_dir/plugins/ruby-build/bin/ruby-build --version | cut -d" " -f2)" lt "20200520" then ynh_install_rbenv fi @@ -252,7 +255,7 @@ ynh_install_ruby () { test -x /usr/bin/ruby_rbenv && mv /usr/bin/ruby_rbenv /usr/bin/ruby # Install the requested version of ruby - CONFIGURE_OPTS="--disable-install-doc" MAKE_OPTS="-j2" rbenv install --skip-existing $ruby_version + CONFIGURE_OPTS="--disable-install-doc --with-jemalloc" MAKE_OPTS="-j2" rbenv install --skip-existing $ruby_version # Store the ID of this app and the version of ruby requested for it echo "$YNH_APP_ID:$ruby_version" | tee --append "$rbenv_install_dir/ynh_app_version" @@ -303,6 +306,35 @@ ynh_remove_ruby () { fi } +# Remove the version of ruby used by the app. +# +# This helper will check if another app uses the same version of ruby, +# if not, this version of ruby will be removed. +# If no other app uses ruby, rbenv will be also removed. +# +# usage: ynh_remove_ruby +ynh_remove_ruby () { + ruby_version=$(ynh_app_setting_get $app ruby_version) + + # Remove the line for this app + sed --in-place "/$YNH_APP_ID:$ruby_version/d" "$rbenv_install_dir/ynh_app_version" + + # If no other app uses this version of ruby, remove it. + if ! grep --quiet "$ruby_version" "$rbenv_install_dir/ynh_app_version" + then + $rbenv_install_dir/bin/rbenv uninstall --force $ruby_version + fi + + # Remove rbenv environment configuration + rm /etc/profile.d/rbenv.sh + + # If no other app uses rbenv, remove rbenv and dedicated group + if [ ! -s "$rbenv_install_dir/ynh_app_version" ] + then + ynh_secure_remove "$rbenv_install_dir" + fi +} + # Returns true if upstream version is up to date # # This helper should be used to avoid an upgrade of the upstream version diff --git a/scripts/install b/scripts/install index cabdc87..5cdc028 100644 --- a/scripts/install +++ b/scripts/install @@ -188,13 +188,6 @@ echo "svgo: false" > $final_path/.image_optim.yml #================================================= ynh_script_progression --message="Setting up Unicorn..." -unicorn_config_file="$final_path/config/unicorn.conf.rb" -# Use socket connection -ynh_replace_string --match_string='listen (ENV\["UNICORN_PORT"\] || 3000).to_i' --replace_string='# listen (ENV["UNICORN_PORT"] || 3000).to_i' "--target_file=$unicorn_config_file" -ynh_replace_string --match_string='# listen "#{discourse_path}/tmp/sockets/unicorn.sock"' --replace_string='listen "#{discourse_path}/tmp/sockets/unicorn.sock"' --target_file="$unicorn_config_file" -# Calculate and store the config file checksum -ynh_store_file_checksum --file="$unicorn_config_file" - # Set a secret value cp ../conf/secrets.yml "$final_path/config/secrets.yml" ynh_replace_string --match_string="__SECRET__" --replace_string="$(ynh_string_random)" --target_file="$final_path/config/secrets.yml" diff --git a/scripts/upgrade b/scripts/upgrade index 2c3f006..5ea6b12 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -253,11 +253,7 @@ then # Make a backup of the original config file if modified ynh_backup_if_checksum_is_different "$unicorn_config_file" - # Use socket connection - ynh_replace_string --match_string='listen (ENV\["UNICORN_PORT"\] || 3000).to_i' --replace_string='# listen (ENV["UNICORN_PORT"] || 3000).to_i' --target_file="$unicorn_config_file" - ynh_replace_string --match_string='# listen "#{discourse_path}/tmp/sockets/unicorn.sock"' --replace_string='listen "#{discourse_path}/tmp/sockets/unicorn.sock"' --target_file="$unicorn_config_file" - - # Calculate and store the config file checksum + # Calculate and store the config file checksum ynh_store_file_checksum --file="$unicorn_config_file" secret_config_file="$final_path/config/secrets.yml"