diff --git a/README.md b/README.md index 8d26b77..817f7f0 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,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.1.8 +**Shipped version:** 2.2.1 ## Screenshots diff --git a/check_process b/check_process index 7909cb5..8b76740 100644 --- a/check_process +++ b/check_process @@ -12,7 +12,7 @@ setup_private=1 setup_public=1 upgrade=1 - upgrade=1 from_commit=c97db21b4a821651355c48c4f7efdfb763e2a072 + upgrade=1 from_commit=c8a29d271b87eac57e8dbf1a464c11a51d09810c backup_restore=1 # Activate multi-instance test only if you have more than 2Gb RAM! multi_instance=1 @@ -36,6 +36,6 @@ Email= Notification=none ;;; Upgrade options - ; commit=c97db21b4a821651355c48c4f7efdfb763e2a072 - name=Upgrade to upstream version 2.0.2 + ; commit=c8a29d271b87eac57e8dbf1a464c11a51d09810c + name=Upgrade to upstream version 2.1.8 manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1& diff --git a/conf/app.src b/conf/app.src index ae4b78f..f16533e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,3 +1,3 @@ -SOURCE_URL=https://github.com/discourse/discourse/archive/v2.1.8.tar.gz -SOURCE_SUM=f4c18a61f47d29381677e10d3ffaf68c407cc07eb5dae3b9a97245fab9f1d4b1 +SOURCE_URL=https://github.com/discourse/discourse/archive/v2.2.1.tar.gz +SOURCE_SUM=d7fb8ea9facefa8a0488c89b478a544eb032c5ab36dba4b39c95f0d2462af25b SOURCE_FORMAT=tar.gz diff --git a/conf/ldap-auth.src b/conf/ldap-auth.src index b17b8ec..6cef53e 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.3.5.tar.gz -SOURCE_SUM=18aa689a2583ca1dc6bb75257a8bd951e6bbc6b16d64f5585b0452ffe0e91a8c +SOURCE_URL=https://github.com/jonmbake/discourse-ldap-auth/archive/v0.4.0.tar.gz +SOURCE_SUM=5fedfe5f287f0ec49e5acf0591fda38084024676de490c6c35e9194de3440185 SOURCE_FORMAT=tar.gz diff --git a/manifest.json b/manifest.json index 9ae374c..6f9939c 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Discussion platform", "fr": "Plateforme de discussion" }, - "version": "2.1.8~ynh1", + "version": "2.2.1~ynh1", "url": "http://Discourse.org", "license": "GPL-2.0", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 75a06dd..319af2c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # pkg_dependencies="libjemalloc1 libjemalloc-dev zlib1g-dev libreadline-dev libpq-dev libssl-dev libyaml-dev libcurl4-openssl-dev libapr1-dev libxslt1-dev checkinstall libxml2-dev vim imagemagick postgresql postgresql-server-dev-all postgresql-contrib optipng jhead jpegoptim gifsicle" -RUBY_VERSION="2.4.4" +RUBY_VERSION="2.6.0" # Execute a command as another user with login # (hence in user home dir, with prior loading of .profile, etc.) @@ -339,13 +339,6 @@ SOURCE_SUM=41f1a60714c55eceb21d692a469aee1ec4f46bba351d0dfcb0c660ff9cf1a1c9" > " # Download and extract rbenv ynh_setup_source "$rbenv_install_dir" rbenv - # Build an app.src for ruby-build - mkdir -p "../conf" - echo "SOURCE_URL=https://github.com/rbenv/ruby-build/archive/v20180329.tar.gz -SOURCE_SUM=4c8610c178ef2fa6bb29d4bcfca52608914632a51a56a5e70aeec8bf0894167b" > "../conf/ruby-build.src" - # Download and extract ruby-build - ynh_setup_source "$rbenv_install_dir/plugins/ruby-build" ruby-build - (cd $rbenv_install_dir ./src/configure && make -C src) @@ -396,6 +389,16 @@ ynh_install_ruby () { ynh_install_rbenv fi + # Download ruby-build (replace if already exists) + if [ -d $rbenv_install_dir/plugins/ruby-build ]; then + rm -Rf $rbenv_install_dir/plugins/ruby-build + fi + # Build an app.src for ruby-build + mkdir -p "../conf" + echo "SOURCE_URL=https://github.com/rbenv/ruby-build/archive/v20181225.tar.gz +SOURCE_SUM=5ace4787ace47384dc419b20f5eb5a59f1174e00bfabcfed74a175033cd0b18a" > "../conf/ruby-build.src" + # Download and extract ruby-build + ynh_setup_source "$rbenv_install_dir/plugins/ruby-build" ruby-build # Restore /usr/local/bin in PATH (if needed) PATH=$CLEAR_PATH diff --git a/scripts/install b/scripts/install index abbb637..22df98d 100644 --- a/scripts/install +++ b/scripts/install @@ -272,7 +272,7 @@ y # Patch ldap-auth plugin dependency (omniauth-ldap) to fix it when using domain subfolder # (Can only do that now because we are patching dependencies which have just been downloaded) # Patch applied: https://github.com/omniauth/omniauth-ldap/pull/16 -(cd $final_path/plugins/discourse-ldap-auth/gems/*/gems/omniauth-ldap*/ +(cd $final_path/plugins/discourse-ldap-auth/gems/${RUBY_VERSION}/gems/omniauth-ldap*/ patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch) #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 1418e1b..7d33322 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -66,12 +66,6 @@ fi ynh_install_app_dependencies "$pkg_dependencies" -#================================================= -# INSTALL RUBY -#================================================= - -ynh_install_ruby $RUBY_VERSION - #================================================= # NGINX CONFIGURATION #================================================= @@ -99,12 +93,42 @@ if ! ynh_is_upstream_up_to_date ; then cp ../sources/patches_arm/* ../sources/patches fi ynh_app_setting_set $app final_path $final_path + # Backup files to keep + tmpdir=$(mktemp -d) + cp -Rp $final_path/public/uploads $final_path/plugins $final_path/config/discourse.conf $tmpdir + if [ -d $final_path/public/backups ] ; then + cp -Rp $final_path/public/backups $tmpdir + fi + if [ -d $final_path/log ] ; then + cp -Rp $final_path/log $tmpdir + fi + # Remove destination directory + ynh_secure_remove $final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source "$final_path" + # Restore previous files + cp -Rp $tmpdir/uploads $final_path/public + if [ -d $tmpdir/backups ] ; then + cp -Rp $tmpdir/backups $final_path/public + fi + if [ -d $tmpdir/log ] ; then + cp -Rp $tmpdir/log $final_path + fi + cp -Rp $tmpdir/plugins/* $final_path/plugins + cp -Rp $tmpdir/log $final_path + cp -p $tmpdir/discourse.conf $final_path/config + # Install LDAP plugin + ynh_secure_remove "$final_path/plugins/discourse-ldap-auth" mkdir -p "$final_path/plugins/discourse-ldap-auth" ynh_setup_source "$final_path/plugins/discourse-ldap-auth" ldap-auth + #================================================= + # INSTALL RUBY + #================================================= + + ynh_install_ruby $RUBY_VERSION + #================================================= # SPECIFIC SETUP #================================================= @@ -149,6 +173,7 @@ if ! ynh_is_upstream_up_to_date ; then # Make a backup of the original config file if modified ynh_backup_if_checksum_is_different "$final_path/plugins/discourse-ldap-auth/config/settings.yml" + # Configure LDAP plugin ldap_config_file="$final_path/plugins/discourse-ldap-auth/config/settings.yml" ynh_replace_string "adfs.example.com" "localhost" "$ldap_config_file" @@ -156,6 +181,9 @@ if ! ynh_is_upstream_up_to_date ; then ynh_replace_string "sAMAccountName" "uid" "$ldap_config_file" ynh_store_file_checksum "$ldap_config_file" + # Disable svgo worker + echo "svgo: false" > $final_path/.image_optim.yml + #================================================= # SETUP UNICORN, A RUBY SERVER #================================================= @@ -176,14 +204,20 @@ if ! ynh_is_upstream_up_to_date ; then chown -R $app: $final_path - # Install puma with gem (cd "$final_path" # Install bundler, a gems installer gem install bundler # Install without documentation - exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc" + exec_as $app echo "gem: --no-ri --no-rdoc" >> "$final_path/.gemrc") + # Specific actions on ARM architecture + if [ -n "$(uname -m | grep arm)" ] ; then + # Define the platform specifically to retrieve binaries + # for libv8 because it currently doesn't compile on ARM devices + exec_login_as $app bundle config specific_platform arm-linux + fi # Install dependencies - exec_login_as $app bundle install --path vendor/bundle --with development) + exec_login_as $app MAKEFLAGS=-j2 bundle install --jobs 2 --path vendor/bundle --with development + # On ARM architecture, replace bundled libpsl by system native libpsl # because the provided binary isn't compatible if [ -n "$(uname -m | grep arm)" ] ; then @@ -200,12 +234,26 @@ if ! ynh_is_upstream_up_to_date ; then $rake_exec db:migrate $rake_exec assets:precompile + #================================================= + # CONFIGURE PLUGINS + #================================================= + + # Patch ldap-auth plugin dependency (omniauth-ldap) to fix it when using domain subfolder + # (Can only do that now because we are patching dependencies which have just been downloaded) + # Patch applied: https://github.com/omniauth/omniauth-ldap/pull/16 + (cd $final_path/plugins/discourse-ldap-auth/gems/${RUBY_VERSION}/gems/omniauth-ldap*/ + patch -p1 < $YNH_CWD/../conf/ldap-auth-fix-subfolder.patch) + #================================================= # GENERIC FINALIZATION #================================================= # SECURE FILES AND DIRECTORIES #================================================= + # Add a pids and socket directory for the systemd script. + mkdir -p "$final_path/tmp/pids" + mkdir "$final_path/tmp/sockets" + # Set permissions to app files chown -R $app: $final_path # Restrict rights to log directory (needed by logrotate) diff --git a/sources/patches/app-1-use-latest_uglify-js.patch b/sources/patches/app-1-use-latest_uglify-js.patch index c8b9584..97d9375 100644 --- a/sources/patches/app-1-use-latest_uglify-js.patch +++ b/sources/patches/app-1-use-latest_uglify-js.patch @@ -1,12 +1,12 @@ diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake -index bdca7c30ed..847a8d07c2 100644 +index 8575ca11dc..a643316bac 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake -@@ -95,6 +95,7 @@ def compress_ruby(from, to) +@@ -94,6 +94,7 @@ def compress_ruby(from, to) data = File.read("#{assets_path}/#{from}") uglified, map = Uglifier.new(comments: :none, + harmony: true, source_map: { filename: File.basename(from), - output_filename: File.basename(to) \ No newline at end of file + output_filename: File.basename(to) diff --git a/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch b/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch index a1f830f..7dc2ba8 100644 --- a/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch +++ b/sources/patches_arm/app-2-Revert-libv8-mini_racer-dependencies-for-ARM-compati.patch @@ -1,9 +1,9 @@ diff --git a/Gemfile.lock b/Gemfile.lock -index 5752044b07..016f600bcc 100644 +index b59803ab6a..02b5d55b3d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock -@@ -171,7 +171,7 @@ GEM - jwt (1.5.6) +@@ -172,7 +172,7 @@ GEM + jwt (2.1.0) kgio (2.11.2) kramdown (1.17.0) - libv8 (6.7.288.46.1) @@ -11,14 +11,14 @@ index 5752044b07..016f600bcc 100644 listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) -@@ -198,8 +198,8 @@ GEM +@@ -200,8 +200,8 @@ GEM method_source (0.8.2) - mini_mime (1.0.0) + mini_mime (1.0.1) mini_portile2 (2.3.0) -- mini_racer (0.2.0) +- mini_racer (0.2.3) - libv8 (>= 6.3) + mini_racer (0.1.15) + libv8 (~> 6.3) - mini_scheduler (0.8.1) + mini_scheduler (0.9.1) + sidekiq mini_sql (0.1.10) - mini_suffix (0.3.0)